[gtk/wip/muktupavels/issue-1084] application: Complete startup notification sequence for remote invocations



commit c17c18e4400de7f037b94d54f1f5469c5fb98941
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Mon May 21 15:44:02 2018 +0100

    application: Complete startup notification sequence for remote invocations
    
    When a remote instance of a GTK application implementing the Startup
    Notification protocol gets spawned it will pass the startup sequence
    ID as "platform data" to the main instance. Thus, we need to make sure
    that the startup sequence gets completed in that case, since the remote
    instance won't do it by itself, since it won't map any top level window.
    
    Checking for this "platform data" in the implementation of the after_emit()
    virtual method in the primary instance should be a good place to do so, since
    the existence of such data proves that a remote instance has been spawned.
    
    https://gitlab.gnome.org/GNOME/gtk/issues/1084

 gtk/gtkapplication.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index 3607b69f5e..205d37730b 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -376,6 +376,18 @@ static void
 gtk_application_after_emit (GApplication *application,
                             GVariant     *platform_data)
 {
+  const char *startup_notification_id = NULL;
+
+  g_variant_lookup (platform_data, "desktop-startup-id", "&s", &startup_notification_id);
+  if (startup_notification_id)
+    {
+      GdkDisplay *display;
+
+      display = gdk_display_get_default ();
+      if (display)
+        gdk_display_notify_startup_complete (display, startup_notification_id);
+    }
+
   gdk_threads_leave ();
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]