tests: Stop using configure events

This commit is contained in:
Matthias Clasen
2018-07-15 08:01:53 -04:00
parent d0e28abbd4
commit edccd76fbb

View File

@@ -9,20 +9,16 @@ static GtkWidget *default_height_spin;
static GtkWidget *resizable_check;
static gboolean
configure_event_cb (GtkWidget *window, GdkEvent *event, GtkLabel *label)
configure_event_cb (GdkSurface *surface, GParamSpec *pspec, GtkLabel *label)
{
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
{
gchar *str;
gint width, height;
int width, height;
char *str;
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;
width = gdk_surface_get_width (surface);
height = gdk_surface_get_height (surface);
str = g_strdup_printf ("%d x %d", width, height);
gtk_label_set_label (label, str);
g_free (str);
}
static void
@@ -71,7 +67,10 @@ show_dialog (void)
//gtk_widget_show (label);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), label, GTK_RESPONSE_HELP);
g_signal_connect (dialog, "event",
gtk_widget_realize (dialog);
g_signal_connect (gtk_widget_get_surface (dialog), "notify::width",
G_CALLBACK (configure_event_cb), label);
g_signal_connect (gtk_widget_get_surface (dialog), "notify::height",
G_CALLBACK (configure_event_cb), label);
gtk_dialog_run (GTK_DIALOG (dialog));