From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau@redhat.com>
Date: Mon, 17 Sep 2018 18:41:05 +0200
Subject: [spice-gtk] display: Trigger wheel scrolling after one 'click'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@gmail.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;
