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
This commit is contained in:
Jonas Ådahl 2017-09-25 15:10:58 -04:00
parent 8493777961
commit 2c85bb4178

View File

@ -2933,6 +2933,8 @@ meta_window_is_monitor_sized (MetaWindow *window)
gboolean gboolean
meta_window_is_on_primary_monitor (MetaWindow *window) meta_window_is_on_primary_monitor (MetaWindow *window)
{ {
g_return_val_if_fail (window->monitor, FALSE);
return window->monitor->is_primary; return window->monitor->is_primary;
} }
@ -4543,13 +4545,22 @@ set_workspace_state (MetaWindow *window,
static gboolean static gboolean
should_be_on_all_workspaces (MetaWindow *window) should_be_on_all_workspaces (MetaWindow *window)
{ {
return if (window->always_sticky)
window->always_sticky || return TRUE;
window->on_all_workspaces_requested ||
window->override_redirect || if (window->on_all_workspaces_requested)
(meta_prefs_get_workspaces_only_on_primary () && return TRUE;
!window->unmanaging &&
!meta_window_is_on_primary_monitor (window)); 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 void