Skip to content

gdk-win32: implement basic inhibit-system-shortcuts

Marc-André Lureau requested to merge malureau/gtk:win32-inhibit into main
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).

Merge request reports