Merge pull request #831 from mahkoh/jorth/absolute-warp
seat: don't set CURSOR_MOVED flag for warps
This commit is contained in:
commit
af66c661ae
3 changed files with 34 additions and 12 deletions
|
|
@ -7,7 +7,7 @@ use {
|
|||
ei_object::{EiObject, EiVersion},
|
||||
},
|
||||
fixed::Fixed,
|
||||
ifs::wl_seat::PX_PER_SCROLL,
|
||||
ifs::wl_seat::{CursorPositionType, PX_PER_SCROLL},
|
||||
leaks::Tracker,
|
||||
rect::Rect,
|
||||
scale::Scale,
|
||||
|
|
@ -22,6 +22,7 @@ use {
|
|||
},
|
||||
},
|
||||
},
|
||||
CursorPositionType::Motion,
|
||||
linearize::LinearizeExt,
|
||||
std::{cell::Cell, rc::Rc},
|
||||
thiserror::Error,
|
||||
|
|
@ -227,7 +228,7 @@ impl EiDeviceRequestHandler for EiDevice {
|
|||
if let Some((x, y)) = self.absolute_motion.take() {
|
||||
let x = Fixed::from_f32(x);
|
||||
let y = Fixed::from_f32(y);
|
||||
seat.motion_event_abs(time, x, y);
|
||||
seat.motion_event_abs(time, x, y, Motion);
|
||||
}
|
||||
{
|
||||
let mut need_frame = false;
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ use {
|
|||
},
|
||||
wire_ei::EiSeatId,
|
||||
},
|
||||
CursorPositionType::Warp,
|
||||
ahash::AHashMap,
|
||||
jay_config::{
|
||||
input::FallbackOutputMode as ConfigFallbackOutputMode,
|
||||
|
|
@ -2012,7 +2013,7 @@ pub async fn handle_position_hint_requests(state: Rc<State>) {
|
|||
req.new_pos.0 + (current_pos.0 - req.old_pos.0),
|
||||
req.new_pos.1 + (current_pos.1 - req.old_pos.1),
|
||||
);
|
||||
req.seat.motion_event_abs(state.now_usec(), x, y);
|
||||
req.seat.motion_event_abs(state.now_usec(), x, y, Warp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2033,7 +2034,13 @@ pub async fn handle_warp_mouse_to_focus(state: Rc<State>) {
|
|||
continue;
|
||||
}
|
||||
let (x, y) = (Fixed::from_int(x), Fixed::from_int(y));
|
||||
seat.motion_event_abs(state.now_usec(), x, y);
|
||||
seat.motion_event_abs(state.now_usec(), x, y, Warp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum CursorPositionType {
|
||||
Motion,
|
||||
Warp,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ use {
|
|||
},
|
||||
},
|
||||
wl_seat::{
|
||||
CHANGE_CURSOR_MOVED, CHANGE_TREE, Dnd, MarkMode, SeatId, WlSeat, WlSeatGlobal,
|
||||
CHANGE_CURSOR_MOVED, CHANGE_TREE, CursorPositionType, Dnd, MarkMode, SeatId,
|
||||
WlSeat, WlSeatGlobal,
|
||||
tablet::{TabletPad, TabletPadId, TabletTool, TabletToolId},
|
||||
text_input::TextDisconnectReason,
|
||||
wl_keyboard::WlKeyboard,
|
||||
|
|
@ -49,6 +50,7 @@ use {
|
|||
},
|
||||
wire::WlDataOfferId,
|
||||
},
|
||||
CursorPositionType::Motion,
|
||||
isnt::std_1::primitive::IsntSliceExt,
|
||||
jay_config::{
|
||||
input::SwitchEvent,
|
||||
|
|
@ -595,10 +597,16 @@ impl WlSeatGlobal {
|
|||
let pos = output.global.pos.get();
|
||||
x += Fixed::from_int(pos.x1());
|
||||
y += Fixed::from_int(pos.y1());
|
||||
self.motion_event_abs(time_usec, x, y);
|
||||
self.motion_event_abs(time_usec, x, y, Motion);
|
||||
}
|
||||
|
||||
pub fn motion_event_abs(self: &Rc<Self>, time_usec: u64, x: Fixed, y: Fixed) {
|
||||
pub fn motion_event_abs(
|
||||
self: &Rc<Self>,
|
||||
time_usec: u64,
|
||||
x: Fixed,
|
||||
y: Fixed,
|
||||
cursor_position_type: CursorPositionType,
|
||||
) {
|
||||
self.for_each_ei_seat(|ei_seat| {
|
||||
ei_seat.handle_motion_abs(time_usec, x, y);
|
||||
});
|
||||
|
|
@ -611,7 +619,7 @@ impl WlSeatGlobal {
|
|||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_pointer_abs(self.id, time_usec, x, y);
|
||||
});
|
||||
self.cursor_moved(time_usec);
|
||||
self.apply_cursor_position(time_usec, cursor_position_type);
|
||||
}
|
||||
|
||||
pub fn motion_event(
|
||||
|
|
@ -666,7 +674,7 @@ impl WlSeatGlobal {
|
|||
);
|
||||
});
|
||||
self.set_pointer_cursor_position(x, y);
|
||||
self.cursor_moved(time_usec);
|
||||
self.apply_cursor_position(time_usec, Motion);
|
||||
}
|
||||
|
||||
pub fn motion_absolute_event(
|
||||
|
|
@ -678,7 +686,7 @@ impl WlSeatGlobal {
|
|||
) {
|
||||
let x = Fixed::from_f32(rect.x1() as f32 + x_normed * rect.width() as f32);
|
||||
let y = Fixed::from_f32(rect.y1() as f32 + y_normed * rect.height() as f32);
|
||||
self.motion_event_abs(time_usec, x, y);
|
||||
self.motion_event_abs(time_usec, x, y, Motion);
|
||||
}
|
||||
|
||||
pub fn button_event(self: &Rc<Self>, time_usec: u64, button: u32, state: ButtonState) {
|
||||
|
|
@ -1283,9 +1291,15 @@ impl WlSeatGlobal {
|
|||
});
|
||||
}
|
||||
|
||||
fn cursor_moved(self: &Rc<Self>, time_usec: u64) {
|
||||
fn apply_cursor_position(
|
||||
self: &Rc<Self>,
|
||||
time_usec: u64,
|
||||
cursor_position_type: CursorPositionType,
|
||||
) {
|
||||
self.pos_time_usec.set(time_usec);
|
||||
self.changes.or_assign(CHANGE_CURSOR_MOVED);
|
||||
if cursor_position_type == Motion {
|
||||
self.changes.or_assign(CHANGE_CURSOR_MOVED);
|
||||
}
|
||||
self.apply_changes();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue