Rename tabletToolId to toolId

"tablet" is generally redundant.
wilder/Plasma/6.3
Vlad Zahorodnii 1 year ago
parent 9c16400d1c
commit a61a6847e1
  1. 4
      src/core/inputdevice.h
  2. 2
      src/effect/effect.cpp
  3. 4
      src/effect/effect.h
  4. 4
      src/effect/effecthandler.cpp
  5. 2
      src/effect/effecthandler.h
  6. 10
      src/input.cpp
  7. 4
      src/input_event.h
  8. 4
      src/plugins/buttonrebinds/buttonrebindsfilter.cpp
  9. 24
      src/tablet_input.cpp
  10. 4
      src/tablet_input.h

@ -77,8 +77,8 @@ Q_SIGNALS:
void tabletToolEvent(InputRedirection::TabletEventType type, const QPointF &pos,
qreal pressure, int xTilt, int yTilt, qreal rotation, bool tipDown,
bool tipNear, const TabletToolId &tabletToolId, std::chrono::microseconds time, InputDevice *device);
void tabletToolButtonEvent(uint button, bool isPressed, const TabletToolId &tabletToolId, std::chrono::microseconds time, InputDevice *device);
bool tipNear, const TabletToolId &toolId, std::chrono::microseconds time, InputDevice *device);
void tabletToolButtonEvent(uint button, bool isPressed, const TabletToolId &toolId, std::chrono::microseconds time, InputDevice *device);
void tabletPadButtonEvent(uint button, bool isPressed, std::chrono::microseconds time, InputDevice *device);
void tabletPadStripEvent(int number, int position, bool isFinger, std::chrono::microseconds time, InputDevice *device);
void tabletPadRingEvent(int number, int position, bool isFinger, std::chrono::microseconds time, InputDevice *device);

@ -486,7 +486,7 @@ bool Effect::tabletToolEvent(QTabletEvent *event)
return false;
}
bool Effect::tabletToolButtonEvent(uint button, bool pressed, quint64 tabletToolId)
bool Effect::tabletToolButtonEvent(uint button, bool pressed, quint64 toolId)
{
return false;
}

@ -808,11 +808,11 @@ public:
*
* @param button which button
* @param pressed true if pressed, false when released
* @param tabletToolId the identifier of the tool id
* @param toolId the identifier of the tool id
*
* @since 5.25
*/
virtual bool tabletToolButtonEvent(uint button, bool pressed, quint64 tabletToolId);
virtual bool tabletToolButtonEvent(uint button, bool pressed, quint64 toolId);
/**
* There has been an event from a button on a drawing tablet pad

@ -571,11 +571,11 @@ bool EffectsHandler::tabletToolEvent(TabletEvent *event)
return false;
}
bool EffectsHandler::tabletToolButtonEvent(uint button, bool pressed, const TabletToolId &tabletToolId, std::chrono::microseconds time)
bool EffectsHandler::tabletToolButtonEvent(uint button, bool pressed, const TabletToolId &toolId, std::chrono::microseconds time)
{
// TODO: reverse call order?
for (auto it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
if (it->second->tabletToolButtonEvent(button, pressed, tabletToolId.m_uniqueId)) {
if (it->second->tabletToolButtonEvent(button, pressed, toolId.m_uniqueId)) {
return true;
}
}

@ -746,7 +746,7 @@ public:
bool touchUp(qint32 id, std::chrono::microseconds time);
bool tabletToolEvent(KWin::TabletEvent *event);
bool tabletToolButtonEvent(uint button, bool pressed, const KWin::TabletToolId &tabletToolId, std::chrono::microseconds time);
bool tabletToolButtonEvent(uint button, bool pressed, const KWin::TabletToolId &toolId, std::chrono::microseconds time);
bool tabletPadButtonEvent(uint button, bool pressed, std::chrono::microseconds time, InputDevice *device);
bool tabletPadStripEvent(int number, int position, bool isFinger, std::chrono::microseconds time, InputDevice *device);
bool tabletPadRingEvent(int number, int position, bool isFinger, std::chrono::microseconds time, InputDevice *device);

@ -577,7 +577,7 @@ public:
if (!effects) {
return false;
}
return effects->tabletToolButtonEvent(event->button, event->pressed, event->tabletToolId, event->time);
return effects->tabletToolButtonEvent(event->button, event->pressed, event->toolId, event->time);
}
bool tabletPadButtonEvent(TabletPadButtonEvent *event) override
{
@ -1336,7 +1336,7 @@ public:
QWindow *internal = static_cast<InternalWindow *>(input()->tablet()->focus())->handle();
const QPointF globalPos = event->globalPosition();
const QPointF localPos = globalPos - internal->position();
const TabletToolId toolId = event->tabletId();
const TabletToolId toolId = event->toolId();
const int deviceType = int(QPointingDevice::DeviceType::Stylus);
const int pointerType = int(QPointingDevice::PointerType::Pen);
@ -2039,11 +2039,11 @@ public:
return false;
}
TabletToolV2Interface *tool = input()->tablet()->ensureTabletTool(event->tabletId());
TabletToolV2Interface *tool = input()->tablet()->ensureTabletTool(event->toolId());
// 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->tabletId().m_deviceGroupData);
auto tablet = static_cast<TabletV2Interface *>(event->toolId().m_deviceGroupData);
Window *window = input()->findToplevel(event->globalPosF());
if (!window || !window->surface()) {
@ -2132,7 +2132,7 @@ public:
bool tabletToolButtonEvent(TabletToolButtonEvent *event) override
{
TabletToolV2Interface *tool = input()->tablet()->ensureTabletTool(event->tabletToolId);
TabletToolV2Interface *tool = input()->tablet()->ensureTabletTool(event->toolId);
if (!tool->isClientSupported()) {
return false;
}

@ -219,7 +219,7 @@ public:
return m_device;
}
const TabletToolId &tabletId() const
const TabletToolId &toolId() const
{
return m_id;
}
@ -234,7 +234,7 @@ struct TabletToolButtonEvent
InputDevice *device;
uint button;
bool pressed;
TabletToolId tabletToolId;
TabletToolId toolId;
std::chrono::microseconds time;
};

@ -236,8 +236,8 @@ bool ButtonRebindsFilter::tabletToolButtonEvent(KWin::TabletToolButtonEvent *eve
if (RebindScope::isRebinding()) {
return false;
}
m_tabletTool = event->tabletToolId;
return send(TabletToolButtonType, {event->tabletToolId.m_name, event->button}, event->pressed, event->time);
m_tabletTool = event->toolId;
return send(TabletToolButtonType, {event->toolId.m_name, event->button}, event->pressed, event->time);
}
void ButtonRebindsFilter::insert(TriggerType type, const Trigger &trigger, const QStringList &entry)

@ -200,10 +200,10 @@ void TabletInputRedirection::trackNextOutput()
OSD::show(message, QStringLiteral("input-tablet"), 5000);
}
static TabletToolV2Interface::Type getType(const TabletToolId &tabletToolId)
static TabletToolV2Interface::Type getType(const TabletToolId &toolId)
{
using Type = TabletToolV2Interface::Type;
switch (tabletToolId.m_toolType) {
switch (toolId.m_toolType) {
case InputRedirection::Pen:
return Type::Pen;
case InputRedirection::Eraser:
@ -226,10 +226,10 @@ static TabletToolV2Interface::Type getType(const TabletToolId &tabletToolId)
return Type::Pen;
}
TabletToolV2Interface *TabletInputRedirection::ensureTabletTool(const TabletToolId &tabletToolId)
TabletToolV2Interface *TabletInputRedirection::ensureTabletTool(const TabletToolId &toolId)
{
TabletSeatV2Interface *tabletSeat = findTabletSeat();
if (auto tool = tabletSeat->toolByHardwareSerial(tabletToolId.m_serialId, getType(tabletToolId))) {
if (auto tool = tabletSeat->toolByHardwareSerial(toolId.m_serialId, getType(toolId))) {
return tool;
}
@ -251,10 +251,10 @@ TabletToolV2Interface *TabletInputRedirection::ensureTabletTool(const TabletTool
return TabletToolV2Interface::Wheel;
};
QList<TabletToolV2Interface::Capability> ifaceCapabilities;
ifaceCapabilities.resize(tabletToolId.m_capabilities.size());
std::transform(tabletToolId.m_capabilities.constBegin(), tabletToolId.m_capabilities.constEnd(), ifaceCapabilities.begin(), f);
ifaceCapabilities.resize(toolId.m_capabilities.size());
std::transform(toolId.m_capabilities.constBegin(), toolId.m_capabilities.constEnd(), ifaceCapabilities.begin(), f);
TabletToolV2Interface *tool = tabletSeat->addTool(getType(tabletToolId), tabletToolId.m_serialId, tabletToolId.m_uniqueId, ifaceCapabilities, tabletToolId.deviceSysName);
TabletToolV2Interface *tool = tabletSeat->addTool(getType(toolId), toolId.m_serialId, toolId.m_uniqueId, ifaceCapabilities, toolId.deviceSysName);
const auto cursor = new SurfaceCursor(tool);
Cursors::self()->addCursor(cursor);
@ -265,7 +265,7 @@ TabletToolV2Interface *TabletInputRedirection::ensureTabletTool(const TabletTool
void TabletInputRedirection::tabletToolEvent(KWin::InputRedirection::TabletEventType type, const QPointF &pos,
qreal pressure, int xTilt, int yTilt, qreal rotation, bool tipDown,
bool tipNear, const TabletToolId &tabletToolId,
bool tipNear, const TabletToolId &toolId,
std::chrono::microseconds time,
InputDevice *device)
{
@ -288,7 +288,7 @@ void TabletInputRedirection::tabletToolEvent(KWin::InputRedirection::TabletEvent
break;
}
auto tool = ensureTabletTool(tabletToolId);
auto tool = ensureTabletTool(toolId);
switch (t) {
case QEvent::TabletEnterProximity:
case QEvent::TabletPress:
@ -311,7 +311,7 @@ void TabletInputRedirection::tabletToolEvent(KWin::InputRedirection::TabletEvent
0, // tangentialPressure
rotation,
0, // z
Qt::NoModifier, button, button, tabletToolId, device);
Qt::NoModifier, button, button, toolId, device);
ev.setTimestamp(std::chrono::duration_cast<std::chrono::milliseconds>(time).count());
input()->processSpies(std::bind(&InputEventSpy::tabletToolEvent, std::placeholders::_1, &ev));
@ -322,13 +322,13 @@ void TabletInputRedirection::tabletToolEvent(KWin::InputRedirection::TabletEvent
m_tipNear = tipNear;
}
void KWin::TabletInputRedirection::tabletToolButtonEvent(uint button, bool isPressed, const TabletToolId &tabletToolId, std::chrono::microseconds time, InputDevice *device)
void KWin::TabletInputRedirection::tabletToolButtonEvent(uint button, bool isPressed, const TabletToolId &toolId, std::chrono::microseconds time, InputDevice *device)
{
TabletToolButtonEvent event{
.device = device,
.button = button,
.pressed = isPressed,
.tabletToolId = tabletToolId,
.toolId = toolId,
.time = time,
};

@ -44,10 +44,10 @@ public:
void tabletToolEvent(KWin::InputRedirection::TabletEventType type, const QPointF &pos,
qreal pressure, int xTilt, int yTilt, qreal rotation, bool tipDown,
bool tipNear, const TabletToolId &tabletToolId,
bool tipNear, const TabletToolId &toolId,
std::chrono::microseconds time,
InputDevice *device);
void tabletToolButtonEvent(uint button, bool isPressed, const TabletToolId &tabletToolId, std::chrono::microseconds time, InputDevice *device);
void tabletToolButtonEvent(uint button, bool isPressed, const TabletToolId &toolId, std::chrono::microseconds time, InputDevice *device);
void tabletPadButtonEvent(uint button, bool isPressed, std::chrono::microseconds time, InputDevice *device);
void tabletPadStripEvent(int number, int position, bool isFinger, std::chrono::microseconds time, InputDevice *device);
void tabletPadRingEvent(int number, int position, bool isFinger, std::chrono::microseconds time, InputDevice *device);

Loading…
Cancel
Save