From 4de344decf7db4d7703575a78d6013a5c776bf1e Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 13 Dec 2018 22:04:18 +0100 Subject: 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 --- src/client/qwaylandinputdevice_p.h | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/client/qwaylandinputdevice_p.h') 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 #if QT_CONFIG(xkbcommon) -#include -#include +#include #endif #include @@ -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 -- cgit v1.2.1