Changeset View
Changeset View
Standalone View
Standalone View
pointer_input.h
Show All 36 Lines | |||||
37 | class Toplevel; | 37 | class Toplevel; | ||
38 | class WaylandCursorTheme; | 38 | class WaylandCursorTheme; | ||
39 | 39 | | |||
40 | namespace Decoration | 40 | namespace Decoration | ||
41 | { | 41 | { | ||
42 | class DecoratedClientImpl; | 42 | class DecoratedClientImpl; | ||
43 | } | 43 | } | ||
44 | 44 | | |||
45 | class KWIN_EXPORT PointerInputRedirection : public QObject | 45 | class KWIN_EXPORT PointerInputRedirection : public InputDeviceHandler | ||
46 | { | 46 | { | ||
47 | Q_OBJECT | 47 | Q_OBJECT | ||
48 | public: | 48 | public: | ||
49 | explicit PointerInputRedirection(InputRedirection *parent); | 49 | explicit PointerInputRedirection(InputRedirection *parent); | ||
50 | virtual ~PointerInputRedirection(); | 50 | virtual ~PointerInputRedirection(); | ||
51 | 51 | | |||
52 | void init(); | 52 | void init(); | ||
53 | 53 | | |||
54 | void update(); | 54 | void update(); | ||
55 | void updateAfterScreenChange(); | 55 | void updateAfterScreenChange(); | ||
56 | bool supportsWarping() const; | 56 | bool supportsWarping() const; | ||
57 | void warp(const QPointF &pos); | 57 | void warp(const QPointF &pos); | ||
58 | 58 | | |||
59 | QPointF pos() const { | 59 | QPointF pos() const { | ||
60 | return m_pos; | 60 | return m_pos; | ||
61 | } | 61 | } | ||
62 | Qt::MouseButtons buttons() const { | 62 | Qt::MouseButtons buttons() const { | ||
63 | return m_qtButtons; | 63 | return m_qtButtons; | ||
64 | } | 64 | } | ||
65 | QPointer<Toplevel> window() const { | | |||
66 | return m_window; | | |||
67 | } | | |||
68 | QPointer<Decoration::DecoratedClientImpl> decoration() const { | | |||
69 | return m_decoration; | | |||
70 | } | | |||
71 | QPointer<QWindow> internalWindow() const { | 65 | QPointer<QWindow> internalWindow() const { | ||
72 | return m_internalWindow; | 66 | return m_internalWindow; | ||
73 | } | 67 | } | ||
74 | 68 | | |||
75 | QImage cursorImage() const; | 69 | QImage cursorImage() const; | ||
76 | QPoint cursorHotSpot() const; | 70 | QPoint cursorHotSpot() const; | ||
77 | void markCursorAsRendered(); | 71 | void markCursorAsRendered(); | ||
78 | void setEffectsOverrideCursor(Qt::CursorShape shape); | 72 | void setEffectsOverrideCursor(Qt::CursorShape shape); | ||
79 | void removeEffectsOverrideCursor(); | 73 | void removeEffectsOverrideCursor(); | ||
80 | 74 | | |||
81 | /** | 75 | /** | ||
82 | * @internal | 76 | * @internal | ||
83 | */ | 77 | */ | ||
84 | void processMotion(const QPointF &pos, uint32_t time); | 78 | void processMotion(const QPointF &pos, uint32_t time); | ||
85 | /** | 79 | /** | ||
86 | * @internal | 80 | * @internal | ||
87 | */ | 81 | */ | ||
88 | void processButton(uint32_t button, InputRedirection::PointerButtonState state, uint32_t time); | 82 | void processButton(uint32_t button, InputRedirection::PointerButtonState state, uint32_t time); | ||
89 | /** | 83 | /** | ||
90 | * @internal | 84 | * @internal | ||
91 | */ | 85 | */ | ||
92 | void processAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time); | 86 | void processAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time); | ||
93 | 87 | | |||
94 | Q_SIGNALS: | | |||
95 | void decorationChanged(); | | |||
96 | | ||||
97 | private: | 88 | private: | ||
98 | void updatePosition(const QPointF &pos); | 89 | void updatePosition(const QPointF &pos); | ||
99 | void updateButton(uint32_t button, InputRedirection::PointerButtonState state); | 90 | void updateButton(uint32_t button, InputRedirection::PointerButtonState state); | ||
100 | void updateInternalWindow(); | 91 | void updateInternalWindow(); | ||
101 | void updateDecoration(Toplevel *t); | | |||
102 | InputRedirection *m_input; | | |||
103 | CursorImage *m_cursor; | 92 | CursorImage *m_cursor; | ||
104 | bool m_inited = false; | 93 | bool m_inited = false; | ||
105 | bool m_supportsWarping; | 94 | bool m_supportsWarping; | ||
106 | QPointF m_pos; | 95 | QPointF m_pos; | ||
107 | QHash<uint32_t, InputRedirection::PointerButtonState> m_buttons; | 96 | QHash<uint32_t, InputRedirection::PointerButtonState> m_buttons; | ||
108 | Qt::MouseButtons m_qtButtons; | 97 | Qt::MouseButtons m_qtButtons; | ||
109 | /** | | |||
110 | * @brief The Toplevel which currently receives pointer events | | |||
111 | */ | | |||
112 | QPointer<Toplevel> m_window; | | |||
113 | /** | | |||
114 | * @brief The Decoration which currently receives pointer events. | | |||
115 | * Decoration belongs to the pointerWindow | | |||
116 | **/ | | |||
117 | QPointer<Decoration::DecoratedClientImpl> m_decoration; | | |||
118 | QPointer<QWindow> m_internalWindow; | 98 | QPointer<QWindow> m_internalWindow; | ||
119 | QMetaObject::Connection m_windowGeometryConnection; | 99 | QMetaObject::Connection m_windowGeometryConnection; | ||
120 | QMetaObject::Connection m_internalWindowConnection; | 100 | QMetaObject::Connection m_internalWindowConnection; | ||
121 | }; | 101 | }; | ||
122 | 102 | | |||
123 | class CursorImage : public QObject | 103 | class CursorImage : public QObject | ||
124 | { | 104 | { | ||
125 | Q_OBJECT | 105 | Q_OBJECT | ||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |