Changeset View
Changeset View
Standalone View
Standalone View
input.cpp
Show All 19 Lines | |||||
20 | #include "input.h" | 20 | #include "input.h" | ||
21 | #include "input_event.h" | 21 | #include "input_event.h" | ||
22 | #include "input_event_spy.h" | 22 | #include "input_event_spy.h" | ||
23 | #include "keyboard_input.h" | 23 | #include "keyboard_input.h" | ||
24 | #include "pointer_input.h" | 24 | #include "pointer_input.h" | ||
25 | #include "touch_input.h" | 25 | #include "touch_input.h" | ||
26 | #include "client.h" | 26 | #include "client.h" | ||
27 | #include "effects.h" | 27 | #include "effects.h" | ||
28 | #include "gestures.h" | ||||
28 | #include "globalshortcuts.h" | 29 | #include "globalshortcuts.h" | ||
29 | #include "logind.h" | 30 | #include "logind.h" | ||
30 | #include "main.h" | 31 | #include "main.h" | ||
31 | #ifdef KWIN_BUILD_TABBOX | 32 | #ifdef KWIN_BUILD_TABBOX | ||
32 | #include "tabbox/tabbox.h" | 33 | #include "tabbox/tabbox.h" | ||
33 | #endif | 34 | #endif | ||
34 | #include "unmanaged.h" | 35 | #include "unmanaged.h" | ||
35 | #include "screenedge.h" | 36 | #include "screenedge.h" | ||
▲ Show 20 Lines • Show All 1006 Lines • ▼ Show 20 Line(s) | |||||
1042 | { | 1043 | { | ||
1043 | public: | 1044 | public: | ||
1044 | bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override { | 1045 | bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override { | ||
1045 | Q_UNUSED(nativeButton) | 1046 | Q_UNUSED(nativeButton) | ||
1046 | ScreenEdges::self()->isEntered(event); | 1047 | ScreenEdges::self()->isEntered(event); | ||
1047 | // always forward | 1048 | // always forward | ||
1048 | return false; | 1049 | return false; | ||
1049 | } | 1050 | } | ||
1051 | bool touchDown(quint32 id, const QPointF &pos, quint32 time) override { | ||||
1052 | Q_UNUSED(time) | ||||
1053 | // TODO: better check whether a touch sequence is in progess | ||||
1054 | if (m_touchInProgress || waylandServer()->seat()->isTouchSequence()) { | ||||
1055 | // cancel existing touch | ||||
1056 | ScreenEdges::self()->gestureRecognizer()->cancelSwipeGesture(); | ||||
1057 | m_touchInProgress = false; | ||||
1058 | m_id = 0; | ||||
1059 | return false; | ||||
1060 | } | ||||
1061 | if (ScreenEdges::self()->gestureRecognizer()->startSwipeGesture(pos) > 0) { | ||||
1062 | m_touchInProgress = true; | ||||
1063 | m_id = id; | ||||
1064 | m_lastPos = pos; | ||||
1065 | return true; | ||||
1066 | } | ||||
1067 | return false; | ||||
1068 | } | ||||
1069 | bool touchMotion(quint32 id, const QPointF &pos, quint32 time) override { | ||||
1070 | Q_UNUSED(time) | ||||
1071 | if (m_touchInProgress && m_id == id) { | ||||
1072 | ScreenEdges::self()->gestureRecognizer()->updateSwipeGesture(QSizeF(pos.x() - m_lastPos.x(), pos.y() - m_lastPos.y())); | ||||
1073 | m_lastPos = pos; | ||||
1074 | return true; | ||||
1075 | } | ||||
1076 | return false; | ||||
1077 | } | ||||
1078 | bool touchUp(quint32 id, quint32 time) override { | ||||
1079 | Q_UNUSED(time) | ||||
1080 | if (m_touchInProgress && m_id == id) { | ||||
1081 | ScreenEdges::self()->gestureRecognizer()->endSwipeGesture(); | ||||
1082 | m_touchInProgress = false; | ||||
1083 | return true; | ||||
1084 | } | ||||
1085 | return false; | ||||
1086 | } | ||||
1087 | private: | ||||
1088 | bool m_touchInProgress = false; | ||||
1089 | quint32 m_id = 0; | ||||
1090 | QPointF m_lastPos; | ||||
1050 | }; | 1091 | }; | ||
1051 | 1092 | | |||
1052 | /** | 1093 | /** | ||
1053 | * This filter implements window actions. If the event should not be passed to the | 1094 | * This filter implements window actions. If the event should not be passed to the | ||
1054 | * current pointer window it will filter out the event | 1095 | * current pointer window it will filter out the event | ||
1055 | **/ | 1096 | **/ | ||
1056 | class WindowActionInputFilter : public InputEventFilter | 1097 | class WindowActionInputFilter : public InputEventFilter | ||
1057 | { | 1098 | { | ||
▲ Show 20 Lines • Show All 950 Lines • Show Last 20 Lines |