Compare commits

...

2 Commits

Author SHA1 Message Date
Carlos Garnacho
a631faa9b1 wayland: Implement gtk_shell.set_startup_id
Fetch the DESKTOP_STARTUP_ID envvar at the same point it's done
for the X11 backend, and notify the startup ID gotten on
notify_startup_complete().
2016-02-06 15:07:52 +01:00
Carlos Garnacho
9a2785d75d wayland: Update gtk-shell protocol to v3
Add a gtk_shell.set_startup_id request, so the application can communicate
to the compositor the startup id that it received through the
DESKTOP_STARTUP_ID envvar, or other means.
2016-02-06 15:06:59 +01:00
3 changed files with 46 additions and 3 deletions

View File

@@ -547,6 +547,30 @@ gdk_wayland_display_flush (GdkDisplay *display)
wl_display_flush (GDK_WAYLAND_DISPLAY (display)->wl_display);
}
static void
gdk_wayland_display_make_default (GdkDisplay *display)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
const gchar *startup_id;
g_free (display_wayland->startup_notification_id);
display_wayland->startup_notification_id = NULL;
startup_id = g_getenv ("DESKTOP_STARTUP_ID");
if (startup_id && *startup_id != '\0')
{
if (!g_utf8_validate (startup_id, -1, NULL))
g_warning ("DESKTOP_STARTUP_ID contains invalid UTF-8");
else
display_wayland->startup_notification_id = g_strdup (startup_id);
/* Clear the environment variable so it won't be inherited by
* child processes and confuse things.
*/
g_unsetenv ("DESKTOP_STARTUP_ID");
}
}
static gboolean
gdk_wayland_display_has_pending (GdkDisplay *display)
{
@@ -639,6 +663,20 @@ static void
gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
const gchar *startup_id)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
gchar *free_this = NULL;
if (startup_id == NULL)
{
startup_id = free_this = display_wayland->startup_notification_id;
display_wayland->startup_notification_id = NULL;
if (startup_id == NULL)
return;
}
gtk_shell_set_startup_id (display_wayland->gtk_shell, startup_id);
g_free (free_this);
}
static GdkKeymap *
@@ -691,6 +729,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
display_class->beep = gdk_wayland_display_beep;
display_class->sync = gdk_wayland_display_sync;
display_class->flush = gdk_wayland_display_flush;
display_class->make_default = gdk_wayland_display_make_default;
display_class->has_pending = gdk_wayland_display_has_pending;
display_class->queue_events = _gdk_wayland_display_queue_events;
display_class->get_default_group = gdk_wayland_display_get_default_group;

View File

@@ -43,7 +43,7 @@
#define WL_SURFACE_HAS_BUFFER_SCALE 3
#define WL_POINTER_HAS_FRAME 5
#define SUPPORTED_GTK_SHELL_VERSION 2
#define SUPPORTED_GTK_SHELL_VERSION 3
#define GDK_WINDOW_IS_WAYLAND(win) (GDK_IS_WINDOW_IMPL_WAYLAND (((GdkWindow *)win)->impl))

View File

@@ -1,6 +1,6 @@
<protocol name="gtk">
<interface name="gtk_shell" version="2">
<interface name="gtk_shell" version="3">
<description summary="gtk specific extensions">
gtk_shell is a protocol extension providing additional features for
clients implementing it. It is not backward compatible, and a client must
@@ -23,9 +23,13 @@
<arg name="gtk_surface" type="new_id" interface="gtk_surface"/>
<arg name="surface" type="object" interface="wl_surface"/>
</request>
<request name="set_startup_id" since="3">
<arg name="startup_id" type="string" allow-null="true"/>
</request>
</interface>
<interface name="gtk_surface" version="2">
<interface name="gtk_surface" version="3">
<request name="set_dbus_properties">
<arg name="application_id" type="string" allow-null="true"/>
<arg name="app_menu_path" type="string" allow-null="true"/>