Changeset View
Changeset View
Standalone View
Standalone View
input.cpp
Show First 20 Lines • Show All 398 Lines • ▼ Show 20 Line(s) | |||||
399 | class PointerConstraintsFilter : public InputEventFilter { | 399 | class PointerConstraintsFilter : public InputEventFilter { | ||
400 | public: | 400 | public: | ||
401 | explicit PointerConstraintsFilter() | 401 | explicit PointerConstraintsFilter() | ||
402 | : InputEventFilter() | 402 | : InputEventFilter() | ||
403 | , m_timer(new QTimer) | 403 | , m_timer(new QTimer) | ||
404 | { | 404 | { | ||
405 | QObject::connect(m_timer.data(), &QTimer::timeout, | 405 | QObject::connect(m_timer.data(), &QTimer::timeout, | ||
406 | [this] { | 406 | [this] { | ||
407 | if (waylandServer()) { | ||||
408 | // break keyboard focus, this cancels the pressed ESC | ||||
409 | waylandServer()->seat()->setFocusedKeyboardSurface(nullptr); | ||||
410 | } | ||||
407 | input()->pointer()->breakPointerConstraints(); | 411 | input()->pointer()->breakPointerConstraints(); | ||
408 | input()->pointer()->blockPointerConstraints(); | 412 | input()->pointer()->blockPointerConstraints(); | ||
409 | // TODO: show notification | 413 | // TODO: show notification | ||
410 | waylandServer()->seat()->keyReleased(m_keyCode); | 414 | waylandServer()->seat()->keyReleased(m_keyCode); | ||
411 | cancel(); | 415 | cancel(); | ||
412 | } | 416 | } | ||
413 | ); | 417 | ); | ||
414 | } | 418 | } | ||
Show All 15 Lines | 432 | } else { | |||
430 | return false; | 434 | return false; | ||
431 | } | 435 | } | ||
432 | } else if (input()->pointer()->isConstrained()) { | 436 | } else if (input()->pointer()->isConstrained()) { | ||
433 | if (event->type() == QEvent::KeyPress && | 437 | if (event->type() == QEvent::KeyPress && | ||
434 | event->key() == Qt::Key_Escape && | 438 | event->key() == Qt::Key_Escape && | ||
435 | static_cast<KeyEvent*>(event)->modifiersRelevantForGlobalShortcuts() == Qt::KeyboardModifiers()) { | 439 | static_cast<KeyEvent*>(event)->modifiersRelevantForGlobalShortcuts() == Qt::KeyboardModifiers()) { | ||
436 | // TODO: don't hard code | 440 | // TODO: don't hard code | ||
437 | m_timer->start(3000); | 441 | m_timer->start(3000); | ||
438 | input()->keyboard()->update(); | | |||
439 | m_keyCode = event->nativeScanCode(); | 442 | m_keyCode = event->nativeScanCode(); | ||
440 | passToWaylandServer(event); | 443 | return false; | ||
441 | return true; | | |||
442 | } | 444 | } | ||
443 | } | 445 | } | ||
444 | return false; | 446 | return false; | ||
445 | } | 447 | } | ||
446 | 448 | | |||
447 | void cancel() { | 449 | void cancel() { | ||
448 | if (!isActive()) { | 450 | if (!isActive()) { | ||
449 | return; | 451 | return; | ||
▲ Show 20 Lines • Show All 1680 Lines • Show Last 20 Lines |