[gtk+/wip/carlosg/private-event-structs] place sidebar: Use GdkEvent API



commit 00a83be564cd4a62692228109e6b92e23a9c8761
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 26 10:57:37 2017 -0400

    place sidebar: Use GdkEvent API

 gtk/gtkplacessidebar.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 7c5557b..d15d616 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -1533,6 +1533,7 @@ on_motion_notify_event (GtkWidget      *widget,
 {
   GtkPlacesSidebar *sidebar = GTK_PLACES_SIDEBAR (user_data);
   guint state;
+  double x_root, y_root;
 
   if (sidebar->drag_row == NULL || sidebar->dragging_over)
     return FALSE;
@@ -1541,9 +1542,11 @@ on_motion_notify_event (GtkWidget      *widget,
       !(state & GDK_BUTTON1_MASK))
     return FALSE;
 
+  gdk_event_get_root_coords ((GdkEvent *) event, &x_root, &y_root);
+
   if (gtk_drag_check_threshold (widget,
                                 sidebar->drag_root_x, sidebar->drag_root_y,
-                                event->x_root, event->y_root))
+                                x_root, y_root))
     {
       sidebar->dragging_over = TRUE;
 
@@ -3480,6 +3483,7 @@ on_button_press_event (GtkWidget      *widget,
   GtkPlacesSidebar *sidebar;
   GtkPlacesSidebarSectionType section_type;
   gdouble x, y;
+  double x_root, y_root;
 
   g_object_get (GTK_SIDEBAR_ROW (row),
                 "sidebar", &sidebar,
@@ -3489,12 +3493,13 @@ on_button_press_event (GtkWidget      *widget,
   if (section_type == SECTION_BOOKMARKS)
     {
       gdk_event_get_coords ((GdkEvent *) event, &x, &y);
+      gdk_event_get_root_coords ((GdkEvent *) event, &x_root, &y_root);
       sidebar->drag_row = GTK_WIDGET (row);
       sidebar->drag_row_x = (gint)x;
       sidebar->drag_row_y = (gint)y;
 
-      sidebar->drag_root_x = event->x_root;
-      sidebar->drag_root_y = event->y_root;
+      sidebar->drag_root_x = x_root;
+      sidebar->drag_root_y = y_root;
     }
 
   g_object_unref (sidebar);


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