Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_inputeventfilter.cpp
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | |||||
53 | 53 | | |||
54 | bool DpmsInputEventFilter::keyEvent(QKeyEvent *event) | 54 | bool DpmsInputEventFilter::keyEvent(QKeyEvent *event) | ||
55 | { | 55 | { | ||
56 | Q_UNUSED(event) | 56 | Q_UNUSED(event) | ||
57 | notify(); | 57 | notify(); | ||
58 | return true; | 58 | return true; | ||
59 | } | 59 | } | ||
60 | 60 | | |||
61 | bool DpmsInputEventFilter::touchDown(quint32 id, const QPointF &pos, quint32 time) | 61 | bool DpmsInputEventFilter::touchDown(qint32 id, const QPointF &pos, quint32 time) | ||
62 | { | 62 | { | ||
63 | Q_UNUSED(pos) | 63 | Q_UNUSED(pos) | ||
64 | Q_UNUSED(time) | 64 | Q_UNUSED(time) | ||
65 | if (m_touchPoints.isEmpty()) { | 65 | if (m_touchPoints.isEmpty()) { | ||
66 | if (!m_doubleTapTimer.isValid()) { | 66 | if (!m_doubleTapTimer.isValid()) { | ||
67 | // this is the first tap | 67 | // this is the first tap | ||
68 | m_doubleTapTimer.start(); | 68 | m_doubleTapTimer.start(); | ||
69 | } else { | 69 | } else { | ||
70 | if (m_doubleTapTimer.elapsed() < qApp->doubleClickInterval()) { | 70 | if (m_doubleTapTimer.elapsed() < qApp->doubleClickInterval()) { | ||
71 | m_secondTap = true; | 71 | m_secondTap = true; | ||
72 | } else { | 72 | } else { | ||
73 | // took too long. Let's consider it a new click | 73 | // took too long. Let's consider it a new click | ||
74 | m_doubleTapTimer.restart(); | 74 | m_doubleTapTimer.restart(); | ||
75 | } | 75 | } | ||
76 | } | 76 | } | ||
77 | } else { | 77 | } else { | ||
78 | // not a double tap | 78 | // not a double tap | ||
79 | m_doubleTapTimer.invalidate(); | 79 | m_doubleTapTimer.invalidate(); | ||
80 | m_secondTap = false; | 80 | m_secondTap = false; | ||
81 | } | 81 | } | ||
82 | m_touchPoints << id; | 82 | m_touchPoints << id; | ||
83 | return true; | 83 | return true; | ||
84 | } | 84 | } | ||
85 | 85 | | |||
86 | bool DpmsInputEventFilter::touchUp(quint32 id, quint32 time) | 86 | bool DpmsInputEventFilter::touchUp(qint32 id, quint32 time) | ||
87 | { | 87 | { | ||
88 | m_touchPoints.removeAll(id); | 88 | m_touchPoints.removeAll(id); | ||
89 | if (m_touchPoints.isEmpty() && m_doubleTapTimer.isValid() && m_secondTap) { | 89 | if (m_touchPoints.isEmpty() && m_doubleTapTimer.isValid() && m_secondTap) { | ||
90 | if (m_doubleTapTimer.elapsed() < qApp->doubleClickInterval()) { | 90 | if (m_doubleTapTimer.elapsed() < qApp->doubleClickInterval()) { | ||
91 | waylandServer()->seat()->setTimestamp(time); | 91 | waylandServer()->seat()->setTimestamp(time); | ||
92 | notify(); | 92 | notify(); | ||
93 | } | 93 | } | ||
94 | m_doubleTapTimer.invalidate(); | 94 | m_doubleTapTimer.invalidate(); | ||
95 | m_secondTap = false; | 95 | m_secondTap = false; | ||
96 | } | 96 | } | ||
97 | return true; | 97 | return true; | ||
98 | } | 98 | } | ||
99 | 99 | | |||
100 | bool DpmsInputEventFilter::touchMotion(quint32 id, const QPointF &pos, quint32 time) | 100 | bool DpmsInputEventFilter::touchMotion(qint32 id, const QPointF &pos, quint32 time) | ||
101 | { | 101 | { | ||
102 | Q_UNUSED(id) | 102 | Q_UNUSED(id) | ||
103 | Q_UNUSED(pos) | 103 | Q_UNUSED(pos) | ||
104 | Q_UNUSED(time) | 104 | Q_UNUSED(time) | ||
105 | // ignore the event | 105 | // ignore the event | ||
106 | return true; | 106 | return true; | ||
107 | } | 107 | } | ||
108 | 108 | | |||
109 | void DpmsInputEventFilter::notify() | 109 | void DpmsInputEventFilter::notify() | ||
110 | { | 110 | { | ||
111 | // queued to not modify the list of event filters while filtering | 111 | // queued to not modify the list of event filters while filtering | ||
112 | QMetaObject::invokeMethod(m_backend, "turnOutputsOn", Qt::QueuedConnection); | 112 | QMetaObject::invokeMethod(m_backend, "turnOutputsOn", Qt::QueuedConnection); | ||
113 | } | 113 | } | ||
114 | 114 | | |||
115 | } | 115 | } |