gtk-demo: Use GtkDrawingArea::resize

This signal is a replacement for this (ab)use
of ::size-allocate.
This commit is contained in:
Matthias Clasen 2020-05-05 11:53:25 -04:00
parent e4894a69d4
commit cad890ee29

View File

@ -42,7 +42,9 @@ create_surface (GtkWidget *widget)
} }
static void static void
scribble_size_allocate (GtkWidget *widget) scribble_resize (GtkWidget *widget,
int width,
int height)
{ {
create_surface (widget); create_surface (widget);
} }
@ -242,8 +244,8 @@ do_drawingarea (GtkWidget *do_widget)
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), scribble_draw, NULL, NULL); gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), scribble_draw, NULL, NULL);
gtk_frame_set_child (GTK_FRAME (frame), da); gtk_frame_set_child (GTK_FRAME (frame), da);
g_signal_connect (da, "size-allocate", g_signal_connect (da, "resize",
G_CALLBACK (scribble_size_allocate), NULL); G_CALLBACK (scribble_resize), NULL);
drag = gtk_gesture_drag_new (); drag = gtk_gesture_drag_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY); gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);