gdk/wayland: Update to gtk_shell1 version 3

Bring in line with gtk3, in terms of startup notification and
activation support.
This commit is contained in:
Carlos Garnacho
2020-11-18 00:38:15 +01:00
parent b635736ac2
commit 745cbc6c91
4 changed files with 39 additions and 10 deletions

View File

@@ -34,7 +34,20 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
GAppInfo *info,
GList *files)
{
return NULL;
GdkWaylandDisplay *display;
gchar *id = NULL;
g_object_get (context, "display", &display, NULL);
if (display->gtk_shell_version >= 3)
{
id = g_uuid_string_random ();
gtk_shell1_notify_launch (display->gtk_shell, id);
}
g_object_unref (display);
return id;
}
static void

View File

@@ -94,7 +94,7 @@
#define MIN_SYSTEM_BELL_DELAY_MS 20
#define GTK_SHELL1_VERSION 2
#define GTK_SHELL1_VERSION 3
#define OUTPUT_VERSION_WITH_DONE 2
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3

View File

@@ -3232,14 +3232,20 @@ gdk_wayland_surface_focus (GdkSurface *surface,
if (!impl->display_server.gtk_surface)
return;
/* We didn't have an event to fetch a time from, meaning we have nothing valid
* to send. This should rather be translated to a 'needs-attention' request or
* something.
*/
if (timestamp == GDK_CURRENT_TIME)
return;
{
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
gtk_surface1_present (impl->display_server.gtk_surface, timestamp);
if (display_wayland->gtk_shell_version >= 3)
{
gtk_surface1_request_focus (impl->display_server.gtk_surface,
display_wayland->startup_notification_id);
g_clear_pointer (&display_wayland->startup_notification_id, g_free);
}
}
else
gtk_surface1_present (impl->display_server.gtk_surface, timestamp);
}
static void

View File

@@ -1,6 +1,6 @@
<protocol name="gtk">
<interface name="gtk_shell1" version="2">
<interface name="gtk_shell1" version="3">
<description summary="gtk specific extensions">
gtk_shell is a protocol extension providing additional features for
clients implementing it.
@@ -28,9 +28,14 @@
<request name="system_bell">
<arg name="surface" type="object" interface="gtk_surface1" allow-null="true"/>
</request>
<!-- Version 3 additions -->
<request name="notify_launch" since="3">
<arg name="startup_id" type="string"/>
</request>
</interface>
<interface name="gtk_surface1" version="2">
<interface name="gtk_surface1" 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"/>
@@ -72,6 +77,11 @@
<event name="configure_edges" since="2">
<arg name="constraints" type="array"/>
</event>
<!-- Version 3 additions -->
<request name="request_focus" since="3">
<arg name="startup_id" type="string" allow-null="true"/>
</request>
</interface>
</protocol>