From 396f7d45255d981c686715b49855029482facea2 Mon Sep 17 00:00:00 2001 From: Patrick Hilhorst Date: Tue, 11 Jun 2019 18:44:54 +0200 Subject: [PATCH] Workspaces: implement horizontal continuous scrolling --- src/modules/sway/workspaces.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/sway/workspaces.cpp b/src/modules/sway/workspaces.cpp index 3da550e8..fd24555e 100644 --- a/src/modules/sway/workspaces.cpp +++ b/src/modules/sway/workspaces.cpp @@ -246,7 +246,12 @@ bool Workspaces::handleScroll(GdkEventScroll *e) { case GDK_SCROLL_SMOOTH: { gdouble delta_x, delta_y; gdk_event_get_scroll_deltas(reinterpret_cast(e), &delta_x, &delta_y); - distance_scrolled_ += delta_y; + + if (abs(delta_x) > abs(delta_y)) { + distance_scrolled_ += delta_x; + } else { + distance_scrolled_ += delta_y; + } gdouble threshold = 0; if (config_["smooth-scrolling-threshold"].isNumeric()) { threshold = config_["smooth-scrolling-threshold"].asDouble();