[wayland] Don't pass keyboard events to Unmanaged windows

The way it was implemented it allowed an X11 unmanaged window to become
a key logger. Basically as soon as there was an unmanaged window it got
all key events. This problem was discovered through the xembed-sni-proxy
which broke key input to all Wayland windows in a Plasma/Wayland session.

With this change Unmanaged windows don't get any key events at all. This
might break some applications as e.g. context menus are using override
redirect windows. A test with Qt applications shows that the menus are
still functional and the events are delivered correctly internally.

If applications show problems with this change, we might need to weaken
the restriction.
This commit is contained in:
Martin Gräßlin 2015-11-11 11:00:59 +01:00
parent ac1dbac8b1
commit 4ebba6e134

View file

@ -868,15 +868,7 @@ void InputRedirection::updateKeyboardWindow()
} }
if (auto seat = findSeat()) { if (auto seat = findSeat()) {
// TODO: this needs better integration // TODO: this needs better integration
// check unmanaged Toplevel *t = workspace()->activeClient();
Toplevel *t = nullptr;
if (!workspace()->unmanagedList().isEmpty()) {
// TODO: better check whether this unmanaged should get the key event
t = workspace()->unmanagedList().first();
}
if (!t) {
t = workspace()->activeClient();
}
if (t && t->surface()) { if (t && t->surface()) {
if (t->surface() != seat->focusedKeyboardSurface()) { if (t->surface() != seat->focusedKeyboardSurface()) {
seat->setFocusedKeyboardSurface(t->surface()); seat->setFocusedKeyboardSurface(t->surface());