Important: Please read the Qt Code of Conduct -

Receiving clicks without focus

  • Question: Is it possible in Qt to respond to click events on buttons without moving focus onto the application window?

    Context: I am working on a generic on-screen keyboard for Wayland based window managers in Linux. It is easily to register a virtual input device using Linux's /dev/uinput interface, but the problem is that clicking on a button in the UI moves focus onto the keyboard application's window. This means the key event is routed to the keyboard application instead of the application I am trying to type into.

    Thank you!

  • I was under the impression that transferring focus was entirely up to the compositor. A quick search turned up discussion around on screen keyboards that aren't implemented within the compositor. These threads are a few years old, and don't have a useful answer.

    The signal QWaylandSeat::mouseFocusChange() has arguments for the new and previous holder. QWaylandSeat::setKeyboardFocus() appears to allow transferring keyboard focus. Together they would appear to give an OSK the ability to direct key input to the target window. I have no experience with either.

Log in to reply