summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-12-11 15:15:56 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-12-12 20:21:15 +0000
commit782eb1a114c0aaa729925899b2061d47f494435f (patch)
tree413e202767925b6a402434de562e98f6df964f0e /src/platformsupport/input/libinput/qlibinputkeyboard.cpp
parent7257862fb2edfab0219d6cd45c83677049404f7d (diff)
Report modifiers correctly in mouse events with evdev and libinput
Task-number: QTBUG-60694 Change-Id: I7b1625e5f31e49cd2ab18a83bbd0f65f9b58088d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/platformsupport/input/libinput/qlibinputkeyboard.cpp')
-rw-r--r--src/platformsupport/input/libinput/qlibinputkeyboard.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
index f14a2e8f04..3722c1ceca 100644
--- a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
+++ b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
@@ -40,6 +40,8 @@
#include "qlibinputkeyboard_p.h"
#include <QtCore/QTextCodec>
#include <QtCore/QLoggingCategory>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qinputdevicemanager_p.h>
#include <qpa/qwindowsysteminterface.h>
#include <libinput.h>
#ifndef QT_NO_XKBCOMMON_EVDEV
@@ -196,6 +198,8 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e)
const xkb_keysym_t sym = xkb_state_key_get_one_sym(m_state, k);
+ // mods here is the modifier state before the event, i.e. not
+ // including the current key in case it is a modifier.
Qt::KeyboardModifiers mods = Qt::NoModifier;
const int qtkey = keysymToQtKey(sym, &mods, text);
@@ -211,6 +215,8 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e)
xkb_state_update_key(m_state, k, pressed ? XKB_KEY_DOWN : XKB_KEY_UP);
+ QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(mods, qtkey);
+
QWindowSystemInterface::handleExtendedKeyEvent(Q_NULLPTR,
pressed ? QEvent::KeyPress : QEvent::KeyRelease,
qtkey, mods, k, sym, mods, text);