[Spice-devel] [spice-gtk] display: Trigger wheel scrolling after one 'click'

Christophe Fergeau cfergeau at redhat.com
Mon Sep 17 16:41:05 UTC 2018


The scroll wheel on the mouse will trigger a smooth scroll event with a
delta of +/-1.0. The code added in 2212f05 triggers a scroll when the
delta is strictly greater than 1.0. This means that right after
connecting a client, we won't be triggering a scroll with the first
mouse wheel 'click'.
This commit adjusts the check so that we try to scroll when the delta is
equal or greater than 1.0.

https://bugzilla.redhat.com/show_bug.cgi?id=1627823

Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 src/spice-widget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 853c9df6..312c640a 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -1979,7 +1979,7 @@ static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *scroll)
         break;
     case GDK_SCROLL_SMOOTH:
         d->scroll_delta_y += scroll->delta_y;
-        while (ABS(d->scroll_delta_y) > 1) {
+        while (ABS(d->scroll_delta_y) >= 1) {
             if (d->scroll_delta_y < 0) {
                 press_and_release(display, SPICE_MOUSE_BUTTON_UP, button_state);
                 d->scroll_delta_y += 1;
-- 
2.17.1



More information about the Spice-devel mailing list