1
0
Fork 0

xwayland: Match applications without WM_CLASS nor WM_NAME

For X11 grabs, the pattern matching mechanism would simply ignore
applications which have neither WM_CLASS nor WM_NAME set.

When dealing with an override redirect window however, it is not
uncommon that these window have neither value set as these window are
supposed to be ignored by the window manager.

When the WM_CLASS or the WM_NAME is not set by the client, assume the
value is empty so the pattern matching can allow for these.

https://gitlab.gnome.org/GNOME/mutter/-/issues/1249

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1254>
This commit is contained in:
Olivier Fourdan 2020-05-13 16:40:47 +02:00
parent 331b5f3563
commit 8bf399ff0c

View file

@ -164,14 +164,26 @@ static gboolean
application_is_in_pattern_array (MetaWindow *window,
GPtrArray *pattern_array)
{
const char *class;
const char *name;
guint i;
if (window->res_class)
class = window->res_class;
else
class = "";
if (window->res_name)
name = window->res_name;
else
name = "";
for (i = 0; pattern_array && i < pattern_array->len; i++)
{
GPatternSpec *pattern = (GPatternSpec *) g_ptr_array_index (pattern_array, i);
if ((window->res_class && g_pattern_match_string (pattern, window->res_class)) ||
(window->res_name && g_pattern_match_string (pattern, window->res_name)))
if (g_pattern_match_string (pattern, class) ||
g_pattern_match_string (pattern, name))
return TRUE;
}