Changeset View
Changeset View
Standalone View
Standalone View
pointer_input.cpp
Show First 20 Lines • Show All 223 Lines • ▼ Show 20 Line(s) | 223 | { | |||
---|---|---|---|---|---|
224 | if (!m_inited) { | 224 | if (!m_inited) { | ||
225 | return; | 225 | return; | ||
226 | } | 226 | } | ||
227 | updatePosition(pos); | 227 | updatePosition(pos); | ||
228 | MouseEvent event(QEvent::MouseMove, m_pos, Qt::NoButton, m_qtButtons, | 228 | MouseEvent event(QEvent::MouseMove, m_pos, Qt::NoButton, m_qtButtons, | ||
229 | m_input->keyboardModifiers(), time, | 229 | m_input->keyboardModifiers(), time, | ||
230 | delta, deltaNonAccelerated, timeUsec, device); | 230 | delta, deltaNonAccelerated, timeUsec, device); | ||
231 | 231 | | |||
232 | const auto &filters = m_input->filters(); | 232 | m_input->processFilters(std::bind(&InputEventFilter::pointerEvent, std::placeholders::_1, &event, 0)); | ||
233 | for (auto it = filters.begin(), end = filters.end(); it != end; it++) { | | |||
234 | if ((*it)->pointerEvent(&event, 0)) { | | |||
235 | return; | | |||
236 | } | | |||
237 | } | | |||
238 | } | 233 | } | ||
239 | 234 | | |||
240 | void PointerInputRedirection::processButton(uint32_t button, InputRedirection::PointerButtonState state, uint32_t time, LibInput::Device *device) | 235 | void PointerInputRedirection::processButton(uint32_t button, InputRedirection::PointerButtonState state, uint32_t time, LibInput::Device *device) | ||
241 | { | 236 | { | ||
242 | updateButton(button, state); | 237 | updateButton(button, state); | ||
243 | 238 | | |||
244 | if (!m_inited) { | 239 | if (!m_inited) { | ||
245 | return; | 240 | return; | ||
Show All 10 Lines | |||||
256 | default: | 251 | default: | ||
257 | Q_UNREACHABLE(); | 252 | Q_UNREACHABLE(); | ||
258 | return; | 253 | return; | ||
259 | } | 254 | } | ||
260 | 255 | | |||
261 | MouseEvent event(type, m_pos, buttonToQtMouseButton(button), m_qtButtons, | 256 | MouseEvent event(type, m_pos, buttonToQtMouseButton(button), m_qtButtons, | ||
262 | m_input->keyboardModifiers(), time, QSizeF(), QSizeF(), 0, device); | 257 | m_input->keyboardModifiers(), time, QSizeF(), QSizeF(), 0, device); | ||
263 | 258 | | |||
264 | const auto &filters = m_input->filters(); | 259 | m_input->processFilters(std::bind(&InputEventFilter::pointerEvent, std::placeholders::_1, &event, button)); | ||
265 | for (auto it = filters.begin(), end = filters.end(); it != end; it++) { | | |||
266 | if ((*it)->pointerEvent(&event, button)) { | | |||
267 | return; | | |||
268 | } | | |||
269 | } | | |||
270 | } | 260 | } | ||
271 | 261 | | |||
272 | void PointerInputRedirection::processAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time, LibInput::Device *device) | 262 | void PointerInputRedirection::processAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time, LibInput::Device *device) | ||
273 | { | 263 | { | ||
274 | if (delta == 0) { | 264 | if (delta == 0) { | ||
275 | return; | 265 | return; | ||
276 | } | 266 | } | ||
277 | 267 | | |||
278 | emit m_input->pointerAxisChanged(axis, delta); | 268 | emit m_input->pointerAxisChanged(axis, delta); | ||
279 | 269 | | |||
280 | if (!m_inited) { | 270 | if (!m_inited) { | ||
281 | return; | 271 | return; | ||
282 | } | 272 | } | ||
283 | 273 | | |||
284 | WheelEvent wheelEvent(m_pos, delta, | 274 | WheelEvent wheelEvent(m_pos, delta, | ||
285 | (axis == InputRedirection::PointerAxisHorizontal) ? Qt::Horizontal : Qt::Vertical, | 275 | (axis == InputRedirection::PointerAxisHorizontal) ? Qt::Horizontal : Qt::Vertical, | ||
286 | m_qtButtons, m_input->keyboardModifiers(), time, device); | 276 | m_qtButtons, m_input->keyboardModifiers(), time, device); | ||
287 | 277 | | |||
288 | const auto &filters = m_input->filters(); | 278 | m_input->processFilters(std::bind(&InputEventFilter::wheelEvent, std::placeholders::_1, &wheelEvent)); | ||
289 | for (auto it = filters.begin(), end = filters.end(); it != end; it++) { | | |||
290 | if ((*it)->wheelEvent(&wheelEvent)) { | | |||
291 | return; | | |||
292 | } | | |||
293 | } | | |||
294 | } | 279 | } | ||
295 | 280 | | |||
296 | void PointerInputRedirection::processSwipeGestureBegin(int fingerCount, quint32 time, KWin::LibInput::Device *device) | 281 | void PointerInputRedirection::processSwipeGestureBegin(int fingerCount, quint32 time, KWin::LibInput::Device *device) | ||
297 | { | 282 | { | ||
298 | Q_UNUSED(device) | 283 | Q_UNUSED(device) | ||
299 | if (!m_inited) { | 284 | if (!m_inited) { | ||
300 | return; | 285 | return; | ||
301 | } | 286 | } | ||
302 | 287 | | |||
303 | const auto &filters = m_input->filters(); | 288 | m_input->processFilters(std::bind(&InputEventFilter::swipeGestureBegin, std::placeholders::_1, fingerCount, time)); | ||
304 | for (auto it = filters.begin(), end = filters.end(); it != end; it++) { | | |||
305 | if ((*it)->swipeGestureBegin(fingerCount, time)) { | | |||
306 | return; | | |||
307 | } | | |||
308 | } | | |||
309 | } | 289 | } | ||
310 | 290 | | |||
311 | void PointerInputRedirection::processSwipeGestureUpdate(const QSizeF &delta, quint32 time, KWin::LibInput::Device *device) | 291 | void PointerInputRedirection::processSwipeGestureUpdate(const QSizeF &delta, quint32 time, KWin::LibInput::Device *device) | ||
312 | { | 292 | { | ||
313 | Q_UNUSED(device) | 293 | Q_UNUSED(device) | ||
314 | if (!m_inited) { | 294 | if (!m_inited) { | ||
315 | return; | 295 | return; | ||
316 | } | 296 | } | ||
317 | 297 | | |||
318 | const auto &filters = m_input->filters(); | 298 | m_input->processFilters(std::bind(&InputEventFilter::swipeGestureUpdate, std::placeholders::_1, delta, time)); | ||
319 | for (auto it = filters.begin(), end = filters.end(); it != end; it++) { | | |||
320 | if ((*it)->swipeGestureUpdate(delta, time)) { | | |||
321 | return; | | |||
322 | } | | |||
323 | } | | |||
324 | } | 299 | } | ||
325 | 300 | | |||
326 | void PointerInputRedirection::processSwipeGestureEnd(quint32 time, KWin::LibInput::Device *device) | 301 | void PointerInputRedirection::processSwipeGestureEnd(quint32 time, KWin::LibInput::Device *device) | ||
327 | { | 302 | { | ||
328 | Q_UNUSED(device) | 303 | Q_UNUSED(device) | ||
329 | if (!m_inited) { | 304 | if (!m_inited) { | ||
330 | return; | 305 | return; | ||
331 | } | 306 | } | ||
332 | 307 | | |||
333 | const auto &filters = m_input->filters(); | 308 | m_input->processFilters(std::bind(&InputEventFilter::swipeGestureEnd, std::placeholders::_1, time)); | ||
334 | for (auto it = filters.begin(), end = filters.end(); it != end; it++) { | | |||
335 | if ((*it)->swipeGestureEnd(time)) { | | |||
336 | return; | | |||
337 | } | | |||
338 | } | | |||
339 | } | 309 | } | ||
340 | 310 | | |||
341 | void PointerInputRedirection::processSwipeGestureCancelled(quint32 time, KWin::LibInput::Device *device) | 311 | void PointerInputRedirection::processSwipeGestureCancelled(quint32 time, KWin::LibInput::Device *device) | ||
342 | { | 312 | { | ||
343 | Q_UNUSED(device) | 313 | Q_UNUSED(device) | ||
344 | if (!m_inited) { | 314 | if (!m_inited) { | ||
345 | return; | 315 | return; | ||
346 | } | 316 | } | ||
347 | 317 | | |||
348 | const auto &filters = m_input->filters(); | 318 | m_input->processFilters(std::bind(&InputEventFilter::swipeGestureCancelled, std::placeholders::_1, time)); | ||
349 | for (auto it = filters.begin(), end = filters.end(); it != end; it++) { | | |||
350 | if ((*it)->swipeGestureCancelled(time)) { | | |||
351 | return; | | |||
352 | } | | |||
353 | } | | |||
354 | } | 319 | } | ||
355 | 320 | | |||
356 | void PointerInputRedirection::processPinchGestureBegin(int fingerCount, quint32 time, KWin::LibInput::Device *device) | 321 | void PointerInputRedirection::processPinchGestureBegin(int fingerCount, quint32 time, KWin::LibInput::Device *device) | ||
357 | { | 322 | { | ||
358 | Q_UNUSED(device) | 323 | Q_UNUSED(device) | ||
359 | if (!m_inited) { | 324 | if (!m_inited) { | ||
360 | return; | 325 | return; | ||
361 | } | 326 | } | ||
362 | 327 | | |||
363 | const auto &filters = m_input->filters(); | 328 | m_input->processFilters(std::bind(&InputEventFilter::pinchGestureBegin, std::placeholders::_1, fingerCount, time)); | ||
364 | for (auto it = filters.begin(), end = filters.end(); it != end; it++) { | | |||
365 | if ((*it)->pinchGestureBegin(fingerCount, time)) { | | |||
366 | return; | | |||
367 | } | | |||
368 | } | | |||
369 | } | 329 | } | ||
370 | 330 | | |||
371 | void PointerInputRedirection::processPinchGestureUpdate(qreal scale, qreal angleDelta, const QSizeF &delta, quint32 time, KWin::LibInput::Device *device) | 331 | void PointerInputRedirection::processPinchGestureUpdate(qreal scale, qreal angleDelta, const QSizeF &delta, quint32 time, KWin::LibInput::Device *device) | ||
372 | { | 332 | { | ||
373 | Q_UNUSED(device) | 333 | Q_UNUSED(device) | ||
374 | if (!m_inited) { | 334 | if (!m_inited) { | ||
375 | return; | 335 | return; | ||
376 | } | 336 | } | ||
377 | 337 | | |||
378 | const auto &filters = m_input->filters(); | 338 | m_input->processFilters(std::bind(&InputEventFilter::pinchGestureUpdate, std::placeholders::_1, scale, angleDelta, delta, time)); | ||
379 | for (auto it = filters.begin(), end = filters.end(); it != end; it++) { | | |||
380 | if ((*it)->pinchGestureUpdate(scale, angleDelta, delta, time)) { | | |||
381 | return; | | |||
382 | } | | |||
383 | } | | |||
384 | } | 339 | } | ||
385 | 340 | | |||
386 | void PointerInputRedirection::processPinchGestureEnd(quint32 time, KWin::LibInput::Device *device) | 341 | void PointerInputRedirection::processPinchGestureEnd(quint32 time, KWin::LibInput::Device *device) | ||
387 | { | 342 | { | ||
388 | Q_UNUSED(device) | 343 | Q_UNUSED(device) | ||
389 | if (!m_inited) { | 344 | if (!m_inited) { | ||
390 | return; | 345 | return; | ||
391 | } | 346 | } | ||
392 | 347 | | |||
393 | const auto &filters = m_input->filters(); | 348 | m_input->processFilters(std::bind(&InputEventFilter::pinchGestureEnd, std::placeholders::_1, time)); | ||
394 | for (auto it = filters.begin(), end = filters.end(); it != end; it++) { | | |||
395 | if ((*it)->pinchGestureEnd(time)) { | | |||
396 | return; | | |||
397 | } | | |||
398 | } | | |||
399 | } | 349 | } | ||
400 | 350 | | |||
401 | void PointerInputRedirection::processPinchGestureCancelled(quint32 time, KWin::LibInput::Device *device) | 351 | void PointerInputRedirection::processPinchGestureCancelled(quint32 time, KWin::LibInput::Device *device) | ||
402 | { | 352 | { | ||
403 | Q_UNUSED(device) | 353 | Q_UNUSED(device) | ||
404 | if (!m_inited) { | 354 | if (!m_inited) { | ||
405 | return; | 355 | return; | ||
406 | } | 356 | } | ||
407 | 357 | | |||
408 | const auto &filters = m_input->filters(); | 358 | m_input->processFilters(std::bind(&InputEventFilter::pinchGestureCancelled, std::placeholders::_1, time)); | ||
409 | for (auto it = filters.begin(), end = filters.end(); it != end; it++) { | | |||
410 | if ((*it)->pinchGestureCancelled(time)) { | | |||
411 | return; | | |||
412 | } | | |||
413 | } | | |||
414 | } | 359 | } | ||
415 | 360 | | |||
416 | void PointerInputRedirection::update() | 361 | void PointerInputRedirection::update() | ||
417 | { | 362 | { | ||
418 | if (!m_inited) { | 363 | if (!m_inited) { | ||
419 | return; | 364 | return; | ||
420 | } | 365 | } | ||
421 | if (waylandServer()->seat()->isDragPointer()) { | 366 | if (waylandServer()->seat()->isDragPointer()) { | ||
▲ Show 20 Lines • Show All 839 Lines • Show Last 20 Lines |