Changeset View
Changeset View
Standalone View
Standalone View
composite.cpp
Show First 20 Lines • Show All 398 Lines • ▼ Show 20 Line(s) | 386 | { | |||
---|---|---|---|---|---|
399 | // But on the other side Present extension does not allow to sync with another screen | 399 | // But on the other side Present extension does not allow to sync with another screen | ||
400 | // anyway. | 400 | // anyway. | ||
401 | 401 | | |||
402 | if (m_scene->hasSwapEvent()) { | 402 | if (m_scene->hasSwapEvent()) { | ||
403 | // TODO: If we don't call it back from the event loop we often crash on Wayland | 403 | // TODO: If we don't call it back from the event loop we often crash on Wayland | ||
404 | // in AnimationEffect::postPaintScreen. Why? | 404 | // in AnimationEffect::postPaintScreen. Why? | ||
405 | // Theory is that effects call addRepaintFull in there and then performCompositing | 405 | // Theory is that effects call addRepaintFull in there and then performCompositing | ||
406 | // is called again while still in the first paint. So queing it here makes sense! | 406 | // is called again while still in the first paint. So queing it here makes sense! | ||
407 | QTimer::singleShot(0, this, [this]() { performCompositing(); }); | 407 | compositeTimer.start(0, this); | ||
408 | } else { | 408 | } else { | ||
409 | setCompositeTimer(); | 409 | setCompositeTimer(); | ||
410 | } | 410 | } | ||
411 | } | 411 | } | ||
412 | 412 | | |||
413 | void Compositor::stop() | 413 | void Compositor::stop() | ||
414 | { | 414 | { | ||
415 | if (m_state == State::Off || m_state == State::Stopping) { | 415 | if (m_state == State::Off || m_state == State::Stopping) { | ||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 463 | if (waylandServer()) { | |||
466 | } | 466 | } | ||
467 | for (XdgShellClient *c : waylandServer()->clients()) { | 467 | for (XdgShellClient *c : waylandServer()->clients()) { | ||
468 | c->finishCompositing(); | 468 | c->finishCompositing(); | ||
469 | } | 469 | } | ||
470 | } | 470 | } | ||
471 | 471 | | |||
472 | delete m_scene; | 472 | delete m_scene; | ||
473 | m_scene = nullptr; | 473 | m_scene = nullptr; | ||
474 | m_bufferSwapPending = false; | ||||
475 | m_composeAtSwapCompletion = false; | ||||
474 | compositeTimer.stop(); | 476 | compositeTimer.stop(); | ||
475 | repaints_region = QRegion(); | 477 | repaints_region = QRegion(); | ||
476 | 478 | | |||
477 | m_state = State::Off; | 479 | m_state = State::Off; | ||
478 | emit compositingToggled(false); | 480 | emit compositingToggled(false); | ||
479 | } | 481 | } | ||
480 | 482 | | |||
481 | void Compositor::destroyCompositorSelection() | 483 | void Compositor::destroyCompositorSelection() | ||
▲ Show 20 Lines • Show All 252 Lines • ▼ Show 20 Line(s) | 624 | { | |||
734 | // Stop here to ensure *we* cause the next repaint schedule - not some effect | 736 | // Stop here to ensure *we* cause the next repaint schedule - not some effect | ||
735 | // through m_scene->paint(). | 737 | // through m_scene->paint(). | ||
736 | compositeTimer.stop(); | 738 | compositeTimer.stop(); | ||
737 | 739 | | |||
738 | // Trigger at least one more pass even if there would be nothing to paint, so that scene->idle() | 740 | // Trigger at least one more pass even if there would be nothing to paint, so that scene->idle() | ||
739 | // is called the next time. If there would be nothing pending, it will not restart the timer and | 741 | // is called the next time. If there would be nothing pending, it will not restart the timer and | ||
740 | // scheduleRepaint() would restart it again somewhen later, called from functions that | 742 | // scheduleRepaint() would restart it again somewhen later, called from functions that | ||
741 | // would again add something pending. | 743 | // would again add something pending. | ||
742 | if (m_bufferSwapPending) { | 744 | Q_ASSERT(!m_bufferSwapPending); | ||
743 | m_composeAtSwapCompletion = true; | | |||
744 | } else { | | |||
745 | scheduleRepaint(); | 745 | scheduleRepaint(); | ||
746 | } | 746 | } | ||
747 | } | | |||
748 | 747 | | |||
749 | template <class T> | 748 | template <class T> | ||
750 | static bool repaintsPending(const QList<T*> &windows) | 749 | static bool repaintsPending(const QList<T*> &windows) | ||
751 | { | 750 | { | ||
752 | return std::any_of(windows.begin(), windows.end(), | 751 | return std::any_of(windows.begin(), windows.end(), | ||
753 | [](T *t) { return !t->repaints().isEmpty(); }); | 752 | [](T *t) { return !t->repaints().isEmpty(); }); | ||
754 | } | 753 | } | ||
755 | 754 | | |||
▲ Show 20 Lines • Show All 253 Lines • Show Last 20 Lines |