Commit ed9db5a1 authored by Carlos Garnacho's avatar Carlos Garnacho

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: #624
parent 45d6c009
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment