1
0
forked from pool/libqt5-qtbase
libqt5-qtbase/Fix-shortcuts-with-keypad-keys.patch
Dominique Leuenberger fc9008bb2f Accepting request 307824 from KDE:Qt5
- Added patches from upstream:
  Try-to-ensure-that-fPIC-is-used-in-CMake-builds.patch,
  Require-fPIC-instead-of-just-fPIE-for-reduce-relocations.patch
  and Make-qglobal.h-complain-if-you-use-fPIE.patch
  (qtbug#45755)

- Add Fix-shortcuts-with-keypad-keys.patch
  (qtbug#20191,qtbug#33093,kde#344638)

OBS-URL: https://build.opensuse.org/request/show/307824
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=41
2015-05-19 21:22:17 +00:00

94 lines
4.1 KiB
Diff

From c137502c7fd7550c780c9531ec414098d8101757 Mon Sep 17 00:00:00 2001
From: Alexander Volkov <a.volkov@rusbitech.ru>
Date: Thu, 18 Sep 2014 16:16:26 +0400
Subject: Fix shortcuts with keypad keys
The way of searching a shortcut match for a key without the keypad
modifier introduced in 547a1bea492954d828aa0798be93384669812489 is
not correct. QKeyEvent::setModifiers() doesn't change native scan code
so we get the incorrect QKeyEvent object which is eventually passed to
the implementation of QPlatformIntegration::possibleKeys().
And then QPlatformIntegration::possibleKeys() returns the same result
as for the original QKeyEvent object.
So to fix it we have to remove Qt::KeypadModifier from keys after
calling the implementation of QPlatformIntegration::possibleKeys(),
as it was before 547a1bea492954d828aa0798be93384669812489.
Task-number: QTBUG-33093
Task-number: QTBUG-20191
Change-Id: I5b33c9b6cf2c06b133166a31eba9aff9181c9483
---
src/gui/kernel/qshortcutmap.cpp | 12 +++++-------
src/gui/kernel/qshortcutmap_p.h | 4 ++--
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index cad707a..83377af 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -380,9 +380,7 @@ QKeySequence::SequenceMatch QShortcutMap::nextState(QKeyEvent *e)
result = find(e);
if (result == QKeySequence::NoMatch && (e->modifiers() & Qt::KeypadModifier)) {
// Try to find a match without keypad modifier
- QKeyEvent event = *e;
- event.setModifiers(e->modifiers() & ~Qt::KeypadModifier);
- result = find(&event);
+ result = find(e, Qt::KeypadModifier);
}
if (result == QKeySequence::NoMatch && e->modifiers() & Qt::ShiftModifier) {
// If Shift + Key_Backtab, also try Shift + Qt::Key_Tab
@@ -435,13 +433,13 @@ bool QShortcutMap::hasShortcutForKeySequence(const QKeySequence &seq) const
which can be access through matches().
\sa matches
*/
-QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e)
+QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifiers)
{
Q_D(QShortcutMap);
if (!d->sequences.count())
return QKeySequence::NoMatch;
- createNewSequences(e, d->newEntries);
+ createNewSequences(e, d->newEntries, ignoredModifiers);
#if defined(DEBUG_QSHORTCUTMAP)
qDebug() << "Possible shortcut key sequences:" << d->newEntries;
#endif
@@ -543,7 +541,7 @@ void QShortcutMap::clearSequence(QVector<QKeySequence> &ksl)
Alters \a seq to the new sequence state, based on the
current sequence state, and the new key event \a e.
*/
-void QShortcutMap::createNewSequences(QKeyEvent *e, QVector<QKeySequence> &ksl)
+void QShortcutMap::createNewSequences(QKeyEvent *e, QVector<QKeySequence> &ksl, int ignoredModifiers)
{
Q_D(QShortcutMap);
QList<int> possibleKeys = QKeyMapper::possibleKeys(e);
@@ -573,7 +571,7 @@ void QShortcutMap::createNewSequences(QKeyEvent *e, QVector<QKeySequence> &ksl)
curKsl.setKey(0, 2);
curKsl.setKey(0, 3);
}
- curKsl.setKey(possibleKeys.at(pkNum), index);
+ curKsl.setKey(possibleKeys.at(pkNum) & ~ignoredModifiers, index);
}
}
}
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index b2e0945..d4a0021 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_p.h
@@ -88,10 +88,10 @@ private:
QKeySequence::SequenceMatch state();
void dispatchEvent(QKeyEvent *e);
- QKeySequence::SequenceMatch find(QKeyEvent *e);
+ QKeySequence::SequenceMatch find(QKeyEvent *e, int ignoredModifiers = 0);
QKeySequence::SequenceMatch matches(const QKeySequence &seq1, const QKeySequence &seq2) const;
QVector<const QShortcutEntry *> matches() const;
- void createNewSequences(QKeyEvent *e, QVector<QKeySequence> &ksl);
+ void createNewSequences(QKeyEvent *e, QVector<QKeySequence> &ksl, int ignoredModifiers);
void clearSequence(QVector<QKeySequence> &ksl);
int translateModifiers(Qt::KeyboardModifiers modifiers);
--
cgit v0.11.0