Commit 0744ee09 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

libinput: Include the Pad name in the TabletPadId

It's helpful to identify what pad we are referring to in a cross-session
way where a pointer won't hold.
parent 6b4fecca
......@@ -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<TabletPadButtonEvent *>(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:
......
......@@ -196,6 +196,7 @@ public:
class TabletPadId
{
public:
const QString name;
void *data;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment