diff options
author | Bastien Nocera <hadess@hadess.net> | 2014-04-22 17:07:28 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2014-04-22 17:11:00 +0200 |
commit | 15c9ead2671173c37906b61910a5941ef65bdace (patch) | |
tree | 47bcf3a6a18d0486931351b37bace94c1833fd01 | |
parent | 5c0e927d58c7ab3d7cb27a07175c46e39a2c19ad (diff) | |
download | totem-15c9ead2671173c37906b61910a5941ef65bdace.tar.gz |
backend: Avoid double-scroll events
We were receiving both the smooth scroll and the non-smooth scrolling.
As all the backends we support have support for smooth scrolling,
only ever handle those.
https://bugzilla.gnome.org/show_bug.cgi?id=728227
-rw-r--r-- | src/backend/bacon-video-widget.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c index 4a5fbf930..7f10d6909 100644 --- a/src/backend/bacon-video-widget.c +++ b/src/backend/bacon-video-widget.c @@ -934,34 +934,24 @@ bacon_video_widget_handle_scroll (GtkWidget *widget, BaconVideoWidget *bvw) { int x, y; - GdkScrollDirection direction; gboolean forward; + gdouble delta_y; g_return_val_if_fail (bvw->priv->play != NULL, FALSE); + if (event->direction != GDK_SCROLL_SMOOTH) + return GDK_EVENT_PROPAGATE; + if (widget == (gpointer) bvw) { translate_coords (widget, event->window, event->x, event->y, &x, &y); if (ignore_event (bvw, x, y)) return GDK_EVENT_STOP; } - direction = event->direction; - if (direction == GDK_SCROLL_SMOOTH) { - gdouble y; - gdk_event_get_scroll_deltas ((GdkEvent *) event, NULL, &y); - direction = y >= 0.0 ? GDK_SCROLL_DOWN : GDK_SCROLL_UP; - } - - switch (direction) { - case GDK_SCROLL_UP: - forward = TRUE; - break; - case GDK_SCROLL_DOWN: - forward = FALSE; - break; - default: + gdk_event_get_scroll_deltas ((GdkEvent *) event, NULL, &delta_y); + if (delta_y == 0.0) return GDK_EVENT_PROPAGATE; - } + forward = delta_y >= 0.0 ? FALSE : TRUE; if (widget == (gpointer) bvw || widget == g_object_get_data (G_OBJECT (bvw->priv->controls), "seek_scale")) { |