[gtk/main-cleanup: 4/7] testsuite: Stop using gtk_main_do_event



commit ebc24d75af84ecc17bb1d93656e5467492bedad2
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Feb 9 10:54:26 2020 -0500

    testsuite: Stop using gtk_main_do_event
    
    Instead, emit ::event on the surface. Neither of
    these is a proper test api, but one works as well
    as the other.

 testsuite/gtk/gestures.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/testsuite/gtk/gestures.c b/testsuite/gtk/gestures.c
index 8fcf6eb560..deb4f3b21c 100644
--- a/testsuite/gtk/gestures.c
+++ b/testsuite/gtk/gestures.c
@@ -18,6 +18,14 @@ static PointState touch_state[10]; /* touchpoint 0 gets pointer emulation,
 
 #define EVENT_SEQUENCE(point) (GdkEventSequence*) ((point) - touch_state + 1)
 
+static void
+inject_event (GdkEvent *event)
+{
+  gboolean handled;
+
+  g_signal_emit_by_name (event->any.surface, "event", event, &handled);
+}
+
 static void
 point_press (PointState *point,
              GtkWidget  *widget,
@@ -61,7 +69,7 @@ point_press (PointState *point,
 
   gdk_event_set_device (ev, device);
 
-  gtk_main_do_event (ev);
+  inject_event (ev);
 
   g_object_unref (ev);
 
@@ -116,7 +124,7 @@ point_update (PointState *point,
 
   gdk_event_set_device (ev, device);
 
-  gtk_main_do_event (ev);
+  inject_event (ev);
 
   g_object_unref (ev);
 }
@@ -172,7 +180,7 @@ point_release (PointState *point,
 
   gdk_event_set_device (ev, device);
 
-  gtk_main_do_event (ev);
+  inject_event (ev);
 
   g_object_unref (ev);
 }


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