Changeset View
Changeset View
Standalone View
Standalone View
touch_input.cpp
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | 70 | { | |||
---|---|---|---|---|---|
73 | } | 73 | } | ||
74 | if (m_windowUpdatedInCycle) { | 74 | if (m_windowUpdatedInCycle) { | ||
75 | return true; | 75 | return true; | ||
76 | } | 76 | } | ||
77 | m_windowUpdatedInCycle = true; | 77 | m_windowUpdatedInCycle = true; | ||
78 | if (waylandServer()->seat()->isDragTouch()) { | 78 | if (waylandServer()->seat()->isDragTouch()) { | ||
79 | return true; | 79 | return true; | ||
80 | } | 80 | } | ||
81 | if (m_touches > 0) { | 81 | if (m_touches > 1) { | ||
82 | // first touch defines focus | 82 | // first touch defines focus | ||
83 | return true; | 83 | return true; | ||
84 | } | 84 | } | ||
85 | return false; | 85 | return false; | ||
86 | } | 86 | } | ||
87 | 87 | | |||
88 | bool TouchInputRedirection::positionValid() const | ||||
davidedmundson: It's a weird name.
It's not like focusUpdateBlocked, where we're blocking changes, but that we… | |||||
89 | { | ||||
90 | Q_ASSERT(m_touches >= 0); | ||||
91 | // we can only determine a position with atleast one touch point | ||||
92 | return m_touches == 0; | ||||
93 | } | ||||
94 | | ||||
88 | void TouchInputRedirection::focusUpdate(Toplevel *focusOld, Toplevel *focusNow) | 95 | void TouchInputRedirection::focusUpdate(Toplevel *focusOld, Toplevel *focusNow) | ||
89 | { | 96 | { | ||
90 | // TODO: handle pointer grab aka popups | 97 | // TODO: handle pointer grab aka popups | ||
91 | 98 | | |||
92 | if (AbstractClient *ac = qobject_cast<AbstractClient*>(focusOld)) { | 99 | if (AbstractClient *ac = qobject_cast<AbstractClient*>(focusOld)) { | ||
93 | ac->leaveEvent(); | 100 | ac->leaveEvent(); | ||
94 | } | 101 | } | ||
95 | disconnect(m_focusGeometryConnection); | 102 | disconnect(m_focusGeometryConnection); | ||
Show All 36 Lines | 136 | { | |||
132 | 139 | | |||
133 | // nothing to do | 140 | // nothing to do | ||
134 | } | 141 | } | ||
135 | 142 | | |||
136 | void TouchInputRedirection::cleanupDecoration(Decoration::DecoratedClientImpl *old, Decoration::DecoratedClientImpl *now) | 143 | void TouchInputRedirection::cleanupDecoration(Decoration::DecoratedClientImpl *old, Decoration::DecoratedClientImpl *now) | ||
137 | { | 144 | { | ||
138 | Q_UNUSED(now); | 145 | Q_UNUSED(now); | ||
139 | 146 | | |||
140 | if (old) { | 147 | if (old) { | ||
Unrelated. Though the change makes sense, consider it reviewed here. davidedmundson: Unrelated.
Please put in a new commit with a new message.
Though the change makes sense… | |||||
It's not unrelated, because with this change this function always gets called when all touch points go away again. Before that the filter is run with the same code, which leads to two leave events, making another autotest fail. But I'll put it in a second commit and say in the message which other autotest fails otherwise (have to look it up again). romangg: It's not unrelated, because with this change this function always gets called when all touch… | |||||
141 | // send leave event to old decoration | 148 | // send leave event to old decoration | ||
142 | QHoverEvent event(QEvent::HoverLeave, QPointF(), QPointF()); | 149 | QHoverEvent event(QEvent::HoverLeave, QPointF(), QPointF()); | ||
143 | QCoreApplication::instance()->sendEvent(old->decoration(), &event); | 150 | QCoreApplication::instance()->sendEvent(old->decoration(), &event); | ||
144 | } | 151 | } | ||
145 | } | 152 | } | ||
146 | 153 | | |||
147 | void TouchInputRedirection::insertId(quint32 internalId, qint32 kwaylandId) | 154 | void TouchInputRedirection::insertId(quint32 internalId, qint32 kwaylandId) | ||
148 | { | 155 | { | ||
Show All 17 Lines | |||||
166 | void TouchInputRedirection::processDown(qint32 id, const QPointF &pos, quint32 time, LibInput::Device *device) | 173 | void TouchInputRedirection::processDown(qint32 id, const QPointF &pos, quint32 time, LibInput::Device *device) | ||
167 | { | 174 | { | ||
168 | Q_UNUSED(device) | 175 | Q_UNUSED(device) | ||
169 | if (!inited()) { | 176 | if (!inited()) { | ||
170 | return; | 177 | return; | ||
171 | } | 178 | } | ||
172 | m_lastPosition = pos; | 179 | m_lastPosition = pos; | ||
173 | m_windowUpdatedInCycle = false; | 180 | m_windowUpdatedInCycle = false; | ||
174 | if (m_touches == 0) { | 181 | m_touches++; | ||
182 | if (m_touches == 1) { | ||||
175 | update(); | 183 | update(); | ||
176 | } | 184 | } | ||
177 | m_touches++; | | |||
178 | input()->processSpies(std::bind(&InputEventSpy::touchDown, std::placeholders::_1, id, pos, time)); | 185 | input()->processSpies(std::bind(&InputEventSpy::touchDown, std::placeholders::_1, id, pos, time)); | ||
179 | input()->processFilters(std::bind(&InputEventFilter::touchDown, std::placeholders::_1, id, pos, time)); | 186 | input()->processFilters(std::bind(&InputEventFilter::touchDown, std::placeholders::_1, id, pos, time)); | ||
180 | m_windowUpdatedInCycle = false; | 187 | m_windowUpdatedInCycle = false; | ||
181 | } | 188 | } | ||
182 | 189 | | |||
183 | void TouchInputRedirection::processUp(qint32 id, quint32 time, LibInput::Device *device) | 190 | void TouchInputRedirection::processUp(qint32 id, quint32 time, LibInput::Device *device) | ||
184 | { | 191 | { | ||
185 | Q_UNUSED(device) | 192 | Q_UNUSED(device) | ||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |
It's a weird name.
It's not like focusUpdateBlocked, where we're blocking changes, but that we want to actively unset "at" next update.
I would suggest something like "positionValid".