[gtk+] gdkdisplay-wayland: Add API to set startup notification ID



commit d163aba03051bbcd0cc76d63703c1a8d9d860e78
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Oct 10 12:33:54 2016 +0200

    gdkdisplay-wayland: Add API to set startup notification ID
    
    For wayland clients, the startup notification ID is currently only set
    from the DESKTOP_STARTUP_ID environment variable. As that variable is
    only set for clients launched via exec(), startup completion is not
    indicated correctly for DBus-activated applications unless an explicit
    ID is specified - usually that is not the case, as the default handling
    uses gdk_notify_startup_complete().
    To address this, we need API to set the startup notification ID from GTK
    as we have on X11.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768531

 gdk/wayland/gdkdisplay-wayland.c |   27 +++++++++++++++++++++++++++
 gdk/wayland/gdkwaylanddisplay.h  |    3 +++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 9cdb955..2ed7d27 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -790,6 +790,33 @@ gdk_wayland_display_get_next_serial (GdkDisplay *display)
   return ++serial;
 }
 
+/**
+ * gdk_wayland_display_set_startup_notification_id:
+ * @display: (type GdkWaylandDisplay): a #GdkDisplay
+ * @startup_id: the startup notification ID (must be valid utf8)
+ *
+ * Sets the startup notification ID for a display.
+ *
+ * This is usually taken from the value of the DESKTOP_STARTUP_ID
+ * environment variable, but in some cases (such as the application not
+ * being launched using exec()) it can come from other sources.
+ *
+ * The startup ID is also what is used to signal that the startup is
+ * complete (for example, when opening a window or when calling
+ * gdk_notify_startup_complete()).
+ *
+ * Since: 3.22
+ **/
+void
+gdk_wayland_display_set_startup_notification_id (GdkDisplay *display,
+                                                 const char *startup_id)
+{
+  GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
+
+  g_free (display_wayland->startup_notification_id);
+  display_wayland->startup_notification_id = g_strdup (startup_id);
+}
+
 static void
 gdk_wayland_display_notify_startup_complete (GdkDisplay  *display,
                                             const gchar *startup_id)
diff --git a/gdk/wayland/gdkwaylanddisplay.h b/gdk/wayland/gdkwaylanddisplay.h
index a5587ca..f4b51c8 100644
--- a/gdk/wayland/gdkwaylanddisplay.h
+++ b/gdk/wayland/gdkwaylanddisplay.h
@@ -53,6 +53,9 @@ GDK_AVAILABLE_IN_3_10
 void                    gdk_wayland_display_set_cursor_theme    (GdkDisplay  *display,
                                                                  const gchar *theme,
                                                                  gint         size);
+GDK_AVAILABLE_IN_3_22
+void                    gdk_wayland_display_set_startup_notification_id (GdkDisplay *display,
+                                                                         const char *startup_id);
 
 G_END_DECLS
 


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