[gtk/wip/carlosg/public-legacy-controller: 4/8] tests: Remove ::event handler in testwindowsize
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/carlosg/public-legacy-controller: 4/8] tests: Remove ::event handler in testwindowsize
- Date: Mon, 15 Oct 2018 15:40:58 +0000 (UTC)
commit 65fbd0af4ee0e301c11a3bef6766b44ee5fa2d86
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Oct 12 19:45:30 2018 +0200
tests: Remove ::event handler in testwindowsize
We just want widget size here, not windowing configuration events.
tests/testwindowsize.c | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/tests/testwindowsize.c b/tests/testwindowsize.c
index 6e62dd0a60..e938072c33 100644
--- a/tests/testwindowsize.c
+++ b/tests/testwindowsize.c
@@ -8,21 +8,14 @@ static GtkWidget *default_width_spin;
static GtkWidget *default_height_spin;
static GtkWidget *resizable_check;
-static gboolean
-configure_event_cb (GtkWidget *window, GdkEvent *event, GtkLabel *label)
+static void
+size_changed_cb (GdkSurface *surface, int width, int height, GtkLabel *label)
{
- if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
- {
- gchar *str;
- gint width, height;
-
- gtk_window_get_size (GTK_WINDOW (window), &width, &height);
- str = g_strdup_printf ("%d x %d", width, height);
- gtk_label_set_label (label, str);
- g_free (str);
- }
-
- return GDK_EVENT_PROPAGATE;
+ gchar *str;
+
+ str = g_strdup_printf ("%d x %d", width, height);
+ gtk_label_set_label (label, str);
+ g_free (str);
}
static void
@@ -71,8 +64,9 @@ show_dialog (void)
//gtk_widget_show (label);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), label, GTK_RESPONSE_HELP);
- g_signal_connect (dialog, "event",
- G_CALLBACK (configure_event_cb), label);
+ gtk_widget_realize (dialog);
+ g_signal_connect (gtk_widget_get_surface (dialog), "size-changed",
+ G_CALLBACK (size_changed_cb), label);
gtk_dialog_run (GTK_DIALOG (dialog));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]