Changeset View
Changeset View
Standalone View
Standalone View
screenedge.h
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | 54 | public: | |||
---|---|---|---|---|---|
70 | void reserve(QObject *object, const char *slot); | 70 | void reserve(QObject *object, const char *slot); | ||
71 | const QHash<QObject *, QByteArray> &callBacks() const; | 71 | const QHash<QObject *, QByteArray> &callBacks() const; | ||
72 | void startApproaching(); | 72 | void startApproaching(); | ||
73 | void stopApproaching(); | 73 | void stopApproaching(); | ||
74 | bool isApproaching() const; | 74 | bool isApproaching() const; | ||
75 | void setClient(AbstractClient *client); | 75 | void setClient(AbstractClient *client); | ||
76 | AbstractClient *client() const; | 76 | AbstractClient *client() const; | ||
77 | const QRect &geometry() const; | 77 | const QRect &geometry() const; | ||
78 | void setTouchAction(ElectricBorderAction action); | ||||
79 | | ||||
80 | bool activatesForPointer() const; | ||||
81 | bool activatesForTouchGesture() const; | ||||
78 | 82 | | |||
79 | /** | 83 | /** | ||
80 | * The window id of the native window representing the edge. | 84 | * The window id of the native window representing the edge. | ||
81 | * Default implementation returns @c 0, which means no window. | 85 | * Default implementation returns @c 0, which means no window. | ||
82 | **/ | 86 | **/ | ||
83 | virtual quint32 window() const; | 87 | virtual quint32 window() const; | ||
84 | /** | 88 | /** | ||
85 | * The approach window is a special window to notice when get close to the screen border but | 89 | * The approach window is a special window to notice when get close to the screen border but | ||
Show All 9 Lines | 96 | public Q_SLOTS: | |||
95 | void unreserve(QObject *object); | 99 | void unreserve(QObject *object); | ||
96 | void setBorder(ElectricBorder border); | 100 | void setBorder(ElectricBorder border); | ||
97 | void setAction(ElectricBorderAction action); | 101 | void setAction(ElectricBorderAction action); | ||
98 | void setGeometry(const QRect &geometry); | 102 | void setGeometry(const QRect &geometry); | ||
99 | void updateApproaching(const QPoint &point); | 103 | void updateApproaching(const QPoint &point); | ||
100 | void checkBlocking(); | 104 | void checkBlocking(); | ||
101 | Q_SIGNALS: | 105 | Q_SIGNALS: | ||
102 | void approaching(ElectricBorder border, qreal factor, const QRect &geometry); | 106 | void approaching(ElectricBorder border, qreal factor, const QRect &geometry); | ||
107 | void activatesForTouchGestureChanged(); | ||||
103 | protected: | 108 | protected: | ||
104 | ScreenEdges *edges(); | 109 | ScreenEdges *edges(); | ||
105 | const ScreenEdges *edges() const; | 110 | const ScreenEdges *edges() const; | ||
106 | bool isBlocked() const; | 111 | bool isBlocked() const; | ||
107 | virtual void doGeometryUpdate(); | 112 | virtual void doGeometryUpdate(); | ||
108 | virtual void doActivate(); | 113 | virtual void doActivate(); | ||
109 | virtual void doDeactivate(); | 114 | virtual void doDeactivate(); | ||
110 | virtual void doStartApproaching(); | 115 | virtual void doStartApproaching(); | ||
111 | virtual void doStopApproaching(); | 116 | virtual void doStopApproaching(); | ||
112 | virtual void doUpdateBlocking(); | 117 | virtual void doUpdateBlocking(); | ||
113 | private: | 118 | private: | ||
114 | void activate(); | 119 | void activate(); | ||
115 | void deactivate(); | 120 | void deactivate(); | ||
116 | bool canActivate(const QPoint &cursorPos, const QDateTime &triggerTime); | 121 | bool canActivate(const QPoint &cursorPos, const QDateTime &triggerTime); | ||
117 | void handle(const QPoint &cursorPos); | 122 | void handle(const QPoint &cursorPos); | ||
118 | bool handleAction(); | 123 | bool handleAction(ElectricBorderAction action); | ||
124 | bool handlePointerAction() { | ||||
125 | return handleAction(m_action); | ||||
126 | } | ||||
127 | bool handleTouchAction() { | ||||
128 | return handleAction(m_touchAction); | ||||
129 | } | ||||
119 | bool handleByCallback(); | 130 | bool handleByCallback(); | ||
120 | void switchDesktop(const QPoint &cursorPos); | 131 | void switchDesktop(const QPoint &cursorPos); | ||
121 | void pushCursorBack(const QPoint &cursorPos); | 132 | void pushCursorBack(const QPoint &cursorPos); | ||
122 | ScreenEdges *m_edges; | 133 | ScreenEdges *m_edges; | ||
123 | ElectricBorder m_border; | 134 | ElectricBorder m_border; | ||
124 | ElectricBorderAction m_action; | 135 | ElectricBorderAction m_action; | ||
136 | ElectricBorderAction m_touchAction = ElectricActionNone; | ||||
125 | int m_reserved; | 137 | int m_reserved; | ||
126 | QRect m_geometry; | 138 | QRect m_geometry; | ||
127 | QRect m_approachGeometry; | 139 | QRect m_approachGeometry; | ||
128 | QDateTime m_lastTrigger; | 140 | QDateTime m_lastTrigger; | ||
129 | QDateTime m_lastReset; | 141 | QDateTime m_lastReset; | ||
130 | QPoint m_triggeredPoint; | 142 | QPoint m_triggeredPoint; | ||
131 | QHash<QObject *, QByteArray> m_callBacks; | 143 | QHash<QObject *, QByteArray> m_callBacks; | ||
132 | bool m_approaching; | 144 | bool m_approaching; | ||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Line(s) | 349 | private: | |||
340 | void setDesktopSwitchingMovingClients(bool enable); | 352 | void setDesktopSwitchingMovingClients(bool enable); | ||
341 | void setCursorPushBackDistance(const QSize &distance); | 353 | void setCursorPushBackDistance(const QSize &distance); | ||
342 | void setTimeThreshold(int threshold); | 354 | void setTimeThreshold(int threshold); | ||
343 | void setReActivationThreshold(int threshold); | 355 | void setReActivationThreshold(int threshold); | ||
344 | void createHorizontalEdge(ElectricBorder border, const QRect &screen, const QRect &fullArea); | 356 | void createHorizontalEdge(ElectricBorder border, const QRect &screen, const QRect &fullArea); | ||
345 | void createVerticalEdge(ElectricBorder border, const QRect &screen, const QRect &fullArea); | 357 | void createVerticalEdge(ElectricBorder border, const QRect &screen, const QRect &fullArea); | ||
346 | Edge *createEdge(ElectricBorder border, int x, int y, int width, int height, bool createAction = true); | 358 | Edge *createEdge(ElectricBorder border, int x, int y, int width, int height, bool createAction = true); | ||
347 | void setActionForBorder(ElectricBorder border, ElectricBorderAction *oldValue, ElectricBorderAction newValue); | 359 | void setActionForBorder(ElectricBorder border, ElectricBorderAction *oldValue, ElectricBorderAction newValue); | ||
360 | void setActionForTouchBorder(ElectricBorder border, ElectricBorderAction newValue); | ||||
348 | ElectricBorderAction actionForEdge(Edge *edge) const; | 361 | ElectricBorderAction actionForEdge(Edge *edge) const; | ||
362 | ElectricBorderAction actionForTouchEdge(Edge *edge) const; | ||||
349 | bool handleEnterNotifiy(xcb_window_t window, const QPoint &point, const QDateTime ×tamp); | 363 | bool handleEnterNotifiy(xcb_window_t window, const QPoint &point, const QDateTime ×tamp); | ||
350 | bool handleDndNotify(xcb_window_t window, const QPoint &point); | 364 | bool handleDndNotify(xcb_window_t window, const QPoint &point); | ||
351 | void createEdgeForClient(AbstractClient *client, ElectricBorder border); | 365 | void createEdgeForClient(AbstractClient *client, ElectricBorder border); | ||
352 | void deleteEdgeForClient(AbstractClient *client); | 366 | void deleteEdgeForClient(AbstractClient *client); | ||
353 | bool m_desktopSwitching; | 367 | bool m_desktopSwitching; | ||
354 | bool m_desktopSwitchingMovingClients; | 368 | bool m_desktopSwitchingMovingClients; | ||
355 | QSize m_cursorPushBackDistance; | 369 | QSize m_cursorPushBackDistance; | ||
356 | int m_timeThreshold; | 370 | int m_timeThreshold; | ||
357 | int m_reactivateThreshold; | 371 | int m_reactivateThreshold; | ||
358 | Qt::Orientations m_virtualDesktopLayout; | 372 | Qt::Orientations m_virtualDesktopLayout; | ||
359 | QList<Edge*> m_edges; | 373 | QList<Edge*> m_edges; | ||
360 | KSharedConfig::Ptr m_config; | 374 | KSharedConfig::Ptr m_config; | ||
361 | ElectricBorderAction m_actionTopLeft; | 375 | ElectricBorderAction m_actionTopLeft; | ||
362 | ElectricBorderAction m_actionTop; | 376 | ElectricBorderAction m_actionTop; | ||
363 | ElectricBorderAction m_actionTopRight; | 377 | ElectricBorderAction m_actionTopRight; | ||
364 | ElectricBorderAction m_actionRight; | 378 | ElectricBorderAction m_actionRight; | ||
365 | ElectricBorderAction m_actionBottomRight; | 379 | ElectricBorderAction m_actionBottomRight; | ||
366 | ElectricBorderAction m_actionBottom; | 380 | ElectricBorderAction m_actionBottom; | ||
367 | ElectricBorderAction m_actionBottomLeft; | 381 | ElectricBorderAction m_actionBottomLeft; | ||
368 | ElectricBorderAction m_actionLeft; | 382 | ElectricBorderAction m_actionLeft; | ||
383 | QMap<ElectricBorder, ElectricBorderAction> m_touchActions; | ||||
369 | int m_cornerOffset; | 384 | int m_cornerOffset; | ||
370 | GestureRecognizer *m_gestureRecognizer; | 385 | GestureRecognizer *m_gestureRecognizer; | ||
371 | 386 | | |||
372 | KWIN_SINGLETON(ScreenEdges) | 387 | KWIN_SINGLETON(ScreenEdges) | ||
373 | }; | 388 | }; | ||
374 | 389 | | |||
375 | /********************************************************** | 390 | /********************************************************** | ||
376 | * Inlines Edge | 391 | * Inlines Edge | ||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 466 | { | |||
452 | return m_callBacks; | 467 | return m_callBacks; | ||
453 | } | 468 | } | ||
454 | 469 | | |||
455 | inline bool Edge::isBlocked() const | 470 | inline bool Edge::isBlocked() const | ||
456 | { | 471 | { | ||
457 | return m_blocked; | 472 | return m_blocked; | ||
458 | } | 473 | } | ||
459 | 474 | | |||
460 | inline void Edge::setClient(AbstractClient *client) | | |||
461 | { | | |||
462 | m_client = client; | | |||
463 | } | | |||
464 | | ||||
465 | inline AbstractClient *Edge::client() const | 475 | inline AbstractClient *Edge::client() const | ||
466 | { | 476 | { | ||
467 | return m_client; | 477 | return m_client; | ||
468 | } | 478 | } | ||
469 | 479 | | |||
470 | inline bool Edge::isApproaching() const | 480 | inline bool Edge::isApproaching() const | ||
471 | { | 481 | { | ||
472 | return m_approaching; | 482 | return m_approaching; | ||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |