Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-124720

Implement QWaylandWindow::setKeyboardGrabEnabled() with keyboard-shortcuts-inhibit-unstable-v1

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.6.2
    • QPA: Wayland
    • None
    • Fedora 40

    • Linux/Wayland

    Description

      Quoting keyboard-shortcuts-inhibit-unstable-v1 protocol [1]:

      This protocol specifies a way for a client to request the compositor to ignore its own keyboard shortcuts for a given seat, so that all key events from that seat get forwarded to a surface.

      I think this can be used to implement QWaylandWindow::setKeyboardGrabEnabled(). Compositor wise, this is supported by Mutter (GNOME Shell), KWin (KDE), Sway, and Hyprland [2].

      Reading the protocol wording, there's a caveat that the protocol allows the compositor to pull back the grab as it sees fit, and Qt doesn't seem to have a way to notify this fact to application code. Also, setKeyboardGrabEnabled() is synchronous, but Wayland communication is inherently asynchronous. So unless we want to block the application for the reply, I guess it's possible that setKeyboardGrabEnabled() return true but grabbing doesn't actually happen.

      Still, I think this is strictly better than the current status, where keyboard grabbing is not implemented at all.

      [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/tree/main/unstable/keyboard-shortcuts-inhibit
      [2]: https://wayland.app/protocols/keyboard-shortcuts-inhibit-unstable-v1

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            peat-psuwit Ratchanan Srirattanamet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes