[metacity] stack: don't ignore workspace in get_default_focus_window



commit f033b5b498bf9e7193d6e0eb1c29071a303251a3
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Oct 10 15:03:41 2020 +0300

    stack: don't ignore workspace in get_default_focus_window
    
    Commit 00b3e2af07a3 stopped using workspace argument. Redo that
    change to use passed in workspace instead of assuming it is always
    active workspace.

 src/core/stack.c          |  2 +-
 src/core/window-private.h |  3 +++
 src/core/window.c         | 22 ++++++++++++++++------
 3 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/src/core/stack.c b/src/core/stack.c
index 92a25809..e16014d1 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -1246,7 +1246,7 @@ get_default_focus_window (MetaStack     *stack,
       if (!(window->input || window->take_focus))
         continue;
 
-      if (!meta_window_should_be_showing (window))
+      if (!meta_window_should_be_showing_on_workspace (window, workspace))
         continue;
 
       if (must_be_at_point && !window_contains_point (window, root_x, root_y))
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 05b3ac6f..147e81c7 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -526,6 +526,9 @@ void        meta_window_resize_with_gravity (MetaWindow  *window,
 /* Return whether the window would be showing if we were on its workspace */
 gboolean    meta_window_showing_on_its_workspace (MetaWindow *window);
 
+gboolean    meta_window_should_be_showing_on_workspace (MetaWindow    *window,
+                                                        MetaWorkspace *workspace);
+
 /* Return whether the window should be currently mapped */
 gboolean    meta_window_should_be_showing   (MetaWindow  *window);
 
diff --git a/src/core/window.c b/src/core/window.c
index c3a091f3..da2a2590 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1479,24 +1479,24 @@ meta_window_showing_on_its_workspace (MetaWindow *window)
 }
 
 gboolean
-meta_window_should_be_showing (MetaWindow  *window)
+meta_window_should_be_showing_on_workspace (MetaWindow    *window,
+                                            MetaWorkspace *workspace)
 {
   gboolean on_workspace;
 
   meta_verbose ("Should be showing for window %s\n", window->desc);
 
   /* See if we're on the workspace */
-  on_workspace = meta_window_located_on_workspace (window,
-                                                   window->screen->active_workspace);
+  on_workspace = meta_window_located_on_workspace (window, workspace);
 
   if (!on_workspace)
     meta_verbose ("Window %s is not on workspace %d\n",
                   window->desc,
-                  meta_workspace_index (window->screen->active_workspace));
+                  meta_workspace_index (workspace));
   else
-    meta_verbose ("Window %s is on the active workspace %d\n",
+    meta_verbose ("Window %s is on workspace %d\n",
                   window->desc,
-                  meta_workspace_index (window->screen->active_workspace));
+                  meta_workspace_index (workspace));
 
   if (window->on_all_workspaces)
     meta_verbose ("Window %s is on all workspaces\n", window->desc);
@@ -1504,6 +1504,16 @@ meta_window_should_be_showing (MetaWindow  *window)
   return on_workspace && meta_window_showing_on_its_workspace (window);
 }
 
+gboolean
+meta_window_should_be_showing (MetaWindow *window)
+{
+  MetaWorkspace *active_workspace;
+
+  active_workspace = window->screen->active_workspace;
+
+  return meta_window_should_be_showing_on_workspace (window, active_workspace);
+}
+
 static void
 implement_showing (MetaWindow *window,
                    gboolean    showing)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]