summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Sanchez Prada <msanchez@gnome.org>2018-05-18 13:56:10 +0100
committerMario Sanchez Prada <msanchez@gnome.org>2018-05-18 14:03:53 +0100
commit9be0fc0868420369e9bb9acb00a457028b462b95 (patch)
tree81ab3b9172b0f0053821922b5759c00b40f92cdc
parent84364a7ef4751fa74af0aa34686605dd76ae0a9d (diff)
downloadgtk+-issue1084.tar.gz
application: Complete the startup sequence before quitting remote instancesissue1084
When running a remote GtkApplication via the command line, such application will hand things over to the primary instance and quit, which can leave the launcher (e.g. Shell) waiting forever for the event that would complete the startup sequence if StartupNotification=true is present in the .desktop file. This can cause undesired effects in the launcher, which will likely end up terminating the sequence itself at some point after a timeout if such event is never issued. To fix it, simply check whether we're in that situation once the command line has been handled for remote instances and notify the completion at that moment, which will only issue the event that the launcher is expecting if an startup ID was set in the first place. https://gitlab.gnome.org/GNOME/gtk/issues/1084
-rw-r--r--gtk/gtkapplication.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index 91b14af558..dd3dd6fd06 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -322,7 +322,25 @@ gtk_application_local_command_line (GApplication *application,
gchar ***arguments,
gint *exit_status)
{
- return G_APPLICATION_CLASS (gtk_application_parent_class)->local_command_line (application, arguments, exit_status);
+ gboolean result;
+
+ result = G_APPLICATION_CLASS (gtk_application_parent_class)->local_command_line (application, arguments, exit_status);
+
+ /* At this point we should know whether the application is registered
+ * as a remote one, in which case we need to make sure that the startup
+ * notification sequence gets completed, if needed, before handing things
+ * over to the primary instance and quitting.
+ */
+ if (g_application_get_is_registered (application) && g_application_get_is_remote (application))
+ {
+ GdkDisplay *display;
+
+ display = gdk_display_get_default ();
+ if (display)
+ gdk_display_notify_startup_complete (display, NULL);
+ }
+
+ return result;
}
static void