summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2022-12-04 12:03:44 +0100
committerCarlos Garnacho <carlosg@gnome.org>2022-12-05 12:40:53 +0100
commitdfaa6fdc140ebc60b61723dd395a4df1619f46bf (patch)
treea2121e5d653f37ec3476b3c0ac7a122616e21d53
parent6c0254bf0211e0a0cdc2cd8f0f4c304ebfc8111d (diff)
downloadmutter-dfaa6fdc140ebc60b61723dd395a4df1619f46bf.tar.gz
frames: Fix check of Motif WM hints
We use this for tracking the deletable state of the client window, but forgot to check that the MWM_HINT_FUNCTIONS hint is set in hints.flags before checking hints.functions. This resulted in windows that do not specify this flag (and thus should go with the defaults) in being mistakenly removed the close button, as the functions flags would be typically 0 in that case. Fixes issues with Chromium and Electron applications missing the close button, since Chromium does this on X11. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2735>
-rw-r--r--src/frames/meta-frame.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/frames/meta-frame.c b/src/frames/meta-frame.c
index c66d8b660..f17fe982c 100644
--- a/src/frames/meta-frame.c
+++ b/src/frames/meta-frame.c
@@ -42,6 +42,8 @@ typedef struct
unsigned long status;
} MotifWmHints;
+#define MWM_HINTS_FUNCTIONS (1L << 0)
+
#define MWM_FUNC_ALL (1L << 0)
#define MWM_FUNC_RESIZE (1L << 1)
#define MWM_FUNC_MINIMIZE (1L << 3)
@@ -188,17 +190,17 @@ frame_sync_motif_wm_hints (GtkWindow *frame,
&nitems, &bytes_after,
(unsigned char **) &mwm_hints);
- if (mwm_hints)
+ if (mwm_hints &&
+ (mwm_hints->flags & MWM_HINTS_FUNCTIONS) != 0)
{
if ((mwm_hints->functions & MWM_FUNC_ALL) == 0)
deletable = (mwm_hints->functions & MWM_FUNC_CLOSE) != 0;
else
deletable = (mwm_hints->functions & MWM_FUNC_CLOSE) == 0;
-
- g_free (mwm_hints);
}
gtk_window_set_deletable (frame, deletable);
+ g_free (mwm_hints);
}
static void