Move shortcut handling back into QGuiApplication
c7e5e1d9e0
assumed shortcut handling could be done at the QPA
level, but this fails on async platforms where there are e.g
activation events in the QPA queue and we then try to handle
the shortcut synchronously.
This commit restores the handling to QtGui for non-OS X platforms,
and we should fix OS X by adding callbacks through the IME for
the special case of OS X.
Task-number: QTBUG-50467
Change-Id: I7460184cc60d0319f07771eec487325a17d7e7e7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
parent
33bdb93ae1
commit
ee9621b9dc
@ -1960,6 +1960,15 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
|
||||
window = QGuiApplication::focusWindow();
|
||||
}
|
||||
|
||||
#if !defined(Q_OS_OSX)
|
||||
// FIXME: Include OS X in this code path by passing the key event through
|
||||
// QPlatformInputContext::filterEvent().
|
||||
if (e->keyType == QEvent::KeyPress && window) {
|
||||
QWindowSystemInterface::handleShortcutEvent(window, e->timestamp, e->key, e->modifiers,
|
||||
e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, e->unicode, e->repeat, e->repeatCount);
|
||||
}
|
||||
#endif
|
||||
|
||||
QKeyEvent ev(e->keyType, e->key, e->modifiers,
|
||||
e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers,
|
||||
e->unicode, e->repeat, e->repeatCount);
|
||||
|
@ -249,8 +249,10 @@ bool QWindowSystemInterface::handleKeyEvent(QWindow *w, QEvent::Type t, int k, Q
|
||||
|
||||
bool QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
|
||||
{
|
||||
#if defined(Q_OS_OSX)
|
||||
if (t == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(tlw, timestamp, k, mods, 0, 0, 0, text, autorep, count))
|
||||
return true;
|
||||
#endif
|
||||
|
||||
QWindowSystemInterfacePrivate::KeyEvent * e =
|
||||
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count);
|
||||
@ -275,10 +277,14 @@ bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestam
|
||||
const QString& text, bool autorep,
|
||||
ushort count, bool tryShortcutOverride)
|
||||
{
|
||||
#if defined(Q_OS_OSX)
|
||||
if (tryShortcutOverride && type == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(tlw,
|
||||
timestamp, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count)) {
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(tryShortcutOverride)
|
||||
#endif
|
||||
|
||||
QWindowSystemInterfacePrivate::KeyEvent * e =
|
||||
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers,
|
||||
|
Loading…
Reference in New Issue
Block a user