[gtk] Revert "inspector: Make picking work again"



commit edc4f954c65e0ff8460485b20f13a5fc2adbb67b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Feb 23 23:15:43 2019 -0500

    Revert "inspector: Make picking work again"
    
    This reverts commit 5dbfb18d115862b894ee0a8db3083b2c6863192b.
    
    Inspector picking no longer requries this.

 gtk/gtkwidget.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index f3dbb7316a..80022c2f87 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5133,7 +5133,7 @@ gtk_widget_run_controllers (GtkWidget           *widget,
   return handled;
 }
 
-static void
+static gboolean
 translate_event_coordinates (GdkEvent  *event,
                              GtkWidget *widget);
 gboolean
@@ -5151,7 +5151,11 @@ _gtk_widget_captured_event (GtkWidget      *widget,
     return TRUE;
 
   event_copy = gdk_event_copy (event);
-  translate_event_coordinates (event_copy, widget);
+  if (!translate_event_coordinates (event_copy, widget))
+    {
+      g_object_unref (event_copy);
+      return FALSE;
+    }
 
   return_val = gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_CAPTURE);
 
@@ -5209,7 +5213,7 @@ event_surface_is_still_viewable (const GdkEvent *event)
     }
 }
 
-static void
+static gboolean
 translate_event_coordinates (GdkEvent  *event,
                              GtkWidget *widget)
 {
@@ -5218,7 +5222,7 @@ translate_event_coordinates (GdkEvent  *event,
   graphene_point_t p;
 
   if (!gdk_event_get_coords (event, &x, &y))
-    return;
+    return TRUE;
 
   event_widget = gtk_get_event_widget (event);
 
@@ -5226,11 +5230,11 @@ translate_event_coordinates (GdkEvent  *event,
                                  widget,
                                  &GRAPHENE_POINT_INIT (x, y),
                                  &p))
-    {
-      p.x = p.y = 0;
-    }
+    return FALSE;
 
   gdk_event_set_coords (event, p.x, p.y);
+
+  return TRUE;
 }
 
 static gboolean
@@ -5253,7 +5257,11 @@ gtk_widget_event_internal (GtkWidget      *widget,
 
   event_copy = gdk_event_copy (event);
 
-  translate_event_coordinates (event_copy, widget);
+  if (!translate_event_coordinates (event_copy, widget))
+    {
+      g_object_unref (event_copy);
+      return FALSE;
+    }
 
   if (widget == gtk_get_event_target (event_copy))
     return_val |= gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_TARGET);


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