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:
parent
816f5162f9
commit
b62c157680
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user