summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2019-01-23 17:03:25 +0100
committerCarlos Garnacho <carlosg@gnome.org>2019-01-23 19:13:37 +0100
commited9db5a17327e0e12036d9daa25f37252554419d (patch)
tree6395727c41b7c5c59a0b773ceffd69e78d6b6b19
parent45d6c0091a37df874aaf92a16b096af3b532e259 (diff)
downloadgtk+-ed9db5a17327e0e12036d9daa25f37252554419d.tar.gz
gdk/wayland: Implement gdk_window_present()
This uses the gtk_surface1.request_focus request added in gtk-shell v3, the given startup ID may be used by the compositor in order to determine when was the request started, and whether user input happened in between. Closes: https://gitlab.gnome.org/GNOME/gtk/issues/624
-rw-r--r--gdk/wayland/gdkdisplay-wayland.c2
-rw-r--r--gdk/wayland/gdkwindow-wayland.c18
2 files changed, 13 insertions, 7 deletions
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 1e00f292d8..be74c93e0a 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -83,7 +83,7 @@
#define MIN_SYSTEM_BELL_DELAY_MS 20
-#define GTK_SHELL1_VERSION 2
+#define GTK_SHELL1_VERSION 3
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 91e01e1d90..70f1044d9b 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -3532,14 +3532,20 @@ gdk_wayland_window_focus (GdkWindow *window,
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_window_get_display (window));
- 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