Client: Create context menu event when pressing the menu key
Effectively is a copy of the code in XCB. When the menu key is pressed, a context menu event should be generated at the current cursor position. The global position in the event isn't truly global as that doesn't exist in wayland but should match client expectations. Change-Id: Ib814883aba632ca5eec58730846e1762b680467f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
This commit is contained in:
parent
0f2472eb8b
commit
235f8f12fa
@ -1158,7 +1158,18 @@ void QWaylandInputDevice::Keyboard::handleKey(ulong timestamp, QEvent::Type type
|
||||
}
|
||||
|
||||
if (!filtered) {
|
||||
QWindowSystemInterface::handleExtendedKeyEvent(focusWindow()->window(), timestamp, type, key, modifiers,
|
||||
auto window = focusWindow()->window();
|
||||
|
||||
if (type == QEvent::KeyPress && key == Qt::Key_Menu) {
|
||||
auto cursor = window->screen()->handle()->cursor();
|
||||
if (cursor) {
|
||||
const QPoint globalPos = cursor->pos();
|
||||
const QPoint pos = window->mapFromGlobal(globalPos);
|
||||
QWindowSystemInterface::handleContextMenuEvent(window, false, pos, globalPos, modifiers);
|
||||
}
|
||||
}
|
||||
|
||||
QWindowSystemInterface::handleExtendedKeyEvent(window, timestamp, type, key, modifiers,
|
||||
nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorepeat, count);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user