From a61a6847e1cb68740377b153021b2674196bf4a4 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 23 Oct 2024 17:21:17 +0300 Subject: [PATCH] Rename tabletToolId to toolId "tablet" is generally redundant. --- src/core/inputdevice.h | 4 ++-- src/effect/effect.cpp | 2 +- src/effect/effect.h | 4 ++-- src/effect/effecthandler.cpp | 4 ++-- src/effect/effecthandler.h | 2 +- src/input.cpp | 10 ++++---- src/input_event.h | 4 ++-- .../buttonrebinds/buttonrebindsfilter.cpp | 4 ++-- src/tablet_input.cpp | 24 +++++++++---------- src/tablet_input.h | 4 ++-- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/core/inputdevice.h b/src/core/inputdevice.h index 4e1a79f6fb..9029d7ef69 100644 --- a/src/core/inputdevice.h +++ b/src/core/inputdevice.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); diff --git a/src/effect/effect.cpp b/src/effect/effect.cpp index 8c2e02afdc..d97fdc3927 100644 --- a/src/effect/effect.cpp +++ b/src/effect/effect.cpp @@ -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; } diff --git a/src/effect/effect.h b/src/effect/effect.h index 27208bc57c..75f24b2945 100644 --- a/src/effect/effect.h +++ b/src/effect/effect.h @@ -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 diff --git a/src/effect/effecthandler.cpp b/src/effect/effecthandler.cpp index 8c2f3a82b2..d113e4c14a 100644 --- a/src/effect/effecthandler.cpp +++ b/src/effect/effecthandler.cpp @@ -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; } } diff --git a/src/effect/effecthandler.h b/src/effect/effecthandler.h index a5af094296..1a87ce2b2b 100644 --- a/src/effect/effecthandler.h +++ b/src/effect/effecthandler.h @@ -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); diff --git a/src/input.cpp b/src/input.cpp index eacb34d162..85c48dcb0a 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -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(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(event->tabletId().m_deviceGroupData); + auto tablet = static_cast(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; } diff --git a/src/input_event.h b/src/input_event.h index 868df9af7f..f3278dcc51 100644 --- a/src/input_event.h +++ b/src/input_event.h @@ -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; }; diff --git a/src/plugins/buttonrebinds/buttonrebindsfilter.cpp b/src/plugins/buttonrebinds/buttonrebindsfilter.cpp index b095c295aa..a531abfa0a 100644 --- a/src/plugins/buttonrebinds/buttonrebindsfilter.cpp +++ b/src/plugins/buttonrebinds/buttonrebindsfilter.cpp @@ -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) diff --git a/src/tablet_input.cpp b/src/tablet_input.cpp index 7e92b92a84..8e83730366 100644 --- a/src/tablet_input.cpp +++ b/src/tablet_input.cpp @@ -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 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(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, }; diff --git a/src/tablet_input.h b/src/tablet_input.h index 0f27d94793..135a70a554 100644 --- a/src/tablet_input.h +++ b/src/tablet_input.h @@ -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);