diff options
author | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2016-01-26 13:28:37 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2016-01-28 16:30:26 +0000 |
commit | ee9621b9dc6cab96df627aa7b926e6256ea2102a (patch) | |
tree | a8c739bb53d53e68c4cd44cd6c5dd1e471d8b508 | |
parent | 33bdb93ae1b1a19eb46d924a31a58237850fbfa4 (diff) |
Move shortcut handling back into QGuiApplication
c7e5e1d9e01849 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>
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 9 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 6 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index b8c7bbba0a..a19abccb37 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -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); diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index d17a1f1d5b..a9dcb8bb7d 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -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, |