Changeset View
Changeset View
Standalone View
Standalone View
screenedge.h
Show All 33 Lines | |||||
34 | // KDE includes | 34 | // KDE includes | ||
35 | #include <KSharedConfig> | 35 | #include <KSharedConfig> | ||
36 | // Qt | 36 | // Qt | ||
37 | #include <QObject> | 37 | #include <QObject> | ||
38 | #include <QVector> | 38 | #include <QVector> | ||
39 | #include <QDateTime> | 39 | #include <QDateTime> | ||
40 | #include <QRect> | 40 | #include <QRect> | ||
41 | 41 | | |||
42 | class QAction; | ||||
42 | class QMouseEvent; | 43 | class QMouseEvent; | ||
43 | 44 | | |||
44 | namespace KWin { | 45 | namespace KWin { | ||
45 | 46 | | |||
46 | class AbstractClient; | 47 | class AbstractClient; | ||
47 | class GestureRecognizer; | 48 | class GestureRecognizer; | ||
48 | class ScreenEdges; | 49 | class ScreenEdges; | ||
49 | class SwipeGesture; | 50 | class SwipeGesture; | ||
Show All 14 Lines | 55 | public: | |||
64 | bool check(const QPoint &cursorPos, const QDateTime &triggerTime, bool forceNoPushBack = false); | 65 | bool check(const QPoint &cursorPos, const QDateTime &triggerTime, bool forceNoPushBack = false); | ||
65 | void markAsTriggered(const QPoint &cursorPos, const QDateTime &triggerTime); | 66 | void markAsTriggered(const QPoint &cursorPos, const QDateTime &triggerTime); | ||
66 | bool isReserved() const; | 67 | bool isReserved() const; | ||
67 | const QRect &approachGeometry() const; | 68 | const QRect &approachGeometry() const; | ||
68 | 69 | | |||
69 | ElectricBorder border() const; | 70 | ElectricBorder border() const; | ||
70 | void reserve(QObject *object, const char *slot); | 71 | void reserve(QObject *object, const char *slot); | ||
71 | const QHash<QObject *, QByteArray> &callBacks() const; | 72 | const QHash<QObject *, QByteArray> &callBacks() const; | ||
73 | void reserveTouchCallBack(QAction *action); | ||||
74 | void unreserveTouchCallBack(QAction *action); | ||||
75 | QVector<QAction *> touchCallBacks() const { | ||||
76 | return m_touchActions; | ||||
77 | } | ||||
72 | void startApproaching(); | 78 | void startApproaching(); | ||
73 | void stopApproaching(); | 79 | void stopApproaching(); | ||
74 | bool isApproaching() const; | 80 | bool isApproaching() const; | ||
75 | void setClient(AbstractClient *client); | 81 | void setClient(AbstractClient *client); | ||
76 | AbstractClient *client() const; | 82 | AbstractClient *client() const; | ||
77 | const QRect &geometry() const; | 83 | const QRect &geometry() const; | ||
78 | void setTouchAction(ElectricBorderAction action); | 84 | void setTouchAction(ElectricBorderAction action); | ||
79 | 85 | | |||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 124 | private: | |||
123 | bool handleAction(ElectricBorderAction action); | 129 | bool handleAction(ElectricBorderAction action); | ||
124 | bool handlePointerAction() { | 130 | bool handlePointerAction() { | ||
125 | return handleAction(m_action); | 131 | return handleAction(m_action); | ||
126 | } | 132 | } | ||
127 | bool handleTouchAction() { | 133 | bool handleTouchAction() { | ||
128 | return handleAction(m_touchAction); | 134 | return handleAction(m_touchAction); | ||
129 | } | 135 | } | ||
130 | bool handleByCallback(); | 136 | bool handleByCallback(); | ||
137 | void handleTouchCallback(); | ||||
131 | void switchDesktop(const QPoint &cursorPos); | 138 | void switchDesktop(const QPoint &cursorPos); | ||
132 | void pushCursorBack(const QPoint &cursorPos); | 139 | void pushCursorBack(const QPoint &cursorPos); | ||
133 | ScreenEdges *m_edges; | 140 | ScreenEdges *m_edges; | ||
134 | ElectricBorder m_border; | 141 | ElectricBorder m_border; | ||
135 | ElectricBorderAction m_action; | 142 | ElectricBorderAction m_action; | ||
136 | ElectricBorderAction m_touchAction = ElectricActionNone; | 143 | ElectricBorderAction m_touchAction = ElectricActionNone; | ||
137 | int m_reserved; | 144 | int m_reserved; | ||
138 | QRect m_geometry; | 145 | QRect m_geometry; | ||
139 | QRect m_approachGeometry; | 146 | QRect m_approachGeometry; | ||
140 | QDateTime m_lastTrigger; | 147 | QDateTime m_lastTrigger; | ||
141 | QDateTime m_lastReset; | 148 | QDateTime m_lastReset; | ||
142 | QPoint m_triggeredPoint; | 149 | QPoint m_triggeredPoint; | ||
143 | QHash<QObject *, QByteArray> m_callBacks; | 150 | QHash<QObject *, QByteArray> m_callBacks; | ||
144 | bool m_approaching; | 151 | bool m_approaching; | ||
145 | int m_lastApproachingFactor; | 152 | int m_lastApproachingFactor; | ||
146 | bool m_blocked; | 153 | bool m_blocked; | ||
147 | bool m_pushBackBlocked; | 154 | bool m_pushBackBlocked; | ||
148 | AbstractClient *m_client; | 155 | AbstractClient *m_client; | ||
149 | SwipeGesture *m_gesture; | 156 | SwipeGesture *m_gesture; | ||
157 | QVector<QAction *> m_touchActions; | ||||
150 | }; | 158 | }; | ||
151 | 159 | | |||
152 | /** | 160 | /** | ||
153 | * @short Class for controlling screen edges. | 161 | * @short Class for controlling screen edges. | ||
154 | * | 162 | * | ||
155 | * The screen edge functionality is split into three parts: | 163 | * The screen edge functionality is split into three parts: | ||
156 | * @li This manager class ScreenEdges | 164 | * @li This manager class ScreenEdges | ||
157 | * @li abstract class @link Edge | 165 | * @li abstract class @link Edge | ||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Line(s) | 218 | public: | |||
270 | * To make sure that the client can always be shown again the implementation also starts to | 278 | * To make sure that the client can always be shown again the implementation also starts to | ||
271 | * track geometry changes and shows the Client again. The same for screen geometry changes. | 279 | * track geometry changes and shows the Client again. The same for screen geometry changes. | ||
272 | * | 280 | * | ||
273 | * The Edge gets automatically destroyed if the client gets released. | 281 | * The Edge gets automatically destroyed if the client gets released. | ||
274 | * @param client The Client for which an Edge should be reserved | 282 | * @param client The Client for which an Edge should be reserved | ||
275 | * @param border The border which the client wants to use, only proper borders are supported (no corners) | 283 | * @param border The border which the client wants to use, only proper borders are supported (no corners) | ||
276 | **/ | 284 | **/ | ||
277 | void reserve(KWin::AbstractClient *client, ElectricBorder border); | 285 | void reserve(KWin::AbstractClient *client, ElectricBorder border); | ||
286 | | ||||
287 | /** | ||||
288 | * Mark the specified screen edge as reserved for touch gestures. This method is provided for | ||||
289 | * external activation like effects and scripts. | ||||
290 | * When the effect/script does no longer need the edge it is supposed | ||||
291 | * to call @link unreserveTouch. | ||||
292 | * @param border the screen edge to mark as reserved | ||||
293 | * @param action The action which gets triggered | ||||
294 | * @see unreserveTouch | ||||
295 | * @since 5.10 | ||||
296 | **/ | ||||
297 | void reserveTouch(ElectricBorder border, QAction *action); | ||||
298 | /** | ||||
299 | * Unreserves the specified @p border from activating the @p action for touch gestures. | ||||
300 | * @see reserveTouch | ||||
301 | * @since 5.10 | ||||
302 | **/ | ||||
303 | void unreserveTouch(ElectricBorder border, QAction *action); | ||||
304 | | ||||
278 | /** | 305 | /** | ||
279 | * Reserve desktop switching for screen edges, if @p isToReserve is @c true. Unreserve otherwise. | 306 | * Reserve desktop switching for screen edges, if @p isToReserve is @c true. Unreserve otherwise. | ||
280 | * @param reserve indicated weather desktop switching should be reserved or unreseved | 307 | * @param reserve indicated weather desktop switching should be reserved or unreseved | ||
281 | */ | 308 | */ | ||
282 | void reserveDesktopSwitching(bool isToReserve, Qt::Orientations o); | 309 | void reserveDesktopSwitching(bool isToReserve, Qt::Orientations o); | ||
283 | /** | 310 | /** | ||
284 | * Raise electric border windows to the real top of the screen. We only need | 311 | * Raise electric border windows to the real top of the screen. We only need | ||
285 | * to do this if an effect input window is active. | 312 | * to do this if an effect input window is active. | ||
▲ Show 20 Lines • Show All 285 Lines • Show Last 20 Lines |