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 d21aa0d85f 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
This commit is contained in:
Florian Müllner 2014-01-22 11:51:25 -05:00
parent b28ea8ac92
commit b84822b725

View File

@ -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);