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
This commit is contained in:
Carlos Garnacho 2019-04-16 13:07:58 +02:00
parent 217bd31531
commit aea56b6f55

View File

@ -119,6 +119,18 @@ meta_launch_context_constructed (GObject *object)
"WAYLAND_DISPLAY", getenv ("WAYLAND_DISPLAY")); "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 * static gchar *
meta_launch_context_get_startup_notify_id (GAppLaunchContext *launch_context, meta_launch_context_get_startup_notify_id (GAppLaunchContext *launch_context,
GAppInfo *info, GAppInfo *info,
@ -137,7 +149,7 @@ meta_launch_context_get_startup_notify_id (GAppLaunchContext *launch_context,
MetaStartupNotification *sn; MetaStartupNotification *sn;
MetaStartupSequence *seq; MetaStartupSequence *seq;
startup_id = g_uuid_string_random (); startup_id = create_startup_notification_id (context->timestamp);
/* Fallback through inserting our own startup sequence, this /* Fallback through inserting our own startup sequence, this
* will be enough for wayland clients. * will be enough for wayland clients.