summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2018-04-26 17:32:43 +0200
committerCarlos Garnacho <carlosg@gnome.org>2018-04-26 17:59:42 +0200
commit3675f9ccb2dd5b4408f1c07c5e30e2aa2f2e43df (patch)
tree653252ce1d779b45f09768833b66b060bc973f45
parent15e00759c74a6bb72bffe2a6d7f75c83914c11c5 (diff)
downloadgtk+-wip/carlosg/controller.tar.gz
gesturestylus: Port to new API modelwip/carlosg/controller
-rw-r--r--demos/gtk-demo/paint.c11
-rw-r--r--gtk/gtkgesturestylus.c4
-rw-r--r--gtk/gtkgesturestylus.h2
3 files changed, 8 insertions, 9 deletions
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,