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
This commit is contained in:
Giovanni Campagna 2014-01-01 16:53:31 +01:00
parent eb6ae0d3a2
commit cecb2fa3ca

View File

@ -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 static void
gtk_application_impl_x11_class_init (GtkApplicationImplX11Class *class) 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; 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; dbus_class->get_window_system_id = gtk_application_impl_x11_get_window_system_id;
impl_class->before_emit = gtk_application_impl_x11_before_emit;
} }