From aea56b6f5511c919b3801f94e1edd4d9f82635a0 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 16 Apr 2019 13:07:58 +0200 Subject: [PATCH] core: Set timestamp in our DESKTOP_STARTUP_ID tokens We must be educated to X11 clients (which usually parse the timestamp from the DESKTOP_STARTUP_ID, and request focus with it) to make focus stealing prevention work across the board. To wayland clients the startup ID should be as opaque and meaningless as it was before. https://gitlab.gnome.org/GNOME/mutter/merge_requests/540 --- src/core/meta-launch-context.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/core/meta-launch-context.c b/src/core/meta-launch-context.c index 3b73ebf31..ac299d4e4 100644 --- a/src/core/meta-launch-context.c +++ b/src/core/meta-launch-context.c @@ -119,6 +119,18 @@ meta_launch_context_constructed (GObject *object) "WAYLAND_DISPLAY", getenv ("WAYLAND_DISPLAY")); } +static gchar * +create_startup_notification_id (uint32_t timestamp) +{ + gchar *uuid, *id; + + uuid = g_uuid_string_random (); + id = g_strdup_printf ("%s_TIME%u", uuid, timestamp); + g_free (uuid); + + return id; +} + static gchar * meta_launch_context_get_startup_notify_id (GAppLaunchContext *launch_context, GAppInfo *info, @@ -137,7 +149,7 @@ meta_launch_context_get_startup_notify_id (GAppLaunchContext *launch_context, MetaStartupNotification *sn; MetaStartupSequence *seq; - startup_id = g_uuid_string_random (); + startup_id = create_startup_notification_id (context->timestamp); /* Fallback through inserting our own startup sequence, this * will be enough for wayland clients.