Changeset View
Changeset View
Standalone View
Standalone View
pointer_input.cpp
Show First 20 Lines • Show All 468 Lines • ▼ Show 20 Line(s) | |||||
469 | 469 | | |||
470 | void PointerInputRedirection::cleanupInternalWindow(QWindow *old, QWindow *now) | 470 | void PointerInputRedirection::cleanupInternalWindow(QWindow *old, QWindow *now) | ||
471 | { | 471 | { | ||
472 | disconnect(m_internalWindowConnection); | 472 | disconnect(m_internalWindowConnection); | ||
473 | m_internalWindowConnection = QMetaObject::Connection(); | 473 | m_internalWindowConnection = QMetaObject::Connection(); | ||
474 | 474 | | |||
475 | if (old) { | 475 | if (old) { | ||
476 | // leave internal window | 476 | // leave internal window | ||
477 | // TODO: do this instead via Wayland protocol as below | | |||
478 | QEvent leaveEvent(QEvent::Leave); | 477 | QEvent leaveEvent(QEvent::Leave); | ||
479 | QCoreApplication::sendEvent(old, &leaveEvent); | 478 | QCoreApplication::sendEvent(old, &leaveEvent); | ||
480 | } | 479 | } | ||
481 | 480 | | |||
482 | if (now) { | 481 | if (now) { | ||
483 | m_internalWindowConnection = connect(internalWindow().data(), &QWindow::visibleChanged, this, | 482 | m_internalWindowConnection = connect(internalWindow().data(), &QWindow::visibleChanged, this, | ||
484 | [this] (bool visible) { | 483 | [this] (bool visible) { | ||
485 | if (!visible) { | 484 | if (!visible) { | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 536 | { | |||
543 | disconnect(m_focusGeometryConnection); | 542 | disconnect(m_focusGeometryConnection); | ||
544 | m_focusGeometryConnection = QMetaObject::Connection(); | 543 | m_focusGeometryConnection = QMetaObject::Connection(); | ||
545 | 544 | | |||
546 | if (AbstractClient *ac = qobject_cast<AbstractClient*>(focusNow)) { | 545 | if (AbstractClient *ac = qobject_cast<AbstractClient*>(focusNow)) { | ||
547 | ac->enterEvent(m_pos.toPoint()); | 546 | ac->enterEvent(m_pos.toPoint()); | ||
548 | workspace()->updateFocusMousePosition(m_pos.toPoint()); | 547 | workspace()->updateFocusMousePosition(m_pos.toPoint()); | ||
549 | } | 548 | } | ||
550 | 549 | | |||
551 | auto seat = waylandServer()->seat(); | | |||
552 | if (!focusNow || !focusNow->surface() || decoration()) { | | |||
553 | // no new surface or internal window or on decoration -> cleanup | | |||
554 | warpXcbOnSurfaceLeft(nullptr); | | |||
555 | seat->setFocusedPointerSurface(nullptr); | | |||
556 | return; | | |||
557 | } | | |||
558 | | ||||
559 | if (internalWindow()) { | 550 | if (internalWindow()) { | ||
560 | // enter internal window | 551 | // enter internal window | ||
561 | // TODO: do this instead via Wayland protocol as below | | |||
562 | const auto pos = at()->pos(); | 552 | const auto pos = at()->pos(); | ||
563 | QEnterEvent enterEvent(pos, pos, m_pos); | 553 | QEnterEvent enterEvent(pos, pos, m_pos); | ||
564 | QCoreApplication::sendEvent(internalWindow().data(), &enterEvent); | 554 | QCoreApplication::sendEvent(internalWindow().data(), &enterEvent); | ||
565 | } | 555 | } | ||
566 | 556 | | |||
557 | auto seat = waylandServer()->seat(); | ||||
558 | if (!focusNow || !focusNow->surface() || decoration()) { | ||||
559 | // Clean up focused pointer surface if there's no client to take focus, | ||||
romangg: Use full sentences. | |||||
560 | // or the pointer is on a client without surface or on a decoration. | ||||
561 | warpXcbOnSurfaceLeft(nullptr); | ||||
562 | seat->setFocusedPointerSurface(nullptr); | ||||
563 | return; | ||||
564 | } | ||||
565 | | ||||
567 | // TODO: add convenient API to update global pos together with updating focused surface | 566 | // TODO: add convenient API to update global pos together with updating focused surface | ||
568 | warpXcbOnSurfaceLeft(focusNow->surface()); | 567 | warpXcbOnSurfaceLeft(focusNow->surface()); | ||
569 | 568 | | |||
570 | // TODO: why? in order to reset the cursor icon? | 569 | // TODO: why? in order to reset the cursor icon? | ||
571 | s_cursorUpdateBlocking = true; | 570 | s_cursorUpdateBlocking = true; | ||
572 | seat->setFocusedPointerSurface(nullptr); | 571 | seat->setFocusedPointerSurface(nullptr); | ||
573 | s_cursorUpdateBlocking = false; | 572 | s_cursorUpdateBlocking = false; | ||
574 | 573 | | |||
▲ Show 20 Lines • Show All 837 Lines • Show Last 20 Lines |
Use full sentences.