[egg-list-box] egg-list-box: translate motion-notify events for child windows



commit 706210c4e16f94d1cf20dd230894cc8051492dad
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Jan 5 13:16:06 2013 +0100

    egg-list-box: translate motion-notify events for child windows
    
    When a motion event is received relative to a child window, translate
    the y coordinate of the event relative to our own window, since that's what
    we need to fetch the correct child.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691181

 egg-list-box.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/egg-list-box.c b/egg-list-box.c
index d0da627..6dac55d 100644
--- a/egg-list-box.c
+++ b/egg-list-box.c
@@ -799,9 +799,22 @@ egg_list_box_real_motion_notify_event (GtkWidget *widget,
 {
   EggListBox *list_box = EGG_LIST_BOX (widget);
   EggListBoxChildInfo *child;
+  GdkWindow *window, *event_window;
+  gint relative_y;
+  gdouble parent_y;
 
+  window = gtk_widget_get_window (GTK_WIDGET (list_box));
+  event_window = event->window;
+  relative_y = event->y;
 
-  child = egg_list_box_find_child_at_y (list_box, event->y);
+  while ((event_window != NULL) && (event_window != window))
+    {
+      gdk_window_coords_to_parent (event_window, 0, relative_y, NULL, &parent_y);
+      relative_y = parent_y;
+      event_window = gdk_window_get_effective_parent (event_window);
+    }
+
+  child = egg_list_box_find_child_at_y (list_box, relative_y);
   egg_list_box_update_prelight (list_box, child);
   egg_list_box_update_active (list_box, child);
 



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