summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2016-04-18 14:10:49 +0100
committerMatthias Clasen <mclasen@redhat.com>2016-04-19 10:39:20 -0400
commit9187677a781e6776cc35065366fad416b282e7de (patch)
tree1fb31a9dfe55cc5dade14057f576d92ee012886c
parentb6402da864a5160e7bb80d07cbad09e0f7e03407 (diff)
downloadgtk+-9187677a781e6776cc35065366fad416b282e7de.tar.gz
wayland: Improve checks when flushing scroll events
If we get gdk_wayland_seat_flush_frame_event() with no previous event to be flushed, we fallback into the scroll event checks. However, there's no check performed there as to whether it really scrolled, so it'd always send a smooth scroll event with 0/0 deltas in this case. This should be mostly harmless, but still, we should only end up emitting scroll events if those really happened.
-rw-r--r--gdk/wayland/gdkdevice-wayland.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index d02f5804d7..296dd3c87a 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1054,26 +1054,31 @@ flush_scroll_event (GdkWaylandSeat *seat,
direction = GDK_SCROLL_DOWN;
flush_discrete_scroll_event (seat, direction);
+ pointer_frame->discrete_x = 0;
+ pointer_frame->discrete_y = 0;
}
- /* Axes can stop independently, if we stop on one axis but have a
- * delta on the other, we don't count it as a stop event.
- */
- if (pointer_frame->is_scroll_stop &&
- pointer_frame->delta_x == 0 &&
- pointer_frame->delta_y == 0)
- is_stop = TRUE;
-
- flush_smooth_scroll_event (seat,
- pointer_frame->delta_x,
- pointer_frame->delta_y,
- is_stop);
-
- pointer_frame->delta_x = 0;
- pointer_frame->delta_y = 0;
- pointer_frame->discrete_x = 0;
- pointer_frame->discrete_y = 0;
- pointer_frame->is_scroll_stop = FALSE;
+ if (pointer_frame->is_scroll_stop ||
+ pointer_frame->delta_x != 0 ||
+ pointer_frame->delta_y != 0)
+ {
+ /* Axes can stop independently, if we stop on one axis but have a
+ * delta on the other, we don't count it as a stop event.
+ */
+ if (pointer_frame->is_scroll_stop &&
+ pointer_frame->delta_x == 0 &&
+ pointer_frame->delta_y == 0)
+ is_stop = TRUE;
+
+ flush_smooth_scroll_event (seat,
+ pointer_frame->delta_x,
+ pointer_frame->delta_y,
+ is_stop);
+
+ pointer_frame->delta_x = 0;
+ pointer_frame->delta_y = 0;
+ pointer_frame->is_scroll_stop = FALSE;
+ }
}
static void