[gtk+/wip/carlosg/event-delivery] listbox: Fix row hovering



commit 692d569d83a4b328b9093d50d515ca70d03cd676
Author: Timm Bäder <mail baedert org>
Date:   Tue May 9 16:23:01 2017 +0200

    listbox: Fix row hovering
    
    Drop the in_widget flag since motion events the listbox receives are
    always inside the listbox. Also drop the manual coordinate translation
    code using GdkWindows.

 gtk/gtklistbox.c |   32 +++++---------------------------
 1 files changed, 5 insertions(+), 27 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 832ac5a..be9fb77 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -115,7 +115,6 @@ typedef struct
   GtkListBoxRow *drag_highlighted_row;
 
   int n_visible_rows;
-  gboolean in_widget;
 
   GListModel *bound_model;
   GtkListBoxCreateWidgetFunc create_widget_func;
@@ -1828,11 +1827,6 @@ gtk_list_box_enter_notify_event (GtkWidget        *widget,
   GtkListBox *box = GTK_LIST_BOX (widget);
   GtkListBoxRow *row;
 
-  if (event->window != BOX_PRIV (box)->view_window)
-    return FALSE;
-
-  BOX_PRIV (box)->in_widget = TRUE;
-
   row = gtk_list_box_get_row_at_y (box, event->y);
   gtk_list_box_update_prelight (box, row);
   gtk_list_box_update_active (box, row);
@@ -1851,10 +1845,7 @@ gtk_list_box_leave_notify_event (GtkWidget        *widget,
     return FALSE;
 
   if (event->detail != GDK_NOTIFY_INFERIOR)
-    {
-      BOX_PRIV (box)->in_widget = FALSE;
-      row = NULL;
-    }
+    row = NULL;
   else
     row = gtk_list_box_get_row_at_y (box, event->y);
 
@@ -1870,28 +1861,15 @@ gtk_list_box_motion_notify_event (GtkWidget      *widget,
 {
   GtkListBox *box = GTK_LIST_BOX (widget);
   GtkListBoxRow *row;
-  GdkWindow *window, *event_window;
-  gint relative_y;
-  gdouble parent_y;
 
-  if (!BOX_PRIV (box)->in_widget)
-    return FALSE;
-
-  window = BOX_PRIV (box)->view_window;
-  event_window = event->window;
-  relative_y = event->y;
+  row = gtk_list_box_get_row_at_y (box, event->y);
 
-  while ((event_window != NULL) && (event_window != window))
+  if (row)
     {
-      gdk_window_coords_to_parent (event_window, 0, relative_y, NULL, &parent_y);
-      relative_y = parent_y;
-      event_window = gdk_window_get_parent (event_window);
+      gtk_list_box_update_prelight (box, row);
+      gtk_list_box_update_active (box, row);
     }
 
-  row = gtk_list_box_get_row_at_y (box, relative_y);
-  gtk_list_box_update_prelight (box, row);
-  gtk_list_box_update_active (box, row);
-
   return FALSE;
 }
 


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