aboutsummaryrefslogtreecommitdiff
path: root/src/handlers
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-11-03 09:16:06 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-11-03 10:15:19 +0300
commitf5d91c5ecc8d2f8ee0e7dd03889844f46e480026 (patch)
treebb4788d69fdd025451f20a21bbbcf0b78b8459bc /src/handlers
parent69e3edb5a3a97cc77eaf4df77590166c463e4373 (diff)
downloadniri-f5d91c5ecc8d2f8ee0e7dd03889844f46e480026.tar.gz
niri-f5d91c5ecc8d2f8ee0e7dd03889844f46e480026.tar.bz2
niri-f5d91c5ecc8d2f8ee0e7dd03889844f46e480026.zip
Rename pointer_focus to pointer_contents, clarify comments
This is not pointer focus and it shouldn't be pointer focus, let's be clear about it.
Diffstat (limited to 'src/handlers')
-rw-r--r--src/handlers/mod.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index ed9f224c..a60de97f 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -140,7 +140,7 @@ impl PointerConstraintsHandler for State {
fn new_constraint(&mut self, _surface: &WlSurface, pointer: &PointerHandle<Self>) {
self.niri.maybe_activate_pointer_constraint(
pointer.current_location(),
- &self.niri.pointer_focus,
+ &self.niri.pointer_contents,
);
}
@@ -158,19 +158,20 @@ impl PointerConstraintsHandler for State {
return;
}
- // Logically the following two checks should always succeed (so, they should print
- // error!()s if they fail). However, currently both can fail because niri's pointer focus
- // doesn't take pointer grabs into account. So if you start, say, a middle-drag in Blender,
- // then touchpad-swipe the window away, the niri pointer focus will change, even though the
- // real pointer focus remains on the Blender surface due to the click grab.
+ // Note: this is surface under pointer, not pointer focus. So if you start, say, a
+ // middle-drag in Blender, then touchpad-swipe the window away, the surface under pointer
+ // will change, even though the real pointer focus remains on the Blender surface due to
+ // the click grab.
//
- // FIXME: add error!()s when niri pointer focus takes grabs into account. Alternatively,
- // recompute the surface origin here (but that is a bit clunky).
- let Some((ref focused_surface, origin)) = self.niri.pointer_focus.surface else {
+ // Ideally we would just use the constraint surface, but we need its origin. So this is
+ // more of a hack because pointer contents has the surface origin available.
+ //
+ // FIXME: use the constraint surface somehow, don't use pointer contents.
+ let Some((ref surface_under_pointer, origin)) = self.niri.pointer_contents.surface else {
return;
};
- if focused_surface != surface {
+ if surface_under_pointer != surface {
return;
}