window: Be more careful when setting initial workspace state

A window may either be sticky because it has been requested as such,
or because it is placed on a non-primary monitor (and the corresponding
preference is set). While we do take the latter into account, we
currently override the sticky state later during initialization;
be a bit more careful there to get the initial state right.

https://bugzilla.gnome.org/show_bug.cgi?id=737178
This commit is contained in:
Florian Müllner 2014-09-25 12:46:16 +02:00
parent 8ff4597201
commit 2eec11b445

View File

@ -1062,8 +1062,8 @@ _meta_window_shared_new (MetaDisplay *display,
if (window->initial_workspace_set) if (window->initial_workspace_set)
{ {
gboolean on_all_workspaces; gboolean on_all_workspaces = window->on_all_workspaces;
MetaWorkspace *workspace; MetaWorkspace *workspace = NULL;
if (window->initial_workspace == (int) 0xFFFFFFFF) if (window->initial_workspace == (int) 0xFFFFFFFF)
{ {
@ -1077,15 +1077,13 @@ _meta_window_shared_new (MetaDisplay *display,
window->on_all_workspaces_requested = TRUE; window->on_all_workspaces_requested = TRUE;
on_all_workspaces = TRUE; on_all_workspaces = TRUE;
workspace = NULL;
} }
else else if (!on_all_workspaces)
{ {
meta_topic (META_DEBUG_PLACEMENT, meta_topic (META_DEBUG_PLACEMENT,
"Window %s is initially on space %d\n", "Window %s is initially on space %d\n",
window->desc, window->initial_workspace); window->desc, window->initial_workspace);
on_all_workspaces = FALSE;
workspace = meta_screen_get_workspace_by_index (window->screen, workspace = meta_screen_get_workspace_by_index (window->screen,
window->initial_workspace); window->initial_workspace);
} }
@ -1112,7 +1110,7 @@ _meta_window_shared_new (MetaDisplay *display,
window->transient_for->workspace); window->transient_for->workspace);
} }
if (window->workspace == NULL) if (window->workspace == NULL && !window->on_all_workspaces)
{ {
meta_topic (META_DEBUG_PLACEMENT, meta_topic (META_DEBUG_PLACEMENT,
"Putting window %s on active workspace\n", "Putting window %s on active workspace\n",