2009-02-13 Alejandro G. Castro <alex@igalia.com>
authorAlejandro G. Castro <alex@igalia.com>
Fri, 13 Feb 2009 16:33:39 +0000 (16:33 +0000)
committerAlejandro G. Castro <alex@igalia.com>
Fri, 13 Feb 2009 16:33:39 +0000 (16:33 +0000)
This patch was applied before but reverted because it caused
problems, we have changed the main condition and tested the
regressions we detected before and they work ok.

        * src/hildon-pannable-area.c,
        (hildon_pannable_area_get_topmost): Added a new parameter to
        filter the the windows that do not include those events. Added
        also a condition when finding the window to filter windows that do
        not ask for those events.
        (hildon_pannable_area_button_press_cb),
        (hildon_pannable_area_button_release_cb),
        (hildon_pannable_get_child_widget_at): Reviewed the call the the
        topmost function, we have added the new parameter.

        Fixes: NB#97458 (Pannable area prevents propagation of button
        press events)

ChangeLog
src/hildon-pannable-area.c

index 0d7ea08..0131ea4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2009-02-13  Alejandro G. Castro  <alex@igalia.com>
+
+       This patch was applied before but reverted because it caused
+       problems, we have changed the main condition and tested the
+       regressions we detected before and they work ok.
+
+        * src/hildon-pannable-area.c,
+        (hildon_pannable_area_get_topmost): Added a new parameter to
+        filter the the windows that do not include those events. Added
+        also a condition when finding the window to filter windows that do
+        not ask for those events.
+        (hildon_pannable_area_button_press_cb),
+        (hildon_pannable_area_button_release_cb),
+        (hildon_pannable_get_child_widget_at): Reviewed the call the the
+        topmost function, we have added the new parameter.
+
+        Fixes: NB#97458 (Pannable area prevents propagation of button
+        press events)
+
 2009-02-13  Claudio Saavedra  <csaavedra@igalia.com>
 
        * tests/check-hildon-color-button.c (START_TEST): do not leak
index 9296885..eea1ceb 100644 (file)
@@ -201,7 +201,8 @@ static gboolean hildon_pannable_area_expose_event (GtkWidget * widget,
                                                    GdkEventExpose * event);
 static GdkWindow * hildon_pannable_area_get_topmost (GdkWindow * window,
                                                      gint x, gint y,
-                                                     gint * tx, gint * ty);
+                                                     gint * tx, gint * ty,
+                                                     GdkEventMask mask);
 static void synth_crossing (GdkWindow * child,
                             gint x, gint y,
                             gint x_root, gint y_root,
@@ -1440,7 +1441,8 @@ hildon_pannable_area_expose_event (GtkWidget * widget,
 static GdkWindow *
 hildon_pannable_area_get_topmost (GdkWindow * window,
                                   gint x, gint y,
-                                  gint * tx, gint * ty)
+                                  gint * tx, gint * ty,
+                                  GdkEventMask mask)
 {
   /* Find the GdkWindow at the given point, by recursing from a given
    * parent GdkWindow. Optionally return the co-ordinates transformed
@@ -1464,11 +1466,19 @@ hildon_pannable_area_get_topmost (GdkWindow * window,
       gdk_drawable_get_size (GDK_DRAWABLE (child), &width, &height);
       gdk_window_get_position (child, &wx, &wy);
 
-      if (((x >= wx) && (x < (wx + width)) && (y >= wy)
-           && (y < (wy + height))) && (gdk_window_is_visible (child))) {
-       child_x = x - wx;
-       child_y = y - wy;
-       window = child;
+      if ((x >= wx) && (x < (wx + width)) && (y >= wy) && (y < (wy + height))) {
+        gpointer widget;
+
+        gdk_window_get_user_data (child, &widget);
+
+        if ((gdk_window_is_visible (child)) &&
+            (gdk_window_peek_children (child) ||
+             (gdk_window_get_events (child)&mask))) {
+          child_x = x - wx;
+          child_y = y - wy;
+          window = child;
+          break;
+        }
       }
     }
 
@@ -1557,7 +1567,7 @@ hildon_pannable_area_button_press_cb (GtkWidget * widget,
       (ABS (priv->vel_y) <= (priv->vmax * priv->vfast_factor)))
     priv->child =
       hildon_pannable_area_get_topmost (gtk_bin_get_child (GTK_BIN (widget))->window,
-                                       event->x, event->y, &x, &y);
+                                       event->x, event->y, &x, &y, GDK_BUTTON_PRESS_MASK);
   else
     priv->child = NULL;
 
@@ -2192,7 +2202,7 @@ hildon_pannable_area_button_release_cb (GtkWidget * widget,
 
   child =
     hildon_pannable_area_get_topmost (gtk_bin_get_child (GTK_BIN (widget))->window,
-                                     event->x, event->y, &x, &y);
+                                     event->x, event->y, &x, &y, GDK_BUTTON_RELEASE_MASK);
 
   event = (GdkEventButton *) gdk_event_copy ((GdkEvent *) event);
   event->x = x;
@@ -2752,7 +2762,7 @@ hildon_pannable_get_child_widget_at (HildonPannableArea *area,
 
   window = hildon_pannable_area_get_topmost
     (gtk_bin_get_child (GTK_BIN (area))->window,
-     x, y, NULL, NULL);
+     x, y, NULL, NULL, GDK_ALL_EVENTS_MASK);
 
   gdk_window_get_user_data (window, (gpointer) &child_widget);