mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Remove pointer_grab_ongoing in favor of checking the actual grab
This commit is contained in:
@@ -148,7 +148,6 @@ impl XdgShellHandler for State {
|
|||||||
PointerOrTouchStartData::Pointer(start_data) => {
|
PointerOrTouchStartData::Pointer(start_data) => {
|
||||||
let grab = MoveGrab::new(start_data, window);
|
let grab = MoveGrab::new(start_data, window);
|
||||||
pointer.set_grab(self, grab, serial, Focus::Clear);
|
pointer.set_grab(self, grab, serial, Focus::Clear);
|
||||||
self.niri.pointer_grab_ongoing = true;
|
|
||||||
}
|
}
|
||||||
PointerOrTouchStartData::Touch(start_data) => {
|
PointerOrTouchStartData::Touch(start_data) => {
|
||||||
let touch = self.niri.seat.get_touch().unwrap();
|
let touch = self.niri.seat.get_touch().unwrap();
|
||||||
@@ -246,7 +245,6 @@ impl XdgShellHandler for State {
|
|||||||
PointerOrTouchStartData::Pointer(start_data) => {
|
PointerOrTouchStartData::Pointer(start_data) => {
|
||||||
let grab = ResizeGrab::new(start_data, window);
|
let grab = ResizeGrab::new(start_data, window);
|
||||||
pointer.set_grab(self, grab, serial, Focus::Clear);
|
pointer.set_grab(self, grab, serial, Focus::Clear);
|
||||||
self.niri.pointer_grab_ongoing = true;
|
|
||||||
}
|
}
|
||||||
PointerOrTouchStartData::Touch(start_data) => {
|
PointerOrTouchStartData::Touch(start_data) => {
|
||||||
let touch = self.niri.seat.get_touch().unwrap();
|
let touch = self.niri.seat.get_touch().unwrap();
|
||||||
|
|||||||
+5
-3
@@ -1320,8 +1320,13 @@ impl State {
|
|||||||
self.niri.tablet_cursor_location = None;
|
self.niri.tablet_cursor_location = None;
|
||||||
|
|
||||||
// Check if we have an active pointer constraint.
|
// Check if we have an active pointer constraint.
|
||||||
|
//
|
||||||
|
// FIXME: ideally this should use the pointer focus with up-to-date global location.
|
||||||
let mut pointer_confined = None;
|
let mut pointer_confined = None;
|
||||||
if let Some(under) = &self.niri.pointer_contents.surface {
|
if let Some(under) = &self.niri.pointer_contents.surface {
|
||||||
|
// No need to check if the pointer focus surface matches, because here we're checking
|
||||||
|
// for an already-active constraint, and the constraint is deactivated when the focused
|
||||||
|
// surface changes.
|
||||||
let pos_within_surface = pos - under.1;
|
let pos_within_surface = pos - under.1;
|
||||||
|
|
||||||
let mut pointer_locked = false;
|
let mut pointer_locked = false;
|
||||||
@@ -1583,7 +1588,6 @@ impl State {
|
|||||||
};
|
};
|
||||||
let grab = MoveGrab::new(start_data, window.clone());
|
let grab = MoveGrab::new(start_data, window.clone());
|
||||||
pointer.set_grab(self, grab, serial, Focus::Clear);
|
pointer.set_grab(self, grab, serial, Focus::Clear);
|
||||||
self.niri.pointer_grab_ongoing = true;
|
|
||||||
self.niri
|
self.niri
|
||||||
.cursor_manager
|
.cursor_manager
|
||||||
.set_cursor_image(CursorImageStatus::Named(CursorIcon::Move));
|
.set_cursor_image(CursorImageStatus::Named(CursorIcon::Move));
|
||||||
@@ -1649,7 +1653,6 @@ impl State {
|
|||||||
};
|
};
|
||||||
let grab = ResizeGrab::new(start_data, window.clone());
|
let grab = ResizeGrab::new(start_data, window.clone());
|
||||||
pointer.set_grab(self, grab, serial, Focus::Clear);
|
pointer.set_grab(self, grab, serial, Focus::Clear);
|
||||||
self.niri.pointer_grab_ongoing = true;
|
|
||||||
self.niri.cursor_manager.set_cursor_image(
|
self.niri.cursor_manager.set_cursor_image(
|
||||||
CursorImageStatus::Named(edges.cursor_icon()),
|
CursorImageStatus::Named(edges.cursor_icon()),
|
||||||
);
|
);
|
||||||
@@ -1685,7 +1688,6 @@ impl State {
|
|||||||
};
|
};
|
||||||
let grab = SpatialMovementGrab::new(start_data, output);
|
let grab = SpatialMovementGrab::new(start_data, output);
|
||||||
pointer.set_grab(self, grab, serial, Focus::Clear);
|
pointer.set_grab(self, grab, serial, Focus::Clear);
|
||||||
self.niri.pointer_grab_ongoing = true;
|
|
||||||
self.niri
|
self.niri
|
||||||
.cursor_manager
|
.cursor_manager
|
||||||
.set_cursor_image(CursorImageStatus::Named(CursorIcon::AllScroll));
|
.set_cursor_image(CursorImageStatus::Named(CursorIcon::AllScroll));
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ impl MoveGrab {
|
|||||||
state.niri.layout.interactive_move_end(&self.window);
|
state.niri.layout.interactive_move_end(&self.window);
|
||||||
// FIXME: only redraw the window output.
|
// FIXME: only redraw the window output.
|
||||||
state.niri.queue_redraw_all();
|
state.niri.queue_redraw_all();
|
||||||
state.niri.pointer_grab_ongoing = false;
|
|
||||||
state
|
state
|
||||||
.niri
|
.niri
|
||||||
.cursor_manager
|
.cursor_manager
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ impl ResizeGrab {
|
|||||||
|
|
||||||
fn on_ungrab(&mut self, state: &mut State) {
|
fn on_ungrab(&mut self, state: &mut State) {
|
||||||
state.niri.layout.interactive_resize_end(&self.window);
|
state.niri.layout.interactive_resize_end(&self.window);
|
||||||
state.niri.pointer_grab_ongoing = false;
|
|
||||||
state
|
state
|
||||||
.niri
|
.niri
|
||||||
.cursor_manager
|
.cursor_manager
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ impl SpatialMovementGrab {
|
|||||||
state.niri.queue_redraw(&output);
|
state.niri.queue_redraw(&output);
|
||||||
}
|
}
|
||||||
|
|
||||||
state.niri.pointer_grab_ongoing = false;
|
|
||||||
state
|
state
|
||||||
.niri
|
.niri
|
||||||
.cursor_manager
|
.cursor_manager
|
||||||
|
|||||||
+1
-5
@@ -282,8 +282,6 @@ pub struct Niri {
|
|||||||
/// various tooltips from sticking around.
|
/// various tooltips from sticking around.
|
||||||
pub pointer_hidden: bool,
|
pub pointer_hidden: bool,
|
||||||
pub pointer_inactivity_timer: Option<RegistrationToken>,
|
pub pointer_inactivity_timer: Option<RegistrationToken>,
|
||||||
// FIXME: this should be able to be removed once PointerFocus takes grabs into account.
|
|
||||||
pub pointer_grab_ongoing: bool,
|
|
||||||
pub tablet_cursor_location: Option<Point<f64, Logical>>,
|
pub tablet_cursor_location: Option<Point<f64, Logical>>,
|
||||||
pub gesture_swipe_3f_cumulative: Option<(f64, f64)>,
|
pub gesture_swipe_3f_cumulative: Option<(f64, f64)>,
|
||||||
pub vertical_wheel_tracker: ScrollTracker,
|
pub vertical_wheel_tracker: ScrollTracker,
|
||||||
@@ -1877,7 +1875,6 @@ impl Niri {
|
|||||||
pointer_contents: PointContents::default(),
|
pointer_contents: PointContents::default(),
|
||||||
pointer_hidden: false,
|
pointer_hidden: false,
|
||||||
pointer_inactivity_timer: None,
|
pointer_inactivity_timer: None,
|
||||||
pointer_grab_ongoing: false,
|
|
||||||
tablet_cursor_location: None,
|
tablet_cursor_location: None,
|
||||||
gesture_swipe_3f_cumulative: None,
|
gesture_swipe_3f_cumulative: None,
|
||||||
vertical_wheel_tracker: ScrollTracker::new(120),
|
vertical_wheel_tracker: ScrollTracker::new(120),
|
||||||
@@ -4526,8 +4523,7 @@ impl Niri {
|
|||||||
let Some((surface, surface_loc)) = &self.pointer_contents.surface else {
|
let Some((surface, surface_loc)) = &self.pointer_contents.surface else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
if Some(surface) != pointer.current_focus().as_ref() {
|
||||||
if self.pointer_grab_ongoing {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user