[wayland] Send QKeyEvent to internal windows

Allows to navigate in e.g. Useractions menu.
This commit is contained in:
Martin Gräßlin 2015-08-20 09:03:38 +02:00
parent cd0e905248
commit afd76b80ee

View file

@ -849,12 +849,16 @@ void InputRedirection::processKeyboardKey(uint32_t key, InputRedirection::Keyboa
return;
}
#endif
if (effects && static_cast< EffectsHandlerImpl* >(effects)->hasKeyboardGrab()) {
auto toKeyEvent = [&] {
const xkb_keysym_t keysym = m_xkb->toKeysym(key);
// TODO: start auto-repeat
// TODO: add modifiers to the event
const QEvent::Type type = (state == KeyboardKeyPressed) ? QEvent::KeyPress : QEvent::KeyRelease;
QKeyEvent event(type, m_xkb->toQtKey(keysym), m_xkb->modifiers(), m_xkb->toString(keysym));
return event;
};
if (effects && static_cast< EffectsHandlerImpl* >(effects)->hasKeyboardGrab()) {
QKeyEvent event = toKeyEvent();
static_cast< EffectsHandlerImpl* >(effects)->grabbedKeyboardEvent(&event);
return;
}
@ -867,6 +871,13 @@ void InputRedirection::processKeyboardKey(uint32_t key, InputRedirection::Keyboa
}
return;
}
// TODO: Maybe it's better to select the top most visible internal window?
if (m_pointerInternalWindow) {
QKeyEvent event = toKeyEvent();
event.setAccepted(false);
QCoreApplication::sendEvent(m_pointerInternalWindow.data(), &event);
return;
}
}
// process global shortcuts
if (state == KeyboardKeyPressed) {