From 2c85bb41782069ab400e20885f5a05b3fe7c440f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 25 Sep 2017 15:10:58 -0400 Subject: [PATCH] window: Make should_be_on_all_workspaces() handle being headless Also adds a soft assert to meta_window_is_on_primary_monitor() to make it easier to spot when callers might want to handle headless in a certain way. https://bugzilla.gnome.org/show_bug.cgi?id=730551 --- src/core/window.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/core/window.c b/src/core/window.c index b9c07ec4f..1fc483d16 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -2933,6 +2933,8 @@ meta_window_is_monitor_sized (MetaWindow *window) gboolean meta_window_is_on_primary_monitor (MetaWindow *window) { + g_return_val_if_fail (window->monitor, FALSE); + return window->monitor->is_primary; } @@ -4543,13 +4545,22 @@ set_workspace_state (MetaWindow *window, static gboolean should_be_on_all_workspaces (MetaWindow *window) { - return - window->always_sticky || - window->on_all_workspaces_requested || - window->override_redirect || - (meta_prefs_get_workspaces_only_on_primary () && - !window->unmanaging && - !meta_window_is_on_primary_monitor (window)); + if (window->always_sticky) + return TRUE; + + if (window->on_all_workspaces_requested) + return TRUE; + + if (window->override_redirect) + return TRUE; + + if (meta_prefs_get_workspaces_only_on_primary () && + !window->unmanaging && + window->monitor && + !meta_window_is_on_primary_monitor (window)) + return TRUE; + + return FALSE; } void