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



commit b84822b725aa434f5e8e948e3207ef097c50b596
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 0a919b9..20a2e24 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -36,6 +36,8 @@ typedef struct {
 
   GSList *windows;
 
+  guint interesting_windows;
+
   /* Whether or not we need to resort the windows; this is done on demand */
   gboolean window_sort_stale : 1;
 
@@ -1034,7 +1036,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));
@@ -1056,7 +1062,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]