gdk-win32: implement basic inhibit-system-shortcuts
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 9 Nov 2022 15:08:11 +0000 (19:08 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 9 Nov 2022 15:29:03 +0000 (19:29 +0400)
commitcf04a3c99d7bae96d3d9625e398bf3a172a1f2d9
tree2468a7055d9cfaa4681e5deb8322f0dd1cb98bf0
parenta92aea4c0e8fc304e24a6cda11221636533c2928
gdk-win32: implement basic inhibit-system-shortcuts

This is largely adapted from commit 83027c68f112 ("11: Implement
inhibit_system_shortcuts API"), with similar rationale:

    To implement the inhibit_system_shortcuts API on X11, we emulate the
    same behavior using grabs on the keyboard.

    To avoid keeping active grabs on the keyboard that would affect
    other X11 applications even when the surface isn't focused, the X11
    implementation takes care of releasing the grabs as soon as the
    toplevel loses focus.

Note that Windows has low-level keyboard hooks that could help achieve
the expected behaviour. This is implemented by spice-gtk & gtk-vnc for
example, but correctness isn't obvious. I left a TODO comment.

This patch helps implementing remote desktop widgets with GTK4, since
currently on win32 backend Alt-Tab and such are always left to the
system unless there is keyboard grab (which can't be requested by the
client API anymore, afaict).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
gdk/win32/gdksurface-win32.c