3f1dd6f
From 75ee402c6a1ae32678045d51b0a2beaef7ef2e9a Mon Sep 17 00:00:00 2001
3f1dd6f
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
3f1dd6f
Date: Mon, 10 Oct 2016 12:33:54 +0200
3f1dd6f
Subject: [PATCH 1/2] gdkdisplay-wayland: Add API to set startup notification
3f1dd6f
 ID
3f1dd6f
3f1dd6f
For wayland clients, the startup notification ID is currently only set
3f1dd6f
from the DESKTOP_STARTUP_ID environment variable. As that variable is
3f1dd6f
only set for clients launched via exec(), startup completion is not
3f1dd6f
indicated correctly for DBus-activated applications unless an explicit
3f1dd6f
ID is specified - usually that is not the case, as the default handling
3f1dd6f
uses gdk_notify_startup_complete().
3f1dd6f
To address this, we need API to set the startup notification ID from GTK
3f1dd6f
as we have on X11.
3f1dd6f
3f1dd6f
https://bugzilla.gnome.org/show_bug.cgi?id=768531
3f1dd6f
---
3f1dd6f
 gdk/wayland/gdkdisplay-wayland.c | 27 +++++++++++++++++++++++++++
3f1dd6f
 gdk/wayland/gdkwaylanddisplay.h  |  3 +++
3f1dd6f
 2 files changed, 30 insertions(+)
3f1dd6f
3f1dd6f
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
3f1dd6f
index cddb2de..784cfbe 100644
3f1dd6f
--- a/gdk/wayland/gdkdisplay-wayland.c
3f1dd6f
+++ b/gdk/wayland/gdkdisplay-wayland.c
3f1dd6f
@@ -796,6 +796,33 @@ gdk_wayland_display_get_next_serial (GdkDisplay *display)
3f1dd6f
   return ++serial;
3f1dd6f
 }
3f1dd6f
 
3f1dd6f
+/**
3f1dd6f
+ * gdk_wayland_display_set_startup_notification_id:
3f1dd6f
+ * @display: (type GdkWaylandDisplay): a #GdkDisplay
3f1dd6f
+ * @startup_id: the startup notification ID (must be valid utf8)
3f1dd6f
+ *
3f1dd6f
+ * Sets the startup notification ID for a display.
3f1dd6f
+ *
3f1dd6f
+ * This is usually taken from the value of the DESKTOP_STARTUP_ID
3f1dd6f
+ * environment variable, but in some cases (such as the application not
3f1dd6f
+ * being launched using exec()) it can come from other sources.
3f1dd6f
+ *
3f1dd6f
+ * The startup ID is also what is used to signal that the startup is
3f1dd6f
+ * complete (for example, when opening a window or when calling
3f1dd6f
+ * gdk_notify_startup_complete()).
3f1dd6f
+ *
3f1dd6f
+ * Since: 3.22
3f1dd6f
+ **/
3f1dd6f
+void
3f1dd6f
+gdk_wayland_display_set_startup_notification_id (GdkDisplay *display,
3f1dd6f
+                                                 const char *startup_id)
3f1dd6f
+{
3f1dd6f
+  GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
3f1dd6f
+
3f1dd6f
+  g_free (display_wayland->startup_notification_id);
3f1dd6f
+  display_wayland->startup_notification_id = g_strdup (startup_id);
3f1dd6f
+}
3f1dd6f
+
3f1dd6f
 static void
3f1dd6f
 gdk_wayland_display_notify_startup_complete (GdkDisplay  *display,
3f1dd6f
 					     const gchar *startup_id)
3f1dd6f
diff --git a/gdk/wayland/gdkwaylanddisplay.h b/gdk/wayland/gdkwaylanddisplay.h
3f1dd6f
index a5587ca..f4b51c8 100644
3f1dd6f
--- a/gdk/wayland/gdkwaylanddisplay.h
3f1dd6f
+++ b/gdk/wayland/gdkwaylanddisplay.h
3f1dd6f
@@ -53,6 +53,9 @@ GDK_AVAILABLE_IN_3_10
3f1dd6f
 void                    gdk_wayland_display_set_cursor_theme    (GdkDisplay  *display,
3f1dd6f
                                                                  const gchar *theme,
3f1dd6f
                                                                  gint         size);
3f1dd6f
+GDK_AVAILABLE_IN_3_22
3f1dd6f
+void                    gdk_wayland_display_set_startup_notification_id (GdkDisplay *display,
3f1dd6f
+                                                                         const char *startup_id);
3f1dd6f
 
3f1dd6f
 G_END_DECLS
3f1dd6f
 
3f1dd6f
-- 
3f1dd6f
2.9.3
3f1dd6f