Example #1
0
void QSGWindowsRenderLoop::exposureChanged(QQuickWindow *window)
{

    if (windowData(window) == 0)
        return;

    if (window->isExposed() && window->isVisible()) {

        // Stop non-visual animation timer as we now have a window rendering
        if (m_animationTimer && anyoneShowing()) {
            RLDEBUG(" - stopping non-visual animation timer");
            killTimer(m_animationTimer);
            m_animationTimer = 0;
        }

        RLDEBUG("exposureChanged - exposed");
        WindowData *wd = windowData(window);
        wd->pendingUpdate = true;

        // If we have a pending timer and we get an expose, we need to stop it.
        // Otherwise we get two frames and two animation ticks in the same time-interval.
        if (m_updateTimer) {
            RLDEBUG(" - killing pending update timer");
            killTimer(m_updateTimer);
            m_updateTimer = 0;
        }
        render();
    } else {
        handleObscurity();
    }
}
Example #2
0
void QSGWindowsRenderLoop::hide(QQuickWindow *window)
{
    RLDEBUG("hide");
    // The expose event is queued while hide is sent synchronously, so
    // the value might not be updated yet. (plus that the windows plugin
    // sends exposed=true when it goes to hidden, so it is doubly broken)
    // The check is made here, after the removal from m_windows, so
    // anyoneShowing will report the right value.
    if (window->isExposed())
        handleObscurity();
    if (!m_gl)
        return;
    QQuickWindowPrivate::get(window)->fireAboutToStop();
}
void QSGWindowsRenderLoop::hide(QQuickWindow *window)
{
    RLDEBUG("hide");

    for (int i=0; i<m_windows.size(); ++i) {
        if (m_windows.at(i).window == window) {
            m_windows.removeAt(i);
            break;
        }
    }

    // The expose event is queued while hide is sent synchronously, so
    // the value might not be updated yet. (plus that the windows plugin
    // sends exposed=true when it goes to hidden, so it is doubly broken)
    // The check is made here, after the removal from m_windows, so
    // anyoneShowing will report the right value.
    if (window->isExposed())
        handleObscurity();

    if (!m_gl)
        return;

    QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
    m_gl->makeCurrent(window);
    cd->cleanupNodesOnShutdown();

    // If this is the last tracked window, check for persistent SG and GL and
    // potentially clean up.
    if (m_windows.size() == 0) {
        if (!cd->persistentSceneGraph) {
            QQuickWindowPrivate::get(window)->context->invalidate();
            QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
            if (!cd->persistentGLContext) {
                delete m_gl;
                m_gl = 0;
            }
        }
    }
}