[totem] backend: Avoid double-scroll events



commit 15c9ead2671173c37906b61910a5941ef65bdace
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Apr 22 17:07:28 2014 +0200

    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

 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 4a5fbf9..7f10d69 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")) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]