Changeset View
Changeset View
Standalone View
Standalone View
tablet_input.cpp
Show All 15 Lines | |||||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "tablet_input.h" | 20 | #include "tablet_input.h" | ||
21 | #include "abstract_client.h" | 21 | #include "abstract_client.h" | ||
22 | #include "decorations/decoratedclient.h" | 22 | #include "decorations/decoratedclient.h" | ||
23 | #include "input.h" | 23 | #include "input.h" | ||
24 | #include "input_event.h" | ||||
24 | #include "input_event_spy.h" | 25 | #include "input_event_spy.h" | ||
25 | #include "libinput/device.h" | 26 | #include "libinput/device.h" | ||
26 | #include "pointer_input.h" | 27 | #include "pointer_input.h" | ||
27 | #include "toplevel.h" | 28 | #include "toplevel.h" | ||
28 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
29 | #include "workspace.h" | 30 | #include "workspace.h" | ||
30 | // KDecoration | 31 | // KDecoration | ||
31 | #include <KDecoration2/Decoration> | 32 | #include <KDecoration2/Decoration> | ||
Show All 23 Lines | 51 | { | |||
55 | connect(workspace(), &QObject::destroyed, this, [this] { setInited(false); }); | 56 | connect(workspace(), &QObject::destroyed, this, [this] { setInited(false); }); | ||
56 | connect(waylandServer(), &QObject::destroyed, this, [this] { setInited(false); }); | 57 | connect(waylandServer(), &QObject::destroyed, this, [this] { setInited(false); }); | ||
57 | } | 58 | } | ||
58 | 59 | | |||
59 | void TabletInputRedirection::tabletToolEvent(KWin::InputRedirection::TabletEventType type, | 60 | void TabletInputRedirection::tabletToolEvent(KWin::InputRedirection::TabletEventType type, | ||
60 | const QPointF &pos, qreal pressure, | 61 | const QPointF &pos, qreal pressure, | ||
61 | int xTilt, int yTilt, qreal rotation, | 62 | int xTilt, int yTilt, qreal rotation, | ||
62 | bool tipDown, bool tipNear, quint64 serialId, | 63 | bool tipDown, bool tipNear, quint64 serialId, | ||
63 | quint64 toolId, LibInput::Device *device) | 64 | quint64 toolId, | ||
65 | InputRedirection::TabletToolType toolType, | ||||
66 | const QVector<InputRedirection::Capability> &capabilities, | ||||
67 | quint32 time, LibInput::Device *device) | ||||
64 | { | 68 | { | ||
65 | Q_UNUSED(device) | | |||
66 | Q_UNUSED(toolId) | | |||
67 | if (!inited()) { | 69 | if (!inited()) { | ||
68 | return; | 70 | return; | ||
69 | } | 71 | } | ||
70 | m_lastPosition = pos; | 72 | m_lastPosition = pos; | ||
71 | 73 | | |||
72 | QEvent::Type t; | 74 | QEvent::Type t; | ||
73 | switch (type) { | 75 | switch (type) { | ||
74 | case InputRedirection::Axis: | 76 | case InputRedirection::Axis: | ||
75 | t = QEvent::TabletMove; | 77 | t = QEvent::TabletMove; | ||
76 | break; | 78 | break; | ||
77 | case InputRedirection::Tip: | 79 | case InputRedirection::Tip: | ||
78 | t = tipDown ? QEvent::TabletPress : QEvent::TabletRelease; | 80 | t = tipDown ? QEvent::TabletPress : QEvent::TabletRelease; | ||
79 | break; | 81 | break; | ||
80 | case InputRedirection::Proximity: | 82 | case InputRedirection::Proximity: | ||
81 | t = tipNear ? QEvent::TabletEnterProximity : QEvent::TabletLeaveProximity; | 83 | t = tipNear ? QEvent::TabletEnterProximity : QEvent::TabletLeaveProximity; | ||
82 | break; | 84 | break; | ||
83 | } | 85 | } | ||
84 | 86 | | |||
85 | const auto button = m_tipDown ? Qt::LeftButton : Qt::NoButton; | 87 | const auto button = m_tipDown ? Qt::LeftButton : Qt::NoButton; | ||
86 | QTabletEvent ev(t, pos, pos, QTabletEvent::Stylus, QTabletEvent::Pen, pressure, | 88 | TabletEvent ev(t, pos, pos, QTabletEvent::Stylus, QTabletEvent::Pen, pressure, | ||
87 | xTilt, yTilt, | 89 | xTilt, yTilt, | ||
88 | 0, // tangentialPressure | 90 | 0, // tangentialPressure | ||
89 | rotation, | 91 | rotation, | ||
90 | 0, // z | 92 | 0, // z | ||
91 | Qt::NoModifier, serialId, button, button); | 93 | Qt::NoModifier, toolId, button, button, toolType, capabilities, serialId, device->sysName()); | ||
92 | 94 | | |||
95 | ev.setTimestamp(time); | ||||
93 | input()->processSpies(std::bind(&InputEventSpy::tabletToolEvent, std::placeholders::_1, &ev)); | 96 | input()->processSpies(std::bind(&InputEventSpy::tabletToolEvent, std::placeholders::_1, &ev)); | ||
94 | input()->processFilters( | 97 | input()->processFilters( | ||
95 | std::bind(&InputEventFilter::tabletToolEvent, std::placeholders::_1, &ev)); | 98 | std::bind(&InputEventFilter::tabletToolEvent, std::placeholders::_1, &ev)); | ||
96 | 99 | | |||
97 | m_tipDown = tipDown; | 100 | m_tipDown = tipDown; | ||
98 | m_tipNear = tipNear; | 101 | m_tipNear = tipNear; | ||
99 | } | 102 | } | ||
100 | 103 | | |||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |