diff options
author | Gatis Paeglis <gatis.paeglis@qt.io> | 2018-12-13 22:04:18 +0100 |
---|---|---|
committer | Gatis Paeglis <gatis.paeglis@qt.io> | 2019-04-15 14:10:34 +0000 |
commit | 4de344decf7db4d7703575a78d6013a5c776bf1e (patch) | |
tree | 0ca5b0667c6f7e182b79c674a7f49486a0a51f8b /src/client/qwaylandinputdevice_p.h | |
parent | 3aedd01271dc4f4a13103d632df224971ab2b6df (diff) | |
download | qtwayland-4de344decf7db4d7703575a78d6013a5c776bf1e.tar.gz |
client: rework xkb context/keymap/state handling
- Use smart pointers from xkbcommon_support-private.
- Remove needless strdup() calls.
- Don't recreate context. And move it into qwaylanddisplay so it can
be shared in future between several keyboards. It contains things like
a logging level and include paths.
Change-Id: I5d1f667e710046e6b62aa2caf82fdb2decc24520
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/client/qwaylandinputdevice_p.h')
-rw-r--r-- | src/client/qwaylandinputdevice_p.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index 4149e500..98e60286 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -65,8 +65,7 @@ #include <QtWaylandClient/private/qwayland-wayland.h> #if QT_CONFIG(xkbcommon) -#include <xkbcommon/xkbcommon.h> -#include <xkbcommon/xkbcommon-keysyms.h> +#include <QtXkbCommonSupport/private/qxkbcommon_p.h> #endif #include <QtCore/QDebug> @@ -209,11 +208,7 @@ public: QWaylandInputDevice *mParent = nullptr; ::wl_surface *mFocus = nullptr; -#if QT_CONFIG(xkbcommon) - xkb_context *mXkbContext = nullptr; - xkb_keymap *mXkbMap = nullptr; - xkb_state *mXkbState = nullptr; -#endif + uint32_t mNativeModifiers = 0; int mRepeatKey; @@ -222,9 +217,6 @@ public: int mRepeatRate = 25; int mRepeatDelay = 400; QString mRepeatText; -#if QT_CONFIG(xkbcommon) - xkb_keysym_t mRepeatSym; -#endif QTimer mRepeatTimer; Qt::KeyboardModifiers modifiers() const; @@ -236,12 +228,17 @@ private slots: private: #if QT_CONFIG(xkbcommon) - bool createDefaultKeyMap(); - void releaseKeyMap(); + bool createDefaultKeymap(); #endif void sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text = QString(), bool autorep = false, ushort count = 1); + +#if QT_CONFIG(xkbcommon) + xkb_keysym_t mRepeatSym = XKB_KEY_NoSymbol; + QXkbCommon::ScopedXKBKeymap mXkbKeymap; + QXkbCommon::ScopedXKBState mXkbState; +#endif }; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QObject, public QtWayland::wl_pointer |