On Freitag, 12. Dezember 2014 08:00:45 CEST, Martin Gräßlin wrote:
I'd suggest to do a platform check as on Wayland it cannot work (grab keyboard fails).
You're certainly right in that the guarding is entirely superfluous on wayland, but grabbing still "works". Despite the platform window ::setKeyboardGrabEnabled() returns false for wayland, QWidget simply ignores that and assigns the grabber. What's worse: looking up the Qt code, QWidget only maintains the grabber as static variable, the grabbing state is never re-tested. Eeeewww... this is gonna be more complex, I fear. I wonder whether the grabbing state can actually be tested except by approaching a grab from a sidearm process. In doubt, the only possible hardening would be to continuously - and the only test whether it worked would be to invoke QWindow::setMouseGrabEnabled(bool grab) as well. Stay tuned ;-) Cheers, Thomas