diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2020-12-02 17:08:07 +0100 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2020-12-07 20:37:29 +0100 |
commit | b7380543449ea679a2c912b66aab4855b2bb41f2 (patch) | |
tree | 5aa96e739cd4957dfe06af889f3c4103a349e3c9 /tests | |
parent | b8fa892b70363ae0cb890fc607aa1784dc0b2a30 (diff) | |
download | gtk+-b7380543449ea679a2c912b66aab4855b2bb41f2.tar.gz |
gdk: Remove GdkSurface::size-changed
It's not emitted, and everyone should use the GdkSurface::layout signal
from now on.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testwindowsize.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/tests/testwindowsize.c b/tests/testwindowsize.c index e6539c7ae0..f61669b204 100644 --- a/tests/testwindowsize.c +++ b/tests/testwindowsize.c @@ -8,14 +8,27 @@ static GtkWidget *default_width_spin; static GtkWidget *default_height_spin; static GtkWidget *resizable_check; -static void -size_changed_cb (GdkSurface *surface, int width, int height, GtkLabel *label) +static gboolean +set_label_idle (gpointer user_data) { + GtkLabel *label = user_data; + GtkNative *native = gtk_widget_get_native (GTK_WIDGET (label)); + GdkSurface *surface = gtk_native_get_surface (native); char *str; - str = g_strdup_printf ("%d x %d", width, height); + str = g_strdup_printf ("%d x %d", + gdk_surface_get_width (surface), + gdk_surface_get_height (surface)); gtk_label_set_label (label, str); g_free (str); + + return G_SOURCE_REMOVE; +} + +static void +layout_cb (GdkSurface *surface, int width, int height, GtkLabel *label) +{ + g_idle_add (set_label_idle, label); } static void @@ -63,8 +76,8 @@ show_dialog (void) gtk_dialog_add_action_widget (GTK_DIALOG (dialog), label, GTK_RESPONSE_HELP); gtk_widget_realize (dialog); - g_signal_connect (gtk_native_get_surface (GTK_NATIVE (dialog)), "size-changed", - G_CALLBACK (size_changed_cb), label); + g_signal_connect (gtk_native_get_surface (GTK_NATIVE (dialog)), "layout", + G_CALLBACK (layout_cb), label); g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL); |