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 | LibInput::Device *device) | ||||
64 | { | 68 | { | ||
65 | Q_UNUSED(device) | 69 | Q_UNUSED(device) | ||
66 | Q_UNUSED(toolId) | | |||
67 | if (!inited()) { | 70 | if (!inited()) { | ||
68 | return; | 71 | return; | ||
69 | } | 72 | } | ||
70 | m_lastPosition = pos; | 73 | m_lastPosition = pos; | ||
71 | 74 | | |||
72 | QEvent::Type t; | 75 | QEvent::Type t; | ||
73 | switch (type) { | 76 | switch (type) { | ||
74 | case InputRedirection::Axis: | 77 | case InputRedirection::Axis: | ||
75 | t = QEvent::TabletMove; | 78 | t = QEvent::TabletMove; | ||
76 | break; | 79 | break; | ||
77 | case InputRedirection::Tip: | 80 | case InputRedirection::Tip: | ||
78 | t = tipDown ? QEvent::TabletPress : QEvent::TabletRelease; | 81 | t = tipDown ? QEvent::TabletPress : QEvent::TabletRelease; | ||
79 | break; | 82 | break; | ||
80 | case InputRedirection::Proximity: | 83 | case InputRedirection::Proximity: | ||
81 | t = tipNear ? QEvent::TabletEnterProximity : QEvent::TabletLeaveProximity; | 84 | t = tipNear ? QEvent::TabletEnterProximity : QEvent::TabletLeaveProximity; | ||
82 | break; | 85 | break; | ||
83 | } | 86 | } | ||
84 | 87 | | |||
85 | const auto button = m_tipDown ? Qt::LeftButton : Qt::NoButton; | 88 | const auto button = m_tipDown ? Qt::LeftButton : Qt::NoButton; | ||
86 | QTabletEvent ev(t, pos, pos, QTabletEvent::Stylus, QTabletEvent::Pen, pressure, | 89 | TabletEvent ev(t, pos, pos, QTabletEvent::Stylus, QTabletEvent::Pen, pressure, | ||
87 | xTilt, yTilt, | 90 | xTilt, yTilt, | ||
88 | 0, // tangentialPressure | 91 | 0, // tangentialPressure | ||
89 | rotation, | 92 | rotation, | ||
90 | 0, // z | 93 | 0, // z | ||
91 | Qt::NoModifier, serialId, button, button); | 94 | Qt::NoModifier, toolId, button, button, toolType, capabilities, serialId); | ||
92 | 95 | | |||
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 | } | ||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |