From cecb2fa3ca54bff6e262438724afc46e94fab484 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 1 Jan 2014 16:53:31 +0100 Subject: [PATCH] GtkApplicationX11: read the startup ID from the platform data If the platform data passed with actions and activations includes a startup notify ID, we should read it and pass it down to GDK. This ensures that the right startup notify is completed after the signal emission, and that the user time of the GdkDisplay is properly updated (which in turn makes sure the windows are not subjected to focus-stealing-prevention) https://bugzilla.gnome.org/show_bug.cgi?id=721304 --- gtk/gtkapplication-x11.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gtk/gtkapplication-x11.c b/gtk/gtkapplication-x11.c index 1bd3f29b2a..4ee5b8fec0 100644 --- a/gtk/gtkapplication-x11.c +++ b/gtk/gtkapplication-x11.c @@ -78,6 +78,20 @@ gtk_application_impl_x11_init (GtkApplicationImplX11 *x11) { } +static void +gtk_application_impl_x11_before_emit (GtkApplicationImpl *impl, + GVariant *platform_data) +{ + const char *startup_notification_id; + + if (g_variant_lookup (platform_data, "desktop-startup-id", + "&s", &startup_notification_id)) + { + gdk_x11_display_set_startup_notification_id (gdk_display_get_default (), + startup_notification_id); + } +} + static void gtk_application_impl_x11_class_init (GtkApplicationImplX11Class *class) { @@ -86,4 +100,5 @@ gtk_application_impl_x11_class_init (GtkApplicationImplX11Class *class) impl_class->handle_window_realize = gtk_application_impl_x11_handle_window_realize; dbus_class->get_window_system_id = gtk_application_impl_x11_get_window_system_id; + impl_class->before_emit = gtk_application_impl_x11_before_emit; }