Changeset View
Changeset View
Standalone View
Standalone View
input.cpp
Show First 20 Lines • Show All 436 Lines • ▼ Show 20 Line(s) | 433 | bool touchUp(quint32 id, quint32 time) override { | |||
---|---|---|---|---|---|
437 | return static_cast< EffectsHandlerImpl* >(effects)->touchUp(id, time); | 437 | return static_cast< EffectsHandlerImpl* >(effects)->touchUp(id, time); | ||
438 | } | 438 | } | ||
439 | }; | 439 | }; | ||
440 | 440 | | |||
441 | class MoveResizeFilter : public InputEventFilter { | 441 | class MoveResizeFilter : public InputEventFilter { | ||
442 | public: | 442 | public: | ||
443 | bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override { | 443 | bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override { | ||
444 | Q_UNUSED(nativeButton) | 444 | Q_UNUSED(nativeButton) | ||
445 | AbstractClient *c = workspace()->getMovingClient(); | 445 | AbstractClient *c = workspace()->moveResizeClient(); | ||
446 | if (!c) { | 446 | if (!c) { | ||
447 | return false; | 447 | return false; | ||
448 | } | 448 | } | ||
449 | switch (event->type()) { | 449 | switch (event->type()) { | ||
450 | case QEvent::MouseMove: | 450 | case QEvent::MouseMove: | ||
451 | c->updateMoveResize(event->screenPos().toPoint()); | 451 | c->updateMoveResize(event->screenPos().toPoint()); | ||
452 | break; | 452 | break; | ||
453 | case QEvent::MouseButtonRelease: | 453 | case QEvent::MouseButtonRelease: | ||
454 | if (event->buttons() == Qt::NoButton) { | 454 | if (event->buttons() == Qt::NoButton) { | ||
455 | c->endMoveResize(); | 455 | c->endMoveResize(); | ||
456 | } | 456 | } | ||
457 | break; | 457 | break; | ||
458 | default: | 458 | default: | ||
459 | break; | 459 | break; | ||
460 | } | 460 | } | ||
461 | return true; | 461 | return true; | ||
462 | } | 462 | } | ||
463 | bool wheelEvent(QWheelEvent *event) override { | 463 | bool wheelEvent(QWheelEvent *event) override { | ||
464 | Q_UNUSED(event) | 464 | Q_UNUSED(event) | ||
465 | // filter out while moving a window | 465 | // filter out while moving a window | ||
466 | return workspace()->getMovingClient() != nullptr; | 466 | return workspace()->moveResizeClient() != nullptr; | ||
467 | } | 467 | } | ||
468 | bool keyEvent(QKeyEvent *event) override { | 468 | bool keyEvent(QKeyEvent *event) override { | ||
469 | AbstractClient *c = workspace()->getMovingClient(); | 469 | AbstractClient *c = workspace()->moveResizeClient(); | ||
470 | if (!c) { | 470 | if (!c) { | ||
471 | return false; | 471 | return false; | ||
472 | } | 472 | } | ||
473 | if (event->type() == QEvent::KeyPress) { | 473 | if (event->type() == QEvent::KeyPress) { | ||
474 | c->keyPressEvent(event->key() | event->modifiers()); | 474 | c->keyPressEvent(event->key() | event->modifiers()); | ||
475 | if (c->isMove() || c->isResize()) { | 475 | if (c->isMove() || c->isResize()) { | ||
476 | // only update if mode didn't end | 476 | // only update if mode didn't end | ||
477 | c->updateMoveResize(input()->globalPointer()); | 477 | c->updateMoveResize(input()->globalPointer()); | ||
478 | } | 478 | } | ||
479 | } | 479 | } | ||
480 | return true; | 480 | return true; | ||
481 | } | 481 | } | ||
482 | 482 | | |||
483 | bool touchDown(quint32 id, const QPointF &pos, quint32 time) override { | 483 | bool touchDown(quint32 id, const QPointF &pos, quint32 time) override { | ||
484 | Q_UNUSED(id) | 484 | Q_UNUSED(id) | ||
485 | Q_UNUSED(pos) | 485 | Q_UNUSED(pos) | ||
486 | Q_UNUSED(time) | 486 | Q_UNUSED(time) | ||
487 | AbstractClient *c = workspace()->getMovingClient(); | 487 | AbstractClient *c = workspace()->moveResizeClient(); | ||
488 | if (!c) { | 488 | if (!c) { | ||
489 | return false; | 489 | return false; | ||
490 | } | 490 | } | ||
491 | return true; | 491 | return true; | ||
492 | } | 492 | } | ||
493 | 493 | | |||
494 | bool touchMotion(quint32 id, const QPointF &pos, quint32 time) override { | 494 | bool touchMotion(quint32 id, const QPointF &pos, quint32 time) override { | ||
495 | Q_UNUSED(time) | 495 | Q_UNUSED(time) | ||
496 | AbstractClient *c = workspace()->getMovingClient(); | 496 | AbstractClient *c = workspace()->moveResizeClient(); | ||
497 | if (!c) { | 497 | if (!c) { | ||
498 | return false; | 498 | return false; | ||
499 | } | 499 | } | ||
500 | if (!m_set) { | 500 | if (!m_set) { | ||
501 | m_id = id; | 501 | m_id = id; | ||
502 | m_set = true; | 502 | m_set = true; | ||
503 | } | 503 | } | ||
504 | if (m_id == id) { | 504 | if (m_id == id) { | ||
505 | c->updateMoveResize(pos.toPoint()); | 505 | c->updateMoveResize(pos.toPoint()); | ||
506 | } | 506 | } | ||
507 | return true; | 507 | return true; | ||
508 | } | 508 | } | ||
509 | 509 | | |||
510 | bool touchUp(quint32 id, quint32 time) override { | 510 | bool touchUp(quint32 id, quint32 time) override { | ||
511 | Q_UNUSED(time) | 511 | Q_UNUSED(time) | ||
512 | AbstractClient *c = workspace()->getMovingClient(); | 512 | AbstractClient *c = workspace()->moveResizeClient(); | ||
513 | if (!c) { | 513 | if (!c) { | ||
514 | return false; | 514 | return false; | ||
515 | } | 515 | } | ||
516 | if (m_id == id || !m_set) { | 516 | if (m_id == id || !m_set) { | ||
517 | c->endMoveResize(); | 517 | c->endMoveResize(); | ||
518 | m_set = false; | 518 | m_set = false; | ||
519 | // pass through to update decoration filter later on | 519 | // pass through to update decoration filter later on | ||
520 | return false; | 520 | return false; | ||
▲ Show 20 Lines • Show All 1869 Lines • Show Last 20 Lines |