diff options
author | Mario Sanchez Prada <mario@endlessm.com> | 2018-05-11 13:36:02 +0100 |
---|---|---|
committer | Mario Sanchez Prada <mario@endlessm.com> | 2018-05-17 17:10:05 +0100 |
commit | 969db82f5a2274b72ecbfdbb61bfe3a9316fdfc2 (patch) | |
tree | 98a2c7d2f2302c93de8ae5d4dbd2a8eaa7ab71db | |
parent | 6ee13ff6859f768c689019b583359590652280d8 (diff) | |
download | gnome-shell-issue267.tar.gz |
shell-app: Finish startup sequence for process that exit too earlyissue267
If a process associated to an application declaring StartupNotify=true
in its desktop file exits before having ever mapped a top level window,
the "remove" X message expected as per the Startup Notification Spec [1]
won't ever be issued, and the shell will keep waiting for a while until
the sequence is finished on time out.
This provides a confusing and bad experience since things like a confusing
icon + a spinner, or the mouse pointer switching to a spinning cursor, will
be showing up in the meantime, so we need to detect those situations and
make sure the sequence gets completed, and the app moved to STOPPED.
[1] https://www.freedesktop.org/wiki/Specifications/startup-notification-spec
Closes: #267
-rw-r--r-- | src/shell-app.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/shell-app.c b/src/shell-app.c index dbf537ce9..bfea78b96 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -1191,11 +1191,36 @@ app_child_setup (gpointer user_data) #endif static void +_shell_app_watch_callback (GPid pid, + gint status, + ShellApp *app) +{ + if (app->state == SHELL_APP_STATE_STARTING) + { + ShellWindowTracker *tracker = shell_window_tracker_get_default (); + GSList *startup_sequences = shell_window_tracker_get_startup_sequences (tracker); + GSList *iter = NULL; + + for (iter = startup_sequences; iter; iter = g_slist_next (iter)) + { + ShellStartupSequence *sequence = (ShellStartupSequence*) iter->data; + ShellApp *startup_app = shell_startup_sequence_get_app (sequence); + if (startup_app == app) + shell_startup_sequence_complete (sequence); + } + + shell_app_state_transition (app, SHELL_APP_STATE_STOPPED); + } + + g_spawn_close_pid (pid); +} + +static void wait_pid (GDesktopAppInfo *appinfo, GPid pid, - gpointer user_data) + ShellApp *app) { - g_child_watch_add (pid, (GChildWatchFunc) g_spawn_close_pid, NULL); + g_child_watch_add (pid, (GChildWatchFunc) _shell_app_watch_callback, app); } /** @@ -1242,7 +1267,8 @@ shell_app_launch (ShellApp *app, #else NULL, NULL, #endif - wait_pid, NULL, + (GDesktopAppLaunchCallback) wait_pid, + app, error); g_object_unref (context); |