Warning, /graphics/krita/3rdparty/ext_qt/0101-Don-t-eat-ShortcutOverride-events-when-there-is-a-pa.patch is written in an unsupported language. File is not indexed.
0001 From b804ed1c3c5c6b2e43ae186ef307f6a026db3cfb Mon Sep 17 00:00:00 2001 0002 From: Dmitry Kazakov <dimula73@gmail.com> 0003 Date: Mon, 29 Jun 2020 23:41:13 +0300 0004 Subject: [PATCH 26/47] Don't eat ShortcutOverride events when there is a 0005 partial-match 0006 0007 Some applications (e.g. Krita) may have its own shortcuts system. That 0008 is, it should always get ShortcutOverride events, even when they are 0009 matched to something inside Qt. 0010 0011 If the application (Krita) accepts the event, then all the partially 0012 matched shortcuts should reset. 0013 0014 See this bug for more details: 0015 https://bugs.kde.org/show_bug.cgi?id=409613 0016 --- 0017 src/gui/kernel/qshortcutmap_p.h | 4 +++- 0018 src/gui/kernel/qwindowsysteminterface.cpp | 10 ++++++++-- 0019 2 files changed, 11 insertions(+), 3 deletions(-) 0020 0021 diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h 0022 index 8fc68229fb..91191288d3 100644 0023 --- a/src/gui/kernel/qshortcutmap_p.h 0024 +++ b/src/gui/kernel/qshortcutmap_p.h 0025 @@ -91,8 +91,10 @@ public: 0026 void dumpMap() const; 0027 #endif 0028 0029 -private: 0030 void resetState(); 0031 + 0032 +private: 0033 + 0034 QKeySequence::SequenceMatch nextState(QKeyEvent *e); 0035 void dispatchEvent(QKeyEvent *e); 0036 0037 diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp 0038 index 62f309a1da..5caf4802a0 100644 0039 --- a/src/gui/kernel/qwindowsysteminterface.cpp 0040 +++ b/src/gui/kernel/qwindowsysteminterface.cpp 0041 @@ -440,7 +440,8 @@ bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestam 0042 window = QGuiApplication::focusWindow(); 0043 0044 QShortcutMap &shortcutMap = QGuiApplicationPrivate::instance()->shortcutMap; 0045 - if (shortcutMap.state() == QKeySequence::NoMatch) { 0046 + if (shortcutMap.state() != QKeySequence::ExactMatch) { 0047 + 0048 // Check if the shortcut is overridden by some object in the event delivery path (typically the focus object). 0049 // If so, we should not look up the shortcut in the shortcut map, but instead deliver the event as a regular 0050 // key event, so that the target that accepted the shortcut override event can handle it. Note that we only 0051 @@ -450,8 +451,13 @@ bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestam 0052 QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorepeat, count); 0053 0054 { 0055 - if (QWindowSystemInterfacePrivate::handleWindowSystemEvent<SynchronousDelivery>(shortcutOverrideEvent)) 0056 + if (QWindowSystemInterfacePrivate::handleWindowSystemEvent<SynchronousDelivery>(shortcutOverrideEvent)) { 0057 + if (shortcutMap.state() != QKeySequence::NoMatch) { 0058 + shortcutMap.resetState(); 0059 + } 0060 + 0061 return false; 0062 + } 0063 } 0064 } 0065 0066 -- 0067 2.20.1.windows.1 0068