[gtk/wip/carlosg/public-legacy-controller: 7/8] tests: Drop ::event handler in testgtk



commit dd6aa7b870ad448b1d427f7c17be78bd91e154a3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Oct 15 17:30:15 2018 +0200

    tests: Drop ::event handler in testgtk
    
    We can use ::size-allocate for it, as window positions in root coordinates
    are neither supported nor crucial here.

 tests/testgtk.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 4bcf775b55..503f165a27 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -5695,27 +5695,26 @@ create_surface_states (GtkWidget *widget)
  * Window sizing
  */
 
-static gint
-configure_event_callback (GtkWidget *widget,
-                          GdkEvent *event,
-                          gpointer data)
+static void
+size_allocate_callback (GtkWidget     *widget,
+                       GtkAllocation *allocation,
+                       int            baseline,
+                       gpointer       data)
 {
   GtkWidget *label = data;
   gchar *msg;
   gint x, y;
-  
+
   gtk_window_get_position (GTK_WINDOW (widget), &x, &y);
-  
-  msg = g_strdup_printf ("event: %d,%d  %d x %d\n"
+
+  msg = g_strdup_printf ("size: %d x %d\n"
                          "position: %d, %d",
-                         0, 0, 0, 0, // FIXME
+                         allocation->width, allocation->height,
                          x, y);
-  
+
   gtk_label_set_text (GTK_LABEL (label), msg);
 
   g_free (msg);
-
-  return FALSE;
 }
 
 static void
@@ -5867,10 +5866,10 @@ window_controls (GtkWidget *window)
 
   gtk_container_add (GTK_CONTAINER (control_window), vbox);
 
-  label = gtk_label_new ("<no configure events>");
+  label = gtk_label_new ("<no size>");
   gtk_box_pack_start (GTK_BOX (vbox), label);
 
-  g_signal_connect (window, "event", G_CALLBACK (configure_event_callback), label);
+  g_signal_connect_after (window, "size-allocate", G_CALLBACK (size_allocate_callback), label);
 
   adjustment = gtk_adjustment_new (10.0, -2000.0, 2000.0, 1.0, 5.0, 0.0);
   spin = gtk_spin_button_new (adjustment, 0, 0);


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