summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindowsysteminterface.cpp
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@theqtcompany.com>2015-02-27 16:32:33 +0100
committerChristian Stromme <christian.stromme@theqtcompany.com>2015-03-05 08:15:15 +0000
commit7f5b94b473cd19217127a69c0b8995e00b023173 (patch)
tree4fc26a47f9e46136ced6ab589fadc9b35443e023 /src/gui/kernel/qwindowsysteminterface.cpp
parent212285639d748c7def8648f89b8c1c21c5f481e6 (diff)
Fix shortcut overriding.
Moved to processKeyEvents() on all platforms except OS X. Previously QWindowSystemInterface::tryHandleShortcutEvent() was called from inside QWindowSystemInterface, this is considered unsafe as it ends up calling sendEvent(). On some platforms the call might come from a different thread then the receiver and cause an assert. Task-number: QTBUG-44712 Change-Id: Ie80c698f63b9c3d9f52aa94380e539a84caea912 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'src/gui/kernel/qwindowsysteminterface.cpp')
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 9a2fb33bbc..73b1a84005 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -292,8 +292,13 @@ void QWindowSystemInterface::handleKeyEvent(QWindow *w, QEvent::Type t, int k, Q
void QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
{
+ // This is special handling needed for OS X which eventually will call sendEvent(), on other platforms
+ // this might not be safe, e.g., on Android. See: QGuiApplicationPrivate::processKeyEvent() for
+ // shortcut overriding on other platforms.
+#if defined(Q_OS_OSX)
if (t == QEvent::KeyPress && QWindowSystemInterface::tryHandleShortcutEvent(tlw, timestamp, k, mods, text))
return;
+#endif // Q_OS_OSX
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count);
@@ -318,10 +323,7 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestam
const QString& text, bool autorep,
ushort count, bool tryShortcutOverride)
{
- // on OS X we try the shortcut override even earlier and thus shouldn't handle it here
- if (tryShortcutOverride && type == QEvent::KeyPress && QWindowSystemInterface::tryHandleShortcutEvent(tlw, timestamp, key, modifiers, text))
- return;
-
+ Q_UNUSED(tryShortcutOverride)
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers,
nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);