[wayland] Send QKeyEvent to internal windows
Allows to navigate in e.g. Useractions menu.
This commit is contained in:
parent
cd0e905248
commit
afd76b80ee
1 changed files with 12 additions and 1 deletions
13
input.cpp
13
input.cpp
|
@ -849,12 +849,16 @@ void InputRedirection::processKeyboardKey(uint32_t key, InputRedirection::Keyboa
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (effects && static_cast< EffectsHandlerImpl* >(effects)->hasKeyboardGrab()) {
|
auto toKeyEvent = [&] {
|
||||||
const xkb_keysym_t keysym = m_xkb->toKeysym(key);
|
const xkb_keysym_t keysym = m_xkb->toKeysym(key);
|
||||||
// TODO: start auto-repeat
|
// TODO: start auto-repeat
|
||||||
// TODO: add modifiers to the event
|
// TODO: add modifiers to the event
|
||||||
const QEvent::Type type = (state == KeyboardKeyPressed) ? QEvent::KeyPress : QEvent::KeyRelease;
|
const QEvent::Type type = (state == KeyboardKeyPressed) ? QEvent::KeyPress : QEvent::KeyRelease;
|
||||||
QKeyEvent event(type, m_xkb->toQtKey(keysym), m_xkb->modifiers(), m_xkb->toString(keysym));
|
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);
|
static_cast< EffectsHandlerImpl* >(effects)->grabbedKeyboardEvent(&event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -867,6 +871,13 @@ void InputRedirection::processKeyboardKey(uint32_t key, InputRedirection::Keyboa
|
||||||
}
|
}
|
||||||
return;
|
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
|
// process global shortcuts
|
||||||
if (state == KeyboardKeyPressed) {
|
if (state == KeyboardKeyPressed) {
|
||||||
|
|
Loading…
Reference in a new issue