Lookup TabletV2Interface by sysname

This gets rid of some libinput specific logic and makes the code more
generic.
wilder/Plasma/6.3
Vlad Zahorodnii 1 year ago
parent 55960e17c4
commit 0698691856
  1. 2
      src/backends/libinput/connection.cpp
  2. 6
      src/backends/libinput/device.cpp
  3. 2
      src/backends/libinput/device.h
  4. 3
      src/input.cpp
  5. 1
      src/input_event.h
  6. 6
      src/wayland/tablet_v2.cpp
  7. 1
      src/wayland/tablet_v2.h

@ -245,7 +245,7 @@ KWin::TabletToolId createTabletId(libinput_tablet_tool *tool, Device *dev)
if (libinput_tablet_tool_has_wheel(tool)) {
capabilities << InputRedirection::Wheel;
}
return {dev->sysName(), toolType, capabilities, serial, toolId, dev->groupUserData(), dev->name()};
return {dev->sysName(), toolType, capabilities, serial, toolId, dev->name()};
}
void Connection::processEvents()

@ -542,12 +542,6 @@ int Device::ringsCount() const
return libinput_device_tablet_pad_get_num_rings(m_device);
}
void *Device::groupUserData() const
{
auto deviceGroup = libinput_device_get_device_group(m_device);
return libinput_device_group_get_user_data(deviceGroup);
}
#define CONFIG(method, condition, function, variable, key) \
void Device::method(bool set) \
{ \

@ -632,8 +632,6 @@ public:
int stripsCount() const;
int ringsCount() const;
void *groupUserData() const;
Output *output() const;
void setOutput(Output *output);

@ -2043,7 +2043,8 @@ public:
// NOTE: tablet will be nullptr as the device is removed (see ::removeDevice) but events from the tool
// may still happen (e.g. Release or ProximityOut events)
auto tablet = static_cast<TabletV2Interface *>(event->toolId().m_deviceGroupData);
TabletSeatV2Interface *seat = waylandServer()->tabletManagerV2()->seat(waylandServer()->seat());
auto tablet = seat->tabletByName(event->device()->sysName());
Window *window = input()->findToplevel(event->globalPosF());
if (!window || !window->surface()) {

@ -202,7 +202,6 @@ public:
QList<InputRedirection::Capability> m_capabilities;
quint64 m_serialId;
quint64 m_uniqueId;
void *m_deviceGroupData;
QString m_name;
};

@ -918,6 +918,12 @@ TabletToolV2Interface *TabletSeatV2Interface::toolByHardwareSerial(quint64 hardw
return nullptr;
}
TabletV2Interface *TabletSeatV2Interface::tabletByName(const QString &name) const
{
Q_ASSERT(d->m_tablets.contains(name));
return d->m_tablets.value(name);
}
TabletPadV2Interface *TabletSeatV2Interface::padByName(const QString &name) const
{
Q_ASSERT(d->m_pads.contains(name));

@ -290,6 +290,7 @@ public:
TabletToolV2Interface *toolByHardwareId(quint64 hardwareId) const;
TabletToolV2Interface *toolByHardwareSerial(quint64 hardwareSerial, TabletToolV2Interface::Type type) const;
TabletV2Interface *tabletByName(const QString &sysname) const;
TabletPadV2Interface *padByName(const QString &sysname) const;
void removeDevice(const QString &sysname);

Loading…
Cancel
Save