summaryrefslogtreecommitdiff
path: root/gtk/gtkwindowhandle.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-05-17 12:06:26 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-05-17 12:49:26 -0400
commitf316fe0f58014d6fa24dcc62df01a4a2c1e7d4f7 (patch)
tree91c2ada5038d78ce7888ae70dd48b97795f0085a /gtk/gtkwindowhandle.c
parent309a7aa253b0e6d4721a8eafb6ce035787df7b88 (diff)
downloadgtk+-f316fe0f58014d6fa24dcc62df01a4a2c1e7d4f7.tar.gz
window: Use toplevel begin_move/resize api
The GdkSurface api for this is going away.
Diffstat (limited to 'gtk/gtkwindowhandle.c')
-rw-r--r--gtk/gtkwindowhandle.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/gtk/gtkwindowhandle.c b/gtk/gtkwindowhandle.c
index 3e411465b5..ef1964e433 100644
--- a/gtk/gtkwindowhandle.c
+++ b/gtk/gtkwindowhandle.c
@@ -113,11 +113,12 @@ move_window_clicked (GtkModelButton *button,
GtkNative *native = gtk_widget_get_native (GTK_WIDGET (self));
GdkSurface *surface = gtk_native_get_surface (native);
- gdk_surface_begin_move_drag (surface,
- NULL,
- 0, /* 0 means "use keyboard" */
- 0, 0,
- GDK_CURRENT_TIME);
+ if (GDK_IS_TOPLEVEL (surface))
+ gdk_toplevel_begin_move (GDK_TOPLEVEL (surface),
+ NULL,
+ 0, /* 0 means "use keyboard" */
+ 0, 0,
+ GDK_CURRENT_TIME);
}
static void
@@ -127,12 +128,13 @@ resize_window_clicked (GtkModelButton *button,
GtkNative *native = gtk_widget_get_native (GTK_WIDGET (self));
GdkSurface *surface = gtk_native_get_surface (native);
- gdk_surface_begin_resize_drag (surface,
- 0,
- NULL,
- 0, /* 0 means "use keyboard" */
- 0, 0,
- GDK_CURRENT_TIME);
+ if (GDK_IS_TOPLEVEL (surface))
+ gdk_toplevel_begin_resize (GDK_TOPLEVEL (surface),
+ 0,
+ NULL,
+ 0, /* 0 means "use keyboard" */
+ 0, 0,
+ GDK_CURRENT_TIME);
}
static void
@@ -475,17 +477,19 @@ drag_gesture_update_cb (GtkGestureDrag *gesture,
gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y);
native = gtk_widget_get_native (GTK_WIDGET (self));
+
gtk_widget_translate_coordinates (GTK_WIDGET (self),
GTK_WIDGET (native),
start_x, start_y,
&window_x, &window_y);
surface = gtk_native_get_surface (native);
- gdk_surface_begin_move_drag (surface,
- gtk_gesture_get_device (GTK_GESTURE (gesture)),
- gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)),
- window_x, window_y,
- gtk_event_controller_get_current_event_time (GTK_EVENT_CONTROLLER (gesture)));
+ if (GDK_IS_TOPLEVEL (surface))
+ gdk_toplevel_begin_move (GDK_TOPLEVEL (surface),
+ gtk_gesture_get_device (GTK_GESTURE (gesture)),
+ gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)),
+ window_x, window_y,
+ gtk_event_controller_get_current_event_time (GTK_EVENT_CONTROLLER (gesture)));
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (self->click_gesture));