[gnome-shell] shell-app: Base running state on "interesting" windows



commit b62c157680ebe682f3957b97bfeb317012a5315f
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Jan 22 11:51:25 2014 -0500

    shell-app: Base running state on "interesting" windows
    
    An app should be considered running if it has at least one "interesting"
    window, however the code considers an app running if it has at least
    one tracked window. This was fine while we were only tracking interesting
    windows, but since commit d21aa0d85fc325 this is no longer the case.
    So keep track of the number of interesting windows as well and use that
    to determine the running state.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722690

 src/shell-app.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/shell-app.c b/src/shell-app.c
index 27f56af..83b96c1 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -42,6 +42,8 @@ typedef struct {
 
   GSList *windows;
 
+  guint interesting_windows;
+
   /* Whether or not we need to resort the windows; this is done on demand */
   guint window_sort_stale : 1;
 
@@ -1024,7 +1026,11 @@ _shell_app_add_window (ShellApp        *app,
   shell_app_update_app_menu (app, window);
   shell_app_ensure_busy_watch (app);
 
-  if (app->state != SHELL_APP_STATE_STARTING)
+  if (shell_window_tracker_is_window_interesting (window))
+    app->running_state->interesting_windows++;
+
+  if (app->state != SHELL_APP_STATE_STARTING &&
+      app->running_state->interesting_windows > 0)
     shell_app_state_transition (app, SHELL_APP_STATE_RUNNING);
 
   g_object_thaw_notify (G_OBJECT (app));
@@ -1046,7 +1052,10 @@ _shell_app_remove_window (ShellApp   *app,
   g_object_unref (window);
   app->running_state->windows = g_slist_remove (app->running_state->windows, window);
 
-  if (app->running_state->windows == NULL)
+  if (shell_window_tracker_is_window_interesting (window))
+    app->running_state->interesting_windows--;
+
+  if (app->running_state->interesting_windows == 0)
     shell_app_state_transition (app, SHELL_APP_STATE_STOPPED);
 
   g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0);


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