x11: Add support for _GTK_EDGE_CONSTRAINTS atom

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
This commit is contained in:
Georges Basile Stavracas Neto 2017-08-18 20:21:37 -03:00
parent 437ab625ed
commit 446c9b7460
3 changed files with 32 additions and 0 deletions

View File

@ -308,6 +308,7 @@ set_supported_hint (MetaScreen *screen)
screen->display->atom__GTK_FRAME_EXTENTS, screen->display->atom__GTK_FRAME_EXTENTS,
screen->display->atom__GTK_SHOW_WINDOW_MENU, screen->display->atom__GTK_SHOW_WINDOW_MENU,
screen->display->atom__GTK_EDGE_CONSTRAINTS,
}; };
XChangeProperty (screen->display->xdisplay, screen->xroot, XChangeProperty (screen->display->xdisplay, screen->xroot,

View File

@ -63,6 +63,7 @@ item(_GTK_APP_MENU_OBJECT_PATH)
item(_GTK_MENUBAR_OBJECT_PATH) item(_GTK_MENUBAR_OBJECT_PATH)
item(_GTK_FRAME_EXTENTS) item(_GTK_FRAME_EXTENTS)
item(_GTK_SHOW_WINDOW_MENU) item(_GTK_SHOW_WINDOW_MENU)
item(_GTK_EDGE_CONSTRAINTS)
item(_GNOME_WM_KEYBINDINGS) item(_GNOME_WM_KEYBINDINGS)
item(_GNOME_PANEL_ACTION) item(_GNOME_PANEL_ACTION)
item(_GNOME_PANEL_ACTION_MAIN_MENU) item(_GNOME_PANEL_ACTION_MAIN_MENU)

View File

@ -902,6 +902,31 @@ update_net_frame_extents (MetaWindow *window)
meta_error_trap_pop (window->display); 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 static gboolean
sync_request_timeout (gpointer data) sync_request_timeout (gpointer data)
{ {
@ -1259,6 +1284,8 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
*result |= META_MOVE_RESIZE_RESULT_MOVED; *result |= META_MOVE_RESIZE_RESULT_MOVED;
if (need_resize_client || need_resize_frame) if (need_resize_client || need_resize_frame)
*result |= META_MOVE_RESIZE_RESULT_RESIZED; *result |= META_MOVE_RESIZE_RESULT_RESIZED;
update_gtk_edge_constraints (window);
} }
static gboolean static gboolean
@ -1670,6 +1697,9 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
meta_error_trap_pop (window->display); meta_error_trap_pop (window->display);
} }
} }
/* Edge constraints */
update_gtk_edge_constraints (window);
} }
static cairo_region_t * static cairo_region_t *