diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-11-18 00:13:17 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-11-18 00:13:17 +0000 |
commit | 9128ad105b1b2644e6cf404e3757bdcf424fc859 (patch) | |
tree | 9c5733d7101e569a9dab3d1a074be6ae92839eee | |
parent | b635736ac2ec78dcaeb78babe2c1716ef2468c65 (diff) | |
parent | 745cbc6c9158a6dc3cc675262b78c61535a79362 (diff) | |
download | gtk+-9128ad105b1b2644e6cf404e3757bdcf424fc859.tar.gz |
Merge branch 'wip/carlosg/for-master' into 'master'
gdk/wayland: Update to gtk_shell1 version 3
See merge request GNOME/gtk!2860
-rw-r--r-- | gdk/wayland/gdkapplaunchcontext-wayland.c | 15 | ||||
-rw-r--r-- | gdk/wayland/gdkdisplay-wayland.c | 2 | ||||
-rw-r--r-- | gdk/wayland/gdksurface-wayland.c | 18 | ||||
-rw-r--r-- | gdk/wayland/protocol/gtk-shell.xml | 14 |
4 files changed, 39 insertions, 10 deletions
diff --git a/gdk/wayland/gdkapplaunchcontext-wayland.c b/gdk/wayland/gdkapplaunchcontext-wayland.c index cb6cf9a12b..ed9e69b0eb 100644 --- a/gdk/wayland/gdkapplaunchcontext-wayland.c +++ b/gdk/wayland/gdkapplaunchcontext-wayland.c @@ -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 diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 0e3cc00b75..39799e2762 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -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 diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 73c59779ff..3e58937a89 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -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 diff --git a/gdk/wayland/protocol/gtk-shell.xml b/gdk/wayland/protocol/gtk-shell.xml index 8191fa9cfb..fb91940b30 100644 --- a/gdk/wayland/protocol/gtk-shell.xml +++ b/gdk/wayland/protocol/gtk-shell.xml @@ -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> |