[mutter/wip/carlosg/axe-libsn: 2/2] core: Set timestamp in our DESKTOP_STARTUP_ID tokens



commit 0d7cacf1f6109edee4dc4ac081d38918b0a3e198
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Apr 16 13:07:58 2019 +0200

    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.

 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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]