From dde09066391ac2c5266ebd29756184856c7ec2b2 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Mon, 5 Aug 2019 18:29:54 +0200
Subject: [PATCH] core: propagate the effective on-all-workspaces setting to
 transient window

Commit 09bab98b1e tried to avoid several workspace changes while in
window construction, but it missed a case:

If we have a window on a secondary monitor with no workspaces enabled
(so it implicitly gets on_all_workspaces = TRUE without requesting it)
and trigger the creation of a second window that has the first as
transient-for, it would first try to set the first workspace than the
transient-for window and then fallback to all/current workspace.

After that commit we only try to set the same workspace than the
transient-for window, but it gets none as neither is on a single workspace,
nor did really request to be on all workspaces.

Fixes crashes when opening transient X11 dialogs in the secondary monitor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/714
---
 src/core/window.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/window.c b/src/core/window.c
index 6836c1648..b8d67347e 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1272,7 +1272,7 @@ _meta_window_shared_new (MetaDisplay         *display,
                       window->desc, window->transient_for->desc);
 
           set_workspace_state (window,
-                               window->transient_for->on_all_workspaces_requested,
+                               should_be_on_all_workspaces (window->transient_for),
                                window->transient_for->workspace);
         }
       else if (window->on_all_workspaces)