[mutter/wip/carlosg/avoid-app-updates-2] core: Only trigger MetaWorkspace::window-* on toplevel window types



commit c5e832352ba5ae137dd925644c8e616022618290
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jul 24 23:35:18 2019 +0200

    core: Only trigger MetaWorkspace::window-* on toplevel window types
    
    Popups and other override-redirect windows are irrelevant to all listeners
    of MetaWorkspace::window-*. Ignoring those windows will namely result in
    less activity on ShellWindowTracker, less ShellApp::windows-changed
    signal emissions and less AppMenuButton updates.
    
    Reduces gnome-shell CPU activity while typing on the Epiphany addressbar,
    as the pop up animation there results in a number of xdg_popup being
    created and destroyed.

 src/core/workspace.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/core/workspace.c b/src/core/workspace.c
index be70ba5a1..d1ba132ca 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -372,7 +372,12 @@ meta_workspace_add_window (MetaWorkspace *workspace,
       meta_workspace_invalidate_work_area (workspace);
     }
 
-  g_signal_emit (workspace, signals[WINDOW_ADDED], 0, window);
+  if (window->type == META_WINDOW_NORMAL ||
+      window->type == META_WINDOW_DIALOG ||
+      window->type == META_WINDOW_MODAL_DIALOG ||
+      window->type == META_WINDOW_UTILITY)
+    g_signal_emit (workspace, signals[WINDOW_ADDED], 0, window);
+
   g_object_notify_by_pspec (G_OBJECT (workspace), obj_props[PROP_N_WINDOWS]);
 }
 
@@ -393,7 +398,12 @@ meta_workspace_remove_window (MetaWorkspace *workspace,
       meta_workspace_invalidate_work_area (workspace);
     }
 
-  g_signal_emit (workspace, signals[WINDOW_REMOVED], 0, window);
+  if (window->type == META_WINDOW_NORMAL ||
+      window->type == META_WINDOW_DIALOG ||
+      window->type == META_WINDOW_MODAL_DIALOG ||
+      window->type == META_WINDOW_UTILITY)
+    g_signal_emit (workspace, signals[WINDOW_REMOVED], 0, window);
+
   g_object_notify (G_OBJECT (workspace), "n-windows");
 }
 


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