summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2014-12-09 13:58:24 +0100
committerJørgen Lind <jorgen.lind@theqtcompany.com>2014-12-15 12:22:34 +0100
commitc3f619069a41f33dcd36a215807c85904ab6c5d2 (patch)
treedf08770d5b8071f94038b6fb2b01fa238930d8ec /src/gui/kernel
parentc514572f0914a4c4df6d763eea0fc9901f9b7c80 (diff)
Unbreak shortcut handling on embedded
It went completely broken after the fix for QTBUG-32928. The crash fix I made afterwards forgot to take into account that the shortcuts must still be handled, even when the window in the input event is null. So instead of bailing out on a null tlw, we have to use the window that currently has the focus. Task-number: QTBUG-43203 Change-Id: I6cd65ee5bd021f80d9440cba8bc9dfda9abe2cfd Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 236f970c78..a564f507d8 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -201,6 +201,11 @@ bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, ulong timestamp,
#ifndef QT_NO_SHORTCUT
QGuiApplicationPrivate::modifier_buttons = mods;
+ if (!w)
+ w = QGuiApplication::focusWindow();
+ if (!w)
+ return false;
+
QObject *focus = w->focusObject();
if (!focus)
focus = w;
@@ -287,8 +292,8 @@ 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)
{
- if (t == QEvent::KeyPress && tlw && QWindowSystemInterface::tryHandleShortcutEvent(tlw, timestamp, k, mods, text))
- return;
+ if (t == QEvent::KeyPress && QWindowSystemInterface::tryHandleShortcutEvent(tlw, timestamp, k, mods, text))
+ return;
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count);
@@ -314,8 +319,8 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestam
ushort count, bool tryShortcutOverride)
{
// on OS X we try the shortcut override even earlier and thus shouldn't handle it here
- if (tryShortcutOverride && tlw && type == QEvent::KeyPress && QWindowSystemInterface::tryHandleShortcutEvent(tlw, timestamp, key, modifiers, text))
- return;
+ if (tryShortcutOverride && type == QEvent::KeyPress && QWindowSystemInterface::tryHandleShortcutEvent(tlw, timestamp, key, modifiers, text))
+ return;
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers,