[gnome-shell/T27795: 20/138] Integration with the SpeedWagon



commit bc98b0c263ea6b5598d6ab7a7ad02eba7ea82ba4
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Tue Apr 25 17:56:24 2017 +0100

    Integration with the SpeedWagon
    
    All of the code to implement this feature (which would reflect the
    code from commit 542aa041 in the old shell), has been picked up and
    squashed while doing The Great Rebase from 3.8 to 3.22.
    
    https://phabricator.endlessm.com/T4255
    https://phabricator.endlessm.com/T6408
    https://phabricator.endlessm.com/T17937

 js/ui/windowAttentionHandler.js |  4 ++++
 js/ui/windowManager.js          | 18 +++++++++++++++++-
 src/shell-app.c                 | 33 ++++++++++++++++++++++++++++-----
 src/shell-window-tracker.c      | 41 +++++++++++++++++++++++++++++++++++++++++
 src/shell-window-tracker.h      |  4 ++++
 5 files changed, 94 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/windowAttentionHandler.js b/js/ui/windowAttentionHandler.js
index ebba20806c..f628d82d68 100644
--- a/js/ui/windowAttentionHandler.js
+++ b/js/ui/windowAttentionHandler.js
@@ -33,6 +33,10 @@ var WindowAttentionHandler = class {
         if (!window || window.has_focus() || window.is_skip_taskbar())
             return;
 
+       let focusWindow = global.display.focus_window;
+       if (focusWindow && Shell.WindowTracker.is_speedwagon_window(focusWindow))
+           return;
+
         let app = this._tracker.get_window_app(window);
         let source = new Source(app, window);
         Main.messageTray.add(source);
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 77e24d8336..d0917f61fa 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -1631,7 +1631,23 @@ var WindowManager = class {
                 this._checkDimming(parent);
         });
 
-        if (actor.meta_window.is_attached_dialog())
+        let metaWindow = actor.meta_window;
+        let isSplashWindow = Shell.WindowTracker.is_speedwagon_window(metaWindow);
+
+        if (!isSplashWindow) {
+            // If we have an active splash window for the app, don't animate it.
+            let tracker = Shell.WindowTracker.get_default();
+            let app = tracker.get_window_app(metaWindow);
+            let hasSplashWindow = (app && app.get_windows().some(w => {
+                return Shell.WindowTracker.is_speedwagon_window(w);
+            }));
+            if (hasSplashWindow) {
+                shellwm.completed_map(actor);
+                return;
+            }
+        }
+
+        if (metaWindow.is_attached_dialog())
             this._checkDimming(actor.get_meta_window().get_transient_for());
 
         let types = [Meta.WindowType.NORMAL,
diff --git a/src/shell-app.c b/src/shell-app.c
index 41b08ab8cc..49946fafda 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -40,6 +40,7 @@ typedef struct {
   GSList *windows;
 
   guint interesting_windows;
+  guint speedwagon_windows;
 
   /* Whether or not we need to resort the windows; this is done on demand */
   guint window_sort_stale : 1;
@@ -938,9 +939,16 @@ shell_app_sync_running_state (ShellApp *app)
   g_return_if_fail (app->running_state != NULL);
 
   if (app->running_state->interesting_windows > 0)
-    shell_app_state_transition (app, SHELL_APP_STATE_RUNNING);
+    {
+      shell_app_state_transition (app, SHELL_APP_STATE_RUNNING);
+    }
   else if (app->state != SHELL_APP_STATE_STARTING)
-    shell_app_state_transition (app, SHELL_APP_STATE_STOPPED);
+    {
+      if (app->running_state->speedwagon_windows > 0)
+        shell_app_state_transition (app, SHELL_APP_STATE_STARTING);
+      else
+        shell_app_state_transition (app, SHELL_APP_STATE_STOPPED);
+    }
 }
 
 static void
@@ -1061,6 +1069,15 @@ shell_app_ensure_busy_watch (ShellApp *app)
                                        g_object_ref (app));
 }
 
+static gboolean
+shell_app_is_interesting_window (MetaWindow *window)
+{
+  if (shell_window_tracker_is_speedwagon_window (window))
+    return FALSE;
+
+  return shell_window_tracker_is_window_interesting (window);
+}
+
 void
 _shell_app_add_window (ShellApp        *app,
                        MetaWindow      *window)
@@ -1082,8 +1099,11 @@ _shell_app_add_window (ShellApp        *app,
   shell_app_update_app_actions (app, window);
   shell_app_ensure_busy_watch (app);
 
-  if (!meta_window_is_skip_taskbar (window))
+  if (shell_app_is_interesting_window (window))
     app->running_state->interesting_windows++;
+  else if (shell_window_tracker_is_speedwagon_window (window))
+    app->running_state->speedwagon_windows++;
+
   shell_app_sync_running_state (app);
 
   g_object_thaw_notify (G_OBJECT (app));
@@ -1106,8 +1126,10 @@ _shell_app_remove_window (ShellApp   *app,
   g_object_unref (window);
   app->running_state->windows = g_slist_remove (app->running_state->windows, window);
 
-  if (!meta_window_is_skip_taskbar (window))
+  if (shell_app_is_interesting_window (window))
     app->running_state->interesting_windows--;
+  else if (shell_window_tracker_is_speedwagon_window (window))
+    app->running_state->speedwagon_windows--;
 
   if (app->running_state->windows == NULL)
     {
@@ -1218,7 +1240,8 @@ shell_app_request_quit (ShellApp   *app)
     {
       MetaWindow *win = iter->data;
 
-      if (!meta_window_can_close (win))
+      if (!meta_window_can_close (win) ||
+          !shell_app_is_interesting_window (win))
         continue;
 
       meta_window_delete (win, shell_global_get_current_time (shell_global_get ()));
diff --git a/src/shell-window-tracker.c b/src/shell-window-tracker.c
index 075cb2a164..29da98eec1 100644
--- a/src/shell-window-tracker.c
+++ b/src/shell-window-tracker.c
@@ -24,6 +24,8 @@
  * Copyright Red Hat, Inc. 2006-2008
  */
 
+#define SPEEDWAGON_ROLE "eos-speedwagon"
+
 /**
  * SECTION:shell-window-tracker
  * @short_description: Associate windows with applications
@@ -799,6 +801,45 @@ shell_window_tracker_get_startup_sequences (ShellWindowTracker *self)
   return meta_startup_notification_get_sequences (sn);
 }
 
+/**
+ * shell_window_tracker_is_window_interesting:
+ *
+ * The ShellWindowTracker associates certain kinds of windows with
+ * applications; however, others we don't want to
+ * appear in places where we want to give a list of windows
+ * for an application, such as the alt-tab dialog.
+ *
+ * An example of a window we don't want to show is the root
+ * desktop window.  We skip all override-redirect types, and also
+ * exclude other window types like tooltip explicitly, though generally
+ * most of these should be override-redirect.
+ * Side component windows are considered interesting so they can be handled
+ * by the window manager.
+ *
+ * Returns: %TRUE iff a window is "interesting"
+ */
+gboolean
+shell_window_tracker_is_window_interesting (MetaWindow *window)
+{
+  if (meta_window_is_skip_taskbar (window))
+    return FALSE;
+
+  return TRUE;
+}
+
+/**
+ * shell_window_tracker_is_speedwagon_window:
+ *
+ * A speedwagon window is shown while an application is being launched.
+ *
+ * Returns: %TRUE if a window is a speedwagon
+ */
+gboolean
+shell_window_tracker_is_speedwagon_window (MetaWindow *window)
+{
+  return g_strcmp0 (meta_window_get_role (window), SPEEDWAGON_ROLE) == 0;
+}
+
 static ShellApp *
 shell_startup_sequence_get_app (MetaStartupSequence *sequence)
 {
diff --git a/src/shell-window-tracker.h b/src/shell-window-tracker.h
index 87c38f882f..546f07b77f 100644
--- a/src/shell-window-tracker.h
+++ b/src/shell-window-tracker.h
@@ -24,6 +24,10 @@ ShellApp *shell_window_tracker_get_app_from_pid (ShellWindowTracker *tracker, in
 
 GSList *shell_window_tracker_get_startup_sequences (ShellWindowTracker *tracker);
 
+gboolean shell_window_tracker_is_window_interesting (MetaWindow *window);
+
+gboolean shell_window_tracker_is_speedwagon_window (MetaWindow *window);
+
 G_END_DECLS
 
 #endif /* __SHELL_WINDOW_TRACKER_H__ */


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