summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-08-08 16:29:02 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2013-08-13 10:38:49 -0400
commit8818d8a19b1da6a0d22ecebb4008b44c8465bf19 (patch)
treebfd62666b4c6ae524aa9820ad28b0c429f6b946d /gdk
parent129fc6ea3a1b95e46e4a9e8298d4366be8be193d (diff)
downloadgtk+-8818d8a19b1da6a0d22ecebb4008b44c8465bf19.tar.gz
gtkwindow: Export our custom frame extents
This allows CSD windows to be maximized, tiled, and constrained properly. https://bugzilla.gnome.org/show_bug.cgi?id=705765
Diffstat (limited to 'gdk')
-rw-r--r--gdk/x11/gdkwindow-x11.c39
-rw-r--r--gdk/x11/gdkx11window.h6
2 files changed, 45 insertions, 0 deletions
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 7a99d3098b..d4ce45ce45 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -3602,6 +3602,45 @@ gdk_x11_window_set_hide_titlebar_when_maximized (GdkWindow *window,
}
/**
+ * gdk_x11_window_set_frame_extents:
+ * @window: (type GdkX11Window): a #GdkWindow
+ * @left: The left extent
+ * @right: The right extent
+ * @top: The top extent
+ * @bottom: The bottom extent
+ *
+ * Newer GTK+ windows using client-side decorations use extra geometry
+ * around their frames for effects like shadows and invisible borders.
+ * Window managers that want to maximize windows or snap to edges need
+ * to know where the extents of the actual frame lie, so that users
+ * don't feel like windows are snapping against random invisible edges.
+ *
+ * Note that this property is automatically updated by GTK+, so this
+ * function should only be used by applications which do not use GTK+
+ * to create toplevel windows.
+ *
+ * Since: 3.10
+ */
+void
+gdk_x11_window_set_frame_extents (GdkWindow *window,
+ int left,
+ int right,
+ int top,
+ int bottom)
+{
+ Atom frame_extents;
+ gulong data[4] = { left, right, top, bottom };
+
+ frame_extents = gdk_x11_get_xatom_by_name_for_display (gdk_window_get_display (window),
+ "_GTK_FRAME_EXTENTS");
+ XChangeProperty (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
+ frame_extents, XA_CARDINAL,
+ 32, PropModeReplace,
+ (guchar *) &data, 4);
+}
+
+/**
* gdk_x11_window_set_theme_variant:
* @window: (type GdkX11Window): a #GdkWindow
* @variant: the theme variant to export
diff --git a/gdk/x11/gdkx11window.h b/gdk/x11/gdkx11window.h
index 1503402eba..24bb853f75 100644
--- a/gdk/x11/gdkx11window.h
+++ b/gdk/x11/gdkx11window.h
@@ -65,6 +65,12 @@ void gdk_x11_window_set_utf8_property (GdkWindow *window,
GDK_AVAILABLE_IN_3_2
void gdk_x11_window_set_theme_variant (GdkWindow *window,
char *variant);
+GDK_AVAILABLE_IN_3_10
+void gdk_x11_window_set_frame_extents (GdkWindow *window,
+ int left,
+ int right,
+ int top,
+ int bottom);
GDK_AVAILABLE_IN_3_4
void gdk_x11_window_set_hide_titlebar_when_maximized (GdkWindow *window,
gboolean hide_titlebar_when_maximized);