Skip to content

gdk: Add gdk_toplevel_inhibit_system_shortcuts API

Olivier Fourdan requested to merge ofourdan/gtk:issue982 into master

With the removal of grabs from the public API, we need a replacement API to let applications request system keyboard shortcuts to be diverted.

This adds gdk_toplevel_inhibit_system_shortcuts() for this purpose.

Also comes the implementation for Wayland (trivial) and X11. On X11, there is no such equivalent to the inhibit shortcut protocol found on Wayland.

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 when focus is lost.

It also comes with a small test to try the implementations.

Edited by Olivier Fourdan

Merge request reports