wayland: Use xdg-activation for non-startup initiated focus requests
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 28 Feb 2022 17:31:40 +0000 (18:31 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 1 Mar 2022 10:38:51 +0000 (11:38 +0100)
commit4dcacff3120d5c1cef888061dbc42f5fbe093a58
treec04f59631f2e87c7fe2890bc9f6f095b253e881d
parent68319afd2373128cb83c28cf70869c0be35874d1
wayland: Use xdg-activation for non-startup initiated focus requests

Currently, we have all the plumbing in place so that GTK consumes the
startup notification ID when focusing a window through the xdg-activation
protocol.

This however misses the case that a window might be requested to be
focused with no startup ID (i.e. via interaction with the application,
not through GApplication or other application launching logic).

In this case, we let the application create a token that will be
consumed by itself. The serial used is that from the last
interaction, so the compositor will still be able to do focus prevention
logic if it applies.

Since we already do have a last serial at hand, prefer xdg-activation
all the way over the now stale gtk-shell focusing support. The timestamp
argument becomes unused, but that is a weak argument to prefer the
private protocol over the standard one. The gtk-shell protocol support
is so far left for interaction with older Mutter.
gdk/wayland/gdksurface-wayland.c