diff --git a/demos/gtk-demo/paint.c b/demos/gtk-demo/paint.c index a451a677c8..abf82f17c8 100644 --- a/demos/gtk-demo/paint.c +++ b/demos/gtk-demo/paint.c @@ -11,8 +11,6 @@ typedef struct cairo_surface_t *surface; cairo_t *cr; GdkRGBA draw_color; - - GtkGesture *stylus_gesture; } DrawingArea; typedef struct @@ -207,13 +205,16 @@ stylus_gesture_motion (GtkGestureStylus *gesture, static void drawing_area_init (DrawingArea *area) { + GtkGesture *gesture; + gtk_widget_set_has_surface (GTK_WIDGET (area), FALSE); - area->stylus_gesture = gtk_gesture_stylus_new (GTK_WIDGET (area)); - g_signal_connect (area->stylus_gesture, "down", + gesture = gtk_gesture_stylus_new (); + g_signal_connect (gesture, "down", G_CALLBACK (stylus_gesture_down), area); - g_signal_connect (area->stylus_gesture, "motion", + g_signal_connect (gesture, "motion", G_CALLBACK (stylus_gesture_motion), area); + gtk_widget_add_controller (GTK_WIDGET (area), GTK_EVENT_CONTROLLER (gesture)); area->draw_color = (GdkRGBA) { 0, 0, 0, 1 }; } diff --git a/gtk/gtkgesturestylus.c b/gtk/gtkgesturestylus.c index 162f02d273..294fa293a3 100644 --- a/gtk/gtkgesturestylus.c +++ b/gtk/gtkgesturestylus.c @@ -131,7 +131,6 @@ gtk_gesture_stylus_init (GtkGestureStylus *gesture) /** * gtk_gesture_stylus_new: - * @widget: a #GtkWidget * * Creates a new #GtkGestureStylus. * @@ -140,10 +139,9 @@ gtk_gesture_stylus_init (GtkGestureStylus *gesture) * Since: 3.94 **/ GtkGesture * -gtk_gesture_stylus_new (GtkWidget *widget) +gtk_gesture_stylus_new (void) { return g_object_new (GTK_TYPE_GESTURE_STYLUS, - "widget", widget, NULL); } diff --git a/gtk/gtkgesturestylus.h b/gtk/gtkgesturestylus.h index eebfe4e8b3..cb4c13efb6 100644 --- a/gtk/gtkgesturestylus.h +++ b/gtk/gtkgesturestylus.h @@ -41,7 +41,7 @@ GDK_AVAILABLE_IN_ALL GType gtk_gesture_stylus_get_type (void) G_GNUC_CONST; GDK_AVAILABLE_IN_ALL -GtkGesture * gtk_gesture_stylus_new (GtkWidget *widget); +GtkGesture * gtk_gesture_stylus_new (void); GDK_AVAILABLE_IN_ALL gboolean gtk_gesture_stylus_get_axis (GtkGestureStylus *gesture,