Expose input device group on DBus
This is useful to combine tablet pen and pad devices into one logical device
This commit is contained in:
parent
e0202c7531
commit
32c696b45e
2 changed files with 11 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
#include "mousebuttons.h"
|
||||
#include "pointer_input.h"
|
||||
|
||||
#include <QCryptographicHash>
|
||||
#include <QDBusArgument>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMetaType>
|
||||
|
@ -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<QMatrix4x4>();
|
||||
|
||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/KWin/InputDevice/") + m_sysName,
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue