Changeset View
Changeset View
Standalone View
Standalone View
pointer_input.h
1 | /******************************************************************** | 1 | /******************************************************************** | ||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | 2 | KWin - the KDE window manager | ||
3 | This file is part of the KDE project. | 3 | This file is part of the KDE project. | ||
4 | 4 | | |||
5 | Copyright (C) 2013, 2016 Martin Gräßlin <mgraesslin@kde.org> | 5 | Copyright (C) 2013, 2016 Martin Gräßlin <mgraesslin@kde.org> | ||
6 | Copyright (C) 2018 Roman Gilg <subdiff@gmail.com> | ||||
6 | 7 | | |||
7 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | 11 | (at your option) any later version. | ||
11 | 12 | | |||
12 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
59 | { | 60 | { | ||
60 | Q_OBJECT | 61 | Q_OBJECT | ||
61 | public: | 62 | public: | ||
62 | explicit PointerInputRedirection(InputRedirection *parent); | 63 | explicit PointerInputRedirection(InputRedirection *parent); | ||
63 | virtual ~PointerInputRedirection(); | 64 | virtual ~PointerInputRedirection(); | ||
64 | 65 | | |||
65 | void init(); | 66 | void init(); | ||
66 | 67 | | |||
67 | void update(); | | |||
68 | void updateAfterScreenChange(); | 68 | void updateAfterScreenChange(); | ||
69 | bool supportsWarping() const; | 69 | bool supportsWarping() const; | ||
70 | void warp(const QPointF &pos); | 70 | void warp(const QPointF &pos); | ||
71 | 71 | | |||
72 | QPointF pos() const { | 72 | QPointF pos() const { | ||
73 | return m_pos; | 73 | return m_pos; | ||
74 | } | 74 | } | ||
75 | Qt::MouseButtons buttons() const { | 75 | Qt::MouseButtons buttons() const { | ||
76 | return m_qtButtons; | 76 | return m_qtButtons; | ||
77 | } | 77 | } | ||
78 | bool areButtonsPressed() const; | ||||
78 | 79 | | |||
79 | QImage cursorImage() const; | 80 | QImage cursorImage() const; | ||
80 | QPoint cursorHotSpot() const; | 81 | QPoint cursorHotSpot() const; | ||
81 | void markCursorAsRendered(); | 82 | void markCursorAsRendered(); | ||
82 | void setEffectsOverrideCursor(Qt::CursorShape shape); | 83 | void setEffectsOverrideCursor(Qt::CursorShape shape); | ||
83 | void removeEffectsOverrideCursor(); | 84 | void removeEffectsOverrideCursor(); | ||
84 | void setWindowSelectionCursor(const QByteArray &shape); | 85 | void setWindowSelectionCursor(const QByteArray &shape); | ||
85 | void removeWindowSelectionCursor(); | 86 | void removeWindowSelectionCursor(); | ||
86 | 87 | | |||
87 | void updatePointerConstraints(); | 88 | void updatePointerConstraints(); | ||
88 | 89 | | |||
89 | void setEnableConstraints(bool set); | 90 | void setEnableConstraints(bool set); | ||
90 | 91 | | |||
91 | bool isConstrained() const { | 92 | bool isConstrained() const { | ||
92 | return m_confined || m_locked; | 93 | return m_confined || m_locked; | ||
93 | } | 94 | } | ||
94 | 95 | | |||
96 | bool focusUpdatesBlocked() override; | ||||
97 | | ||||
95 | /** | 98 | /** | ||
96 | * @internal | 99 | * @internal | ||
97 | */ | 100 | */ | ||
98 | void processMotion(const QPointF &pos, uint32_t time, LibInput::Device *device = nullptr); | 101 | void processMotion(const QPointF &pos, uint32_t time, LibInput::Device *device = nullptr); | ||
99 | /** | 102 | /** | ||
100 | * @internal | 103 | * @internal | ||
101 | **/ | 104 | **/ | ||
102 | void processMotion(const QPointF &pos, const QSizeF &delta, const QSizeF &deltaNonAccelerated, uint32_t time, quint64 timeUsec, LibInput::Device *device); | 105 | void processMotion(const QPointF &pos, const QSizeF &delta, const QSizeF &deltaNonAccelerated, uint32_t time, quint64 timeUsec, LibInput::Device *device); | ||
Show All 34 Lines | |||||
137 | */ | 140 | */ | ||
138 | void processPinchGestureEnd(quint32 time, KWin::LibInput::Device *device = nullptr); | 141 | void processPinchGestureEnd(quint32 time, KWin::LibInput::Device *device = nullptr); | ||
139 | /** | 142 | /** | ||
140 | * @internal | 143 | * @internal | ||
141 | */ | 144 | */ | ||
142 | void processPinchGestureCancelled(quint32 time, KWin::LibInput::Device *device = nullptr); | 145 | void processPinchGestureCancelled(quint32 time, KWin::LibInput::Device *device = nullptr); | ||
143 | 146 | | |||
144 | private: | 147 | private: | ||
148 | void cleanupInternalWindow(QWindow *old, QWindow *now) override; | ||||
149 | void cleanupDecoration(Decoration::DecoratedClientImpl *old, Decoration::DecoratedClientImpl *now) override; | ||||
150 | | ||||
151 | void focusUpdate(Toplevel *focusOld, Toplevel *focusNow) override; | ||||
152 | | ||||
153 | QPointF position() const override; | ||||
154 | | ||||
145 | void updateOnStartMoveResize(); | 155 | void updateOnStartMoveResize(); | ||
146 | void updateToReset(); | 156 | void updateToReset(); | ||
147 | void updatePosition(const QPointF &pos); | 157 | void updatePosition(const QPointF &pos); | ||
148 | void updateButton(uint32_t button, InputRedirection::PointerButtonState state); | 158 | void updateButton(uint32_t button, InputRedirection::PointerButtonState state); | ||
149 | void warpXcbOnSurfaceLeft(KWayland::Server::SurfaceInterface *surface); | 159 | void warpXcbOnSurfaceLeft(KWayland::Server::SurfaceInterface *surface); | ||
150 | QPointF applyPointerConfinement(const QPointF &pos) const; | 160 | QPointF applyPointerConfinement(const QPointF &pos) const; | ||
151 | void disconnectConfinedPointerRegionConnection(); | 161 | void disconnectConfinedPointerRegionConnection(); | ||
152 | void disconnectLockedPointerAboutToBeUnboundConnection(); | 162 | void disconnectLockedPointerAboutToBeUnboundConnection(); | ||
153 | void disconnectPointerConstraintsConnection(); | 163 | void disconnectPointerConstraintsConnection(); | ||
154 | void breakPointerConstraints(KWayland::Server::SurfaceInterface *surface); | 164 | void breakPointerConstraints(KWayland::Server::SurfaceInterface *surface); | ||
155 | bool areButtonsPressed() const; | | |||
156 | CursorImage *m_cursor; | 165 | CursorImage *m_cursor; | ||
157 | bool m_inited = false; | | |||
158 | bool m_supportsWarping; | 166 | bool m_supportsWarping; | ||
159 | QPointF m_pos; | 167 | QPointF m_pos; | ||
160 | QHash<uint32_t, InputRedirection::PointerButtonState> m_buttons; | 168 | QHash<uint32_t, InputRedirection::PointerButtonState> m_buttons; | ||
161 | Qt::MouseButtons m_qtButtons; | 169 | Qt::MouseButtons m_qtButtons; | ||
162 | QMetaObject::Connection m_windowGeometryConnection; | 170 | QMetaObject::Connection m_focusGeometryConnection; | ||
163 | QMetaObject::Connection m_internalWindowConnection; | 171 | QMetaObject::Connection m_internalWindowConnection; | ||
164 | QMetaObject::Connection m_constraintsConnection; | 172 | QMetaObject::Connection m_constraintsConnection; | ||
165 | QMetaObject::Connection m_constraintsActivatedConnection; | 173 | QMetaObject::Connection m_constraintsActivatedConnection; | ||
166 | QMetaObject::Connection m_confinedPointerRegionConnection; | 174 | QMetaObject::Connection m_confinedPointerRegionConnection; | ||
167 | QMetaObject::Connection m_lockedPointerAboutToBeUnboundConnection; | 175 | QMetaObject::Connection m_lockedPointerAboutToBeUnboundConnection; | ||
168 | QMetaObject::Connection m_decorationGeometryConnection; | 176 | QMetaObject::Connection m_decorationGeometryConnection; | ||
169 | bool m_confined = false; | 177 | bool m_confined = false; | ||
170 | bool m_locked = false; | 178 | bool m_locked = false; | ||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |