diff --git a/src/backends/libinput/connection.cpp b/src/backends/libinput/connection.cpp index c970eee937..1734f85fc0 100644 --- a/src/backends/libinput/connection.cpp +++ b/src/backends/libinput/connection.cpp @@ -251,6 +251,18 @@ KWin::TabletToolId createTabletId(libinput_tablet_tool *tool, void *userData) return {toolType, capabilities, serial, toolId, userData}; } +static TabletPadId createTabletPadId(LibInput::Device *device) +{ + if (!device || !device->groupUserData()) { + return {}; + } + + return { + device->name(), + device->groupUserData(), + }; +} + void Connection::processEvents() { QMutexLocker locker(&m_mutex); @@ -478,7 +490,7 @@ void Connection::processEvents() auto *tabletEvent = static_cast(event.get()); Q_EMIT event->device()->tabletPadButtonEvent(tabletEvent->buttonId(), tabletEvent->isButtonPressed(), - {event->device()->groupUserData()}, tabletEvent->time()); + createTabletPadId(event->device()), tabletEvent->time()); break; } case LIBINPUT_EVENT_TABLET_PAD_RING: { @@ -487,7 +499,7 @@ void Connection::processEvents() Q_EMIT event->device()->tabletPadRingEvent(tabletEvent->number(), tabletEvent->position(), tabletEvent->source() == LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER, - {event->device()->groupUserData()}, tabletEvent->time()); + createTabletPadId(event->device()), tabletEvent->time()); break; } case LIBINPUT_EVENT_TABLET_PAD_STRIP: { @@ -495,7 +507,7 @@ void Connection::processEvents() Q_EMIT event->device()->tabletPadStripEvent(tabletEvent->number(), tabletEvent->position(), tabletEvent->source() == LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER, - {event->device()->groupUserData()}, tabletEvent->time()); + createTabletPadId(event->device()), tabletEvent->time()); break; } default: diff --git a/src/input_event.h b/src/input_event.h index 7cac99887f..84f6ea3cbf 100644 --- a/src/input_event.h +++ b/src/input_event.h @@ -196,6 +196,7 @@ public: class TabletPadId { public: + const QString name; void *data; };