aboutsummaryrefslogtreecommitdiff
path: root/src/input.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-02-03 09:00:08 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-02-03 09:00:08 +0400
commitb23dd4b800285f120ad556d77c2357b17c1ea6a2 (patch)
treec565059c0b58f731025f251ed8910bd622f70708 /src/input.rs
parent1f72089a46a965fa98c833de3c76da2fb8b6a5f7 (diff)
downloadniri-b23dd4b800285f120ad556d77c2357b17c1ea6a2.tar.gz
niri-b23dd4b800285f120ad556d77c2357b17c1ea6a2.tar.bz2
niri-b23dd4b800285f120ad556d77c2357b17c1ea6a2.zip
Respect natural-scroll for workspace switch gesture
Diffstat (limited to 'src/input.rs')
-rw-r--r--src/input.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/input.rs b/src/input.rs
index a357eac1..f06f6142 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -1156,11 +1156,20 @@ impl State {
);
}
- fn on_gesture_swipe_update<I: InputBackend>(&mut self, event: I::GestureSwipeUpdateEvent) {
- let res = self
- .niri
- .layout
- .workspace_switch_gesture_update(event.delta_y());
+ fn on_gesture_swipe_update<I: InputBackend>(&mut self, event: I::GestureSwipeUpdateEvent)
+ where
+ I::Device: 'static,
+ {
+ let mut delta_y = event.delta_y();
+
+ let device = event.device();
+ if let Some(device) = (&device as &dyn Any).downcast_ref::<input::Device>() {
+ if device.config_scroll_natural_scroll_enabled() {
+ delta_y = -delta_y;
+ }
+ }
+
+ let res = self.niri.layout.workspace_switch_gesture_update(delta_y);
if let Some(output) = res {
if let Some(output) = output {
self.niri.queue_redraw(output);