Set GDK_WINDOW_STATE_TILED if any edge is tiled

This state flag is used in several places in GTK+, for example to
ignore RESIZE_INC hints if tiled. Setting it is also necessary for
backwards compatibility with applications that changed their behaviour
when tiled, such as GNOME Terminal and its MATE fork.

Signed-off-by: Simon McVittie <smcv@debian.org>

https://bugzilla.gnome.org/show_bug.cgi?id=789357
This commit is contained in:
Simon McVittie
2017-10-26 15:51:51 +01:00
committed by Georges Basile Stavracas Neto
parent f2adaba237
commit 465ef50554
2 changed files with 21 additions and 7 deletions

View File

@ -189,6 +189,11 @@ gdk_x11_display_event_translator_init (GdkEventTranslatorIface *iface)
iface->translate_event = gdk_x11_display_translate_event;
}
#define ANY_EDGE_TILED (GDK_WINDOW_STATE_LEFT_TILED | \
GDK_WINDOW_STATE_RIGHT_TILED | \
GDK_WINDOW_STATE_TOP_TILED | \
GDK_WINDOW_STATE_BOTTOM_TILED)
static void
do_edge_constraint_state_check (GdkWindow *window,
GdkWindowState old_state,
@ -205,8 +210,9 @@ do_edge_constraint_state_check (GdkWindow *window,
edge_constraints = toplevel->edge_constraints;
/* If the WM doesn't support _GTK_EDGE_CONSTRAINTS, rely on the fallback
* implementation. If it supports _GTK_EDGE_CONSTRAINTS, however, remove
* the GDK_WINDOW_STATE_TILED flag explicitly.
* implementation. If it supports _GTK_EDGE_CONSTRAINTS, arrange for
* GDK_WINDOW_STATE_TILED to be set if any edge is tiled, and cleared
* if no edge is tiled.
*/
if (!gdk_x11_screen_supports_net_wm_hint (screen,
gdk_atom_intern_static_string ("_GTK_EDGE_CONSTRAINTS")))
@ -229,7 +235,15 @@ do_edge_constraint_state_check (GdkWindow *window,
else
{
if (old_state & GDK_WINDOW_STATE_TILED)
local_unset |= GDK_WINDOW_STATE_TILED;
{
if (!(edge_constraints & ANY_EDGE_TILED))
local_unset |= GDK_WINDOW_STATE_TILED;
}
else
{
if (edge_constraints & ANY_EDGE_TILED)
local_set |= GDK_WINDOW_STATE_TILED;
}
}
/* Top edge */