[gtk/wip/carlosg/public-legacy-controller: 2/8] testsuite: Fix gestures test



commit bb0e964f56e09eb50daff056b47c855fb252e37b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Oct 12 17:35:44 2018 +0200

    testsuite: Fix gestures test
    
    Was broken by the removal of the default GtkEventControllerLegacy.

 testsuite/gtk/gestures.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/testsuite/gtk/gestures.c b/testsuite/gtk/gestures.c
index 42aac2d65f..2115608983 100644
--- a/testsuite/gtk/gestures.c
+++ b/testsuite/gtk/gestures.c
@@ -198,16 +198,20 @@ state_nick (GtkEventSequenceState state)
 }
 
 typedef struct {
+  GtkEventController *controller;
   GString *str;
   gboolean exit;
 } LegacyData;
 
 static gboolean
-legacy_cb (GtkWidget *w, GdkEvent *button, gpointer data)
+legacy_cb (GtkEventControllerLegacy *c, GdkEvent *button, gpointer data)
 {
   if (gdk_event_get_event_type (button) == GDK_BUTTON_PRESS)
     {
       LegacyData *ld = data;
+      GtkWidget *w;
+
+      w = gtk_event_controller_get_widget (ld->controller);
 
       if (ld->str->len > 0)
         g_string_append (ld->str, ", ");
@@ -377,9 +381,12 @@ add_legacy (GtkWidget *w, GString *str, gboolean exit)
   LegacyData *data;
 
   data = g_new (LegacyData, 1);
+  data->controller = gtk_event_controller_legacy_new ();
   data->str = str;
   data->exit = exit;
-  g_signal_connect (w, "event", G_CALLBACK (legacy_cb), data);
+
+  gtk_widget_add_controller (w, data->controller);
+  g_signal_connect (data->controller, "event", G_CALLBACK (legacy_cb), data);
 }
 
 static void


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