gesturestylus: Port to new API model

This commit is contained in:
Carlos Garnacho 2018-04-26 17:32:43 +02:00
parent 15e00759c7
commit 3675f9ccb2
3 changed files with 8 additions and 9 deletions

View File

@ -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 };
}

View File

@ -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);
}

View File

@ -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,