Drop TabletV2Interface::pad()

Maintaining tablet <-> pad one-to-one mapping is not quite accurate.
A tablet can potentially have more than one pad paired with it.

The main motivation behind this change is to decouple tablet pad
registration from tablet tool registration.
wilder/Plasma/6.3
Vlad Zahorodnii 1 year ago
parent 0698691856
commit dd9da24244
  1. 3
      autotests/wayland/server/test_tablet_interface.cpp
  2. 5
      src/input.cpp
  3. 2
      src/tablet_input.cpp
  4. 11
      src/wayland/tablet_v2.cpp
  5. 5
      src/wayland/tablet_v2.h

@ -296,8 +296,7 @@ void TestTabletInterface::testAddPad()
QVERIFY(seatInterface);
QSignalSpy tabletPadSpy(m_tabletSeatClient, &TabletSeat::padAdded);
m_tabletPad =
seatInterface->addPad(QStringLiteral("my tablet pad"), QStringLiteral("tabletpad"), {QStringLiteral("/test/event33")}, 1, 1, 1, 1, 0, m_tablet);
m_tabletPad = seatInterface->addPad(QStringLiteral("my tablet pad"), QStringLiteral("tabletpad"), {QStringLiteral("/test/event33")}, 1, 1, 1, 1, 0);
QVERIFY(m_tabletPad);
QVERIFY(tabletPadSpy.wait() || tabletPadSpy.count() == 1);
QCOMPARE(m_tabletSeatClient->m_pads.count(), 1);

@ -2160,12 +2160,11 @@ public:
return nullptr;
}
SurfaceInterface *surface = window->surface();
auto pad = tablet->pad();
auto pad = seat->padByName(device->sysName());
if (!pad) {
return nullptr;
}
pad->setCurrentSurface(surface, tablet);
pad->setCurrentSurface(window->surface(), tablet);
return pad;
}

@ -146,7 +146,7 @@ void TabletInputRedirection::integrateDevice(InputDevice *inputDevice)
const int modes = libinput_device_tablet_pad_get_num_mode_groups(device->device());
auto firstGroup = libinput_device_tablet_pad_get_mode_group(device->device(), 0);
tabletSeat->addPad(device->sysName(), device->name(), {QString::fromUtf8(devnode)}, buttonsCount, ringsCount, stripsCount, modes, libinput_tablet_pad_mode_group_get_mode(firstGroup), tablet);
tabletSeat->addPad(device->sysName(), device->name(), {QString::fromUtf8(devnode)}, buttonsCount, ringsCount, stripsCount, modes, libinput_tablet_pad_mode_group_get_mode(firstGroup));
}
}

@ -42,7 +42,6 @@ public:
}
TabletV2Interface *const q;
TabletPadV2Interface *m_pad = nullptr;
const uint32_t m_vendorId;
const uint32_t m_productId;
const QString m_name;
@ -68,11 +67,6 @@ bool TabletV2Interface::isSurfaceSupported(SurfaceInterface *surface) const
return d->resourceForSurface(surface);
}
TabletPadV2Interface *TabletV2Interface::pad() const
{
return d->m_pad;
}
class TabletSurfaceCursorV2Private
{
public:
@ -871,8 +865,7 @@ TabletPadV2Interface *TabletSeatV2Interface::addPad(const QString &sysname,
quint32 rings,
quint32 strips,
quint32 modes,
quint32 currentMode,
TabletV2Interface *tablet)
quint32 currentMode)
{
auto iface = new TabletPadV2Interface(paths.at(0), buttons, rings, strips, modes, currentMode, d->m_display, this);
iface->d->m_seat = this;
@ -880,8 +873,6 @@ TabletPadV2Interface *TabletSeatV2Interface::addPad(const QString &sysname,
d->sendPadAdded(r, iface);
}
tablet->d->m_pad = iface;
d->m_pads[sysname] = iface;
return iface;
}

@ -258,8 +258,6 @@ public:
*/
bool isSurfaceSupported(SurfaceInterface *surface) const;
TabletPadV2Interface *pad() const;
private:
friend class TabletSeatV2Interface;
friend class TabletSeatV2InterfacePrivate;
@ -283,8 +281,7 @@ public:
quint32 rings,
quint32 strips,
quint32 modes,
quint32 currentMode,
TabletV2Interface *tablet);
quint32 currentMode);
TabletToolV2Interface *
addTool(TabletToolV2Interface::Type type, quint64 hardwareSerial, quint64 hardwareId, const QList<TabletToolV2Interface::Capability> &capabilities, const QString &deviceSysName);

Loading…
Cancel
Save