summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2017-08-18 20:21:37 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2017-10-03 18:16:44 -0300
commit446c9b74604a26028c984fedcdf124b9d7ef5e6a (patch)
treeeb20685b5b3fce30b4244065dc8d66128dc687e5
parent437ab625ed888c97282f1612b349468851723d45 (diff)
downloadmutter-wip/fmuellner/contraint-tiling.tar.gz
x11: Add support for _GTK_EDGE_CONSTRAINTS atomwip/fmuellner/contraint-tiling
To keep feature parity with the Wayland backend, and to improve the overall tiling experience with GTK apps, add the _GTK_EDGE_CONSTRAINTS X11 atom and update it when necessary. https://bugzilla.gnome.org/show_bug.cgi?id=751857
-rw-r--r--src/core/screen.c1
-rw-r--r--src/x11/atomnames.h1
-rw-r--r--src/x11/window-x11.c30
3 files changed, 32 insertions, 0 deletions
diff --git a/src/core/screen.c b/src/core/screen.c
index e6c6cdd26..429c2d6eb 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -308,6 +308,7 @@ set_supported_hint (MetaScreen *screen)
screen->display->atom__GTK_FRAME_EXTENTS,
screen->display->atom__GTK_SHOW_WINDOW_MENU,
+ screen->display->atom__GTK_EDGE_CONSTRAINTS,
};
XChangeProperty (screen->display->xdisplay, screen->xroot,
diff --git a/src/x11/atomnames.h b/src/x11/atomnames.h
index ff6c6cc2d..dcb1516b8 100644
--- a/src/x11/atomnames.h
+++ b/src/x11/atomnames.h
@@ -63,6 +63,7 @@ item(_GTK_APP_MENU_OBJECT_PATH)
item(_GTK_MENUBAR_OBJECT_PATH)
item(_GTK_FRAME_EXTENTS)
item(_GTK_SHOW_WINDOW_MENU)
+item(_GTK_EDGE_CONSTRAINTS)
item(_GNOME_WM_KEYBINDINGS)
item(_GNOME_PANEL_ACTION)
item(_GNOME_PANEL_ACTION_MAIN_MENU)
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index bc922c12a..36a5e70a3 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -902,6 +902,31 @@ update_net_frame_extents (MetaWindow *window)
meta_error_trap_pop (window->display);
}
+static void
+update_gtk_edge_constraints (MetaWindow *window)
+{
+ MetaEdgeConstraint *constraints = window->edge_constraints;
+ unsigned long data[1];
+
+ /* Edge constraints */
+ data[0] = (constraints[0] != META_EDGE_CONSTRAINT_NONE ? 1 : 0) << 0 |
+ (constraints[0] != META_EDGE_CONSTRAINT_MONITOR ? 1 : 0) << 1 |
+ (constraints[1] != META_EDGE_CONSTRAINT_NONE ? 1 : 0) << 2 |
+ (constraints[1] != META_EDGE_CONSTRAINT_MONITOR ? 1 : 0) << 3 |
+ (constraints[2] != META_EDGE_CONSTRAINT_NONE ? 1 : 0) << 4 |
+ (constraints[2] != META_EDGE_CONSTRAINT_MONITOR ? 1 : 0) << 5 |
+ (constraints[3] != META_EDGE_CONSTRAINT_NONE ? 1 : 0) << 6 |
+ (constraints[3] != META_EDGE_CONSTRAINT_MONITOR ? 1 : 0) << 7;
+
+ meta_verbose ("Setting _GTK_EDGE_CONSTRAINTS to %lu\n", data[0]);
+
+ XChangeProperty (window->display->xdisplay,
+ window->xwindow,
+ window->display->atom__GTK_EDGE_CONSTRAINTS,
+ XA_CARDINAL, 32, PropModeReplace,
+ (guchar*) data, 1);
+}
+
static gboolean
sync_request_timeout (gpointer data)
{
@@ -1259,6 +1284,8 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
*result |= META_MOVE_RESIZE_RESULT_MOVED;
if (need_resize_client || need_resize_frame)
*result |= META_MOVE_RESIZE_RESULT_RESIZED;
+
+ update_gtk_edge_constraints (window);
}
static gboolean
@@ -1670,6 +1697,9 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
meta_error_trap_pop (window->display);
}
}
+
+ /* Edge constraints */
+ update_gtk_edge_constraints (window);
}
static cairo_region_t *