[gtk+] Set GDK_WINDOW_STATE_TILED if any edge is tiled
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Set GDK_WINDOW_STATE_TILED if any edge is tiled
- Date: Sun, 21 Jan 2018 13:19:25 +0000 (UTC)
commit e22990302a050fa5b037a3e21ccaa1c130b59fbb
Author: Simon McVittie <smcv debian org>
Date: Thu Oct 26 15:51:51 2017 +0100
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
gdk/wayland/gdkwindow-wayland.c | 8 ++++----
gdk/x11/gdkdisplay-x11.c | 20 +++++++++++++++++---
2 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index f5611f0..3f9db70 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -2890,16 +2890,16 @@ gtk_surface_configure (void *data,
/* Since v2 */
case GTK_SURFACE1_STATE_TILED_TOP:
- new_state |= GDK_WINDOW_STATE_TOP_TILED;
+ new_state |= (GDK_WINDOW_STATE_TILED | GDK_WINDOW_STATE_TOP_TILED);
break;
case GTK_SURFACE1_STATE_TILED_RIGHT:
- new_state |= GDK_WINDOW_STATE_RIGHT_TILED;
+ new_state |= (GDK_WINDOW_STATE_TILED | GDK_WINDOW_STATE_RIGHT_TILED);
break;
case GTK_SURFACE1_STATE_TILED_BOTTOM:
- new_state |= GDK_WINDOW_STATE_BOTTOM_TILED;
+ new_state |= (GDK_WINDOW_STATE_TILED | GDK_WINDOW_STATE_BOTTOM_TILED);
break;
case GTK_SURFACE1_STATE_TILED_LEFT:
- new_state |= GDK_WINDOW_STATE_LEFT_TILED;
+ new_state |= (GDK_WINDOW_STATE_TILED | GDK_WINDOW_STATE_LEFT_TILED);
break;
default:
/* Unknown state */
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 84a1b2f..67a7217 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -199,6 +199,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,
@@ -214,8 +219,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_window_supports_edge_constraints (window))
{
@@ -237,7 +243,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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]