summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-01-26 08:35:40 +0100
committerLiang Qi <liang.qi@qt.io>2019-01-26 08:35:40 +0100
commit980567b3a32b2e2f00c86f2d627cd82b5230dd0f (patch)
treebc8cc4005b2e07cbc5cad8ba30f8c9fa4f236c3d /src/platformsupport
parente81acde7d0cf5fb44a3fb2cf0bf7aaa2c65f807e (diff)
parent730cbad8824bcfcb7ab60371a6563cfb6dd5658d (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts: src/android/templates/AndroidManifest.xml tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp Change-Id: I4c9679e3a8ebba118fbf4772301ff8fde60455b9
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp11
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h3
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp6
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h1
4 files changed, 20 insertions, 1 deletions
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
index b21d5d9ef5..ad134a825f 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
@@ -76,7 +76,7 @@ void QFdContainer::reset() Q_DECL_NOTHROW
QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, QFdContainer &fd, bool disableZap, bool enableCompose, const QString &keymapFile)
: m_device(device), m_fd(fd.release()), m_notify(nullptr),
m_modifiers(0), m_composing(0), m_dead_unicode(0xffff),
- m_no_zap(disableZap), m_do_compose(enableCompose),
+ m_langLock(0), m_no_zap(disableZap), m_do_compose(enableCompose),
m_keymap(0), m_keymap_size(0), m_keycompose(0), m_keycompose_size(0)
{
qCDebug(qLcEvdevKey) << "Create keyboard handler with for device" << device;
@@ -253,6 +253,8 @@ QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint
quint8 testmods = m_modifiers;
if (m_locks[0] /*CapsLock*/ && (m->flags & QEvdevKeyboardMap::IsLetter))
testmods ^= QEvdevKeyboardMap::ModShift;
+ if (m_langLock)
+ testmods ^= QEvdevKeyboardMap::ModAltGr;
if (m->modifiers == testmods)
map_withmod = m;
}
@@ -509,6 +511,8 @@ void QEvdevKeyboardHandler::unloadKeymap()
m_locks[2] = 1;
qCDebug(qLcEvdevKey, "numlock=%d , capslock=%d, scrolllock=%d", m_locks[1], m_locks[0], m_locks[2]);
}
+
+ m_langLock = 0;
}
bool QEvdevKeyboardHandler::loadKeymap(const QString &file)
@@ -570,4 +574,9 @@ bool QEvdevKeyboardHandler::loadKeymap(const QString &file)
return true;
}
+void QEvdevKeyboardHandler::switchLang()
+{
+ m_langLock ^= 1;
+}
+
QT_END_NAMESPACE
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
index c5821ae3ac..21e6d055a0 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
@@ -192,6 +192,8 @@ public:
void readKeycode();
KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat);
+ void switchLang();
+
private:
void processKeyEvent(int nativecode, int unicode, int qtcode,
Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat);
@@ -206,6 +208,7 @@ private:
quint8 m_locks[3];
int m_composing;
quint16 m_dead_unicode;
+ quint8 m_langLock;
bool m_no_zap;
bool m_do_compose;
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
index 85e6a80879..e1659bc0d9 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
@@ -153,4 +153,10 @@ void QEvdevKeyboardManager::loadKeymap(const QString &file)
}
}
+void QEvdevKeyboardManager::switchLang()
+{
+ foreach (QEvdevKeyboardHandler *handler, m_keyboards)
+ handler->switchLang();
+}
+
QT_END_NAMESPACE
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h
index 27ea7e468e..326e438a7c 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h
@@ -68,6 +68,7 @@ public:
~QEvdevKeyboardManager();
void loadKeymap(const QString &file);
+ void switchLang();
void addKeyboard(const QString &deviceNode = QString());
void removeKeyboard(const QString &deviceNode);