summaryrefslogtreecommitdiff
path: root/gdk/gdktoplevel.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-05-17 11:45:37 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-05-17 12:41:16 -0400
commit309a7aa253b0e6d4721a8eafb6ce035787df7b88 (patch)
treee350ee755ffbbdee36f86a10cc4f993bbc25cee9 /gdk/gdktoplevel.c
parent2c1d218749e5bbf077bf65396e5e4113151cb845 (diff)
downloadgtk+-309a7aa253b0e6d4721a8eafb6ce035787df7b88.tar.gz
gdk: Add gdk_toplevel_begin_move/resize
For now, these are wrappers around the surface apis, but they are going to replace them, since this operation is only available on toplevels.
Diffstat (limited to 'gdk/gdktoplevel.c')
-rw-r--r--gdk/gdktoplevel.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gdk/gdktoplevel.c b/gdk/gdktoplevel.c
index 96e4982627..7c10511ca9 100644
--- a/gdk/gdktoplevel.c
+++ b/gdk/gdktoplevel.c
@@ -23,6 +23,8 @@
#include "gdk-private.h"
#include "gdktoplevelprivate.h"
+#include <math.h>
+
/**
* SECTION:gdktoplevel
* @Short_description: Interface for toplevel surfaces
@@ -512,3 +514,51 @@ gdk_toplevel_restore_system_shortcuts (GdkToplevel *toplevel)
GDK_TOPLEVEL_GET_IFACE (toplevel)->restore_system_shortcuts (toplevel);
}
+
+/**
+ * gdk_toplevel_begin_resize:
+ * @toplevel: a #GdkToplevel
+ * @edge: the edge or corner from which the drag is started
+ * @device: the device used for the operation
+ * @button: the button being used to drag, or 0 for a keyboard-initiated drag
+ * @x: surface X coordinate of mouse click that began the drag
+ * @y: surface Y coordinate of mouse click that began the drag
+ * @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
+ *
+ * Begins an interactive resize operation (for a toplevel surface).
+ * You might use this function to implement a “window resize grip.”
+ */
+void
+gdk_toplevel_begin_resize (GdkToplevel *toplevel,
+ GdkSurfaceEdge edge,
+ GdkDevice *device,
+ int button,
+ double x,
+ double y,
+ guint32 timestamp)
+{
+ gdk_surface_begin_resize_drag (GDK_SURFACE (toplevel), edge, device, button, round (x), round (y), timestamp);
+}
+
+/**
+ * gdk_toplevel_begin_move:
+ * @toplevel: a #GdkToplevel
+ * @device: the device used for the operation
+ * @button: the button being used to drag, or 0 for a keyboard-initiated drag
+ * @x: surface X coordinate of mouse click that began the drag
+ * @y: surface Y coordinate of mouse click that began the drag
+ * @timestamp: timestamp of mouse click that began the drag
+ *
+ * Begins an interactive move operation (for a toplevel surface).
+ * You might use this function to implement draggable titlebars.
+ */
+void
+gdk_toplevel_begin_move (GdkToplevel *toplevel,
+ GdkDevice *device,
+ int button,
+ double x,
+ double y,
+ guint32 timestamp)
+{
+ gdk_surface_begin_move_drag (GDK_SURFACE (toplevel), device, button, round (x), round (y), timestamp);
+}