forked from AuroraMiddleware/gtk
application: Use the new API to get the startup notification ID
The DESKTOP_STARTUP_ID gets cleared early after the process is spawned, meaning that it's too late at add_platform_data() to pick it up and send it over to the primary instance, as it will be always unset at that point. To solve this, we use the new gdk_display_get_startup_notification_id() method to pull the startup notification ID for the application, if present, out of the display and pass it over to that primary instance. https://gitlab.gnome.org/GNOME/gtk/issues/1084
This commit is contained in:
parent
938448e0ef
commit
479c341545
@ -329,7 +329,7 @@ static void
|
||||
gtk_application_add_platform_data (GApplication *application,
|
||||
GVariantBuilder *builder)
|
||||
{
|
||||
const gchar *startup_id;
|
||||
GdkDisplay *display;
|
||||
|
||||
/* This is slightly evil.
|
||||
*
|
||||
@ -338,11 +338,16 @@ gtk_application_add_platform_data (GApplication *application,
|
||||
*
|
||||
* So we do all the things... which currently is just one thing.
|
||||
*/
|
||||
startup_id = getenv ("DESKTOP_STARTUP_ID");
|
||||
display = gdk_display_get_default ();
|
||||
if (display)
|
||||
{
|
||||
const gchar *startup_id;
|
||||
|
||||
if (startup_id && g_utf8_validate (startup_id, -1, NULL))
|
||||
g_variant_builder_add (builder, "{sv}", "desktop-startup-id",
|
||||
g_variant_new_string (startup_id));
|
||||
startup_id = gdk_display_get_startup_notification_id (display);
|
||||
if (startup_id && g_utf8_validate (startup_id, -1, NULL))
|
||||
g_variant_builder_add (builder, "{sv}", "desktop-startup-id",
|
||||
g_variant_new_string (startup_id));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user