[mutter/wip/exalm/focused-appearance: 6/6] window: Appear as focused while focusing



commit b0c8b3b4d3159eb4f4991d351728485dde0b53a2
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sun Oct 13 05:15:51 2019 +0500

    window: Appear as focused while focusing
    
    Prevent focused window from blinking after switching to another
    workspace on X11.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/850

 src/core/window-private.h | 3 +++
 src/core/window.c         | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 484140a27..5d63a6684 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -540,6 +540,9 @@ struct _MetaWindow
   int constrained_placement_rule_offset_y;
 
   guint unmanage_idle_id;
+
+  /* Prevent blinking when focusing */
+  gboolean focusing;
 };
 
 struct _MetaWindowClass
diff --git a/src/core/window.c b/src/core/window.c
index 4627e5f7b..0953ab887 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4780,7 +4780,11 @@ meta_window_focus (MetaWindow  *window,
       window = modal_transient;
     }
 
+  /* If the window was already appearing focused, but didn't have has_focus set,
+   * it will now briefly appear unfocused on X11. Set a flag to prevent that. */
+  window->focusing = TRUE;
   meta_window_flush_calc_showing (window);
+  window->focusing = FALSE;
 
   if ((!window->mapped || window->hidden) && !window->shaded)
     {
@@ -7255,7 +7259,7 @@ meta_window_appears_focused (MetaWindow *window)
   if (workspace && workspace != workspace_manager->active_workspace)
     default_window = meta_workspace_get_default_focus_window (workspace);
 
-  return window->has_focus || (window->attached_focus_window != NULL) || (window == default_window);
+  return window->has_focus || window->focusing || (window->attached_focus_window != NULL) || (window == 
default_window);
 }
 
 gboolean


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