diff --git a/src/backends/libinput/device.cpp b/src/backends/libinput/device.cpp index 02e84003c4..905d4d2ce9 100644 --- a/src/backends/libinput/device.cpp +++ b/src/backends/libinput/device.cpp @@ -17,6 +17,7 @@ #include "mousebuttons.h" #include "pointer_input.h" +#include #include #include #include @@ -360,6 +361,9 @@ Device::Device(libinput_device *device, QObject *parent) m_calibrationMatrix = m_defaultCalibrationMatrix; } + libinput_device_group *group = libinput_device_get_device_group(device); + m_deviceGroupId = QCryptographicHash::hash(QString::asprintf("%p", group).toLatin1(), QCryptographicHash::Sha1).toBase64(); + qDBusRegisterMetaType(); QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/KWin/InputDevice/") + m_sysName, diff --git a/src/backends/libinput/device.h b/src/backends/libinput/device.h index f9937a29e9..c5a309538a 100644 --- a/src/backends/libinput/device.h +++ b/src/backends/libinput/device.h @@ -143,6 +143,7 @@ class KWIN_EXPORT Device : public InputDevice Q_PROPERTY(QRectF outputArea READ outputArea WRITE setOutputArea NOTIFY outputAreaChanged) Q_PROPERTY(bool defaultMapToWorkspace READ defaultMapToWorkspace CONSTANT) Q_PROPERTY(bool mapToWorkspace READ isMapToWorkspace WRITE setMapToWorkspace NOTIFY mapToWorkspaceChanged) + Q_PROPERTY(QString deviceGroupId READ deviceGroupId CONSTANT) public: explicit Device(libinput_device *device, QObject *parent = nullptr); @@ -645,6 +646,11 @@ public: void setMapToWorkspace(bool mapToWorkspace); + QString deviceGroupId() const + { + return m_deviceGroupId; + } + /** * Gets the Device for @p native. @c null if there is no Device for @p native. */ @@ -759,6 +765,7 @@ private: LEDs m_leds; QRectF m_outputArea = QRectF(0, 0, 1, 1); bool m_mapToWorkspace = false; + QString m_deviceGroupId; }; }