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>
Wed, 16 Mar 2022 18:50:21 +0000 (19:50 +0100)
commit9822d2b6b2ace41cb4c92e41545ea7dc66fd386c
tree22ff89a97c366aafbbf4787c5c867cf3ae858d42
parenta36594e754f8982a00160a18aec65ffbc11297f9
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