// At start up. void Engine::init() { std::cout << "INIT" << std::endl; { std::condition_variable cv; std::mutex m; std::unique_lock<std::mutex> lk(m); cv.wait(lk, [this]{ std::cout << "Waiting on data... (might be deadlock here :) )" << std::endl; return _data; }); std::cout << "GOT DATA SAFELY"<< std::endl; } // Connect QT Signals inorder to be able to use OpenGL connect(_window, SIGNAL(sceneGraphInitialized()), this, SLOT(initialize()), Qt::DirectConnection); connect(_window, SIGNAL(beforeSynchronizing()), this, SLOT(sync()), Qt::DirectConnection); connect(_window, SIGNAL(beforeRendering()), this, SLOT(paint()), Qt::DirectConnection); // Make sure QML don't clear what we paint. _window->setClearBeforeRendering(false); // Displays FPS in windowtitle. _timer = new QTimer(this); connect(_timer, SIGNAL(timeout()), this, SLOT(showFPS()), Qt::DirectConnection); _timer->start(50); std::cout << "INIT DONE" << std::endl; }
LipstickCompositor::LipstickCompositor() : QWaylandCompositor(this), m_totalWindowCount(0), m_nextWindowId(1), m_homeActive(true), m_shaderEffect(0), m_fullscreenSurface(0), m_directRenderingActive(false), m_topmostWindowId(0), m_screenOrientation(Qt::PrimaryOrientation), m_displayState(new MeeGo::QmDisplayState(this)), m_retainedSelection(0) { setColor(Qt::black); setRetainedSelectionEnabled(true); if (m_instance) qFatal("LipstickCompositor: Only one compositor instance per process is supported"); m_instance = this; QObject::connect(this, SIGNAL(frameSwapped()), this, SLOT(windowSwapped())); QObject::connect(this, SIGNAL(beforeSynchronizing()), this, SLOT(clearUpdateRequest())); connect(m_displayState, SIGNAL(displayStateChanged(MeeGo::QmDisplayState::DisplayState)), this, SLOT(reactOnDisplayStateChanges(MeeGo::QmDisplayState::DisplayState))); QObject::connect(HomeApplication::instance(), SIGNAL(aboutToDestroy()), this, SLOT(homeApplicationAboutToDestroy())); m_orientationSensor = new QOrientationSensor(this); QObject::connect(m_orientationSensor, SIGNAL(readingChanged()), this, SLOT(setScreenOrientationFromSensor())); if (!m_orientationSensor->connectToBackend()) { qWarning() << "Could not connect to the orientation sensor backend"; } else { if (!m_orientationSensor->start()) qWarning() << "Could not start the orientation sensor"; } emit HomeApplication::instance()->homeActiveChanged(); QDesktopServices::setUrlHandler("http", this, "openUrl"); QDesktopServices::setUrlHandler("https", this, "openUrl"); QDesktopServices::setUrlHandler("mailto", this, "openUrl"); connect(QGuiApplication::clipboard(), SIGNAL(dataChanged()), SLOT(clipboardDataChanged())); }
void Scene::handleWindowChanged(QQuickWindow *win) { if (win) { connect(win, SIGNAL(beforeSynchronizing()), this, SLOT(sync()), Qt::DirectConnection); connect(win, SIGNAL(sceneGraphInvalidated()), this, SLOT(cleanup()), Qt::DirectConnection); win->setClearBeforeRendering(false); } }
void ModelRenderer::windowChanged(QQuickWindow *window) { LOG_ENTER(); if( window != nullptr && window != m_window ){ window->setClearBeforeRendering(false); connect( window, SIGNAL(afterAnimating()), this, SLOT(afterAnimating()), Qt::DirectConnection ); connect( window, SIGNAL(afterRendering()), this, SLOT(afterRendering()), Qt::DirectConnection ); connect( window, SIGNAL(afterSynchronizing()), this, SLOT(afterSynchronizing()), Qt::DirectConnection ); connect( window, SIGNAL(beforeRendering()), this, SLOT(beforeRendering()), Qt::DirectConnection ); connect( window, SIGNAL(beforeSynchronizing()), this, SLOT(beforeSynchronizing()), Qt::DirectConnection ); connect( window, SIGNAL(frameSwapped()), this, SLOT(frameSwapped()), Qt::DirectConnection ); connect( window, SIGNAL(openglContextCreated(QOpenGLContext*)), this, SLOT(openglContextCreated(QOpenGLContext*)), Qt::DirectConnection ); connect( window, SIGNAL(sceneGraphError(QQuickWindow::SceneGraphError,QString)), this, SLOT(sceneGraphError(QQuickWindow::SceneGraphError,QString)), Qt::DirectConnection ); connect( window, SIGNAL(sceneGraphInitialized()), this, SLOT(sceneGraphInitialized()), Qt::DirectConnection ); connect( window, SIGNAL(sceneGraphInvalidated()), this, SLOT(sceneGraphInvalidated()),Qt::DirectConnection ); }
void QGLView::handleWindowChanged(QQuickWindow *win) { if (win) { // Connect the beforeRendering signal to our paint function. // Since this call is executed on the rendering thread it must be // a Qt::DirectConnection connect(win, SIGNAL(beforeSynchronizing()), this, SLOT(sync()), Qt::DirectConnection); connect(this, SIGNAL(widthChanged()), this, SLOT(updatePerspectiveAspectRatio())); connect(this, SIGNAL(heightChanged()), this, SLOT(updatePerspectiveAspectRatio())); updatePerspectiveAspectRatio(); // set current aspect ratio since signals will only be handled on change // If we allow QML to do the clearing, they would clear what we paint // and nothing would show. //win->setClearBeforeRendering(true); } }
LipstickCompositor::LipstickCompositor() : QWaylandCompositor(this), m_totalWindowCount(0), m_nextWindowId(1), m_homeActive(true), m_shaderEffect(0), m_fullscreenSurface(0), m_directRenderingActive(false), m_topmostWindowId(0), m_screenOrientation(Qt::PrimaryOrientation), m_displayState(new MeeGo::QmDisplayState(this)) { setColor(Qt::black); if (m_instance) qFatal("LipstickCompositor: Only one compositor instance per process is supported"); m_instance = this; QObject::connect(this, SIGNAL(frameSwapped()), this, SLOT(windowSwapped())); QObject::connect(this, SIGNAL(beforeSynchronizing()), this, SLOT(clearUpdateRequest())); connect(m_displayState, SIGNAL(displayStateChanged(MeeGo::QmDisplayState::DisplayState)), this, SLOT(reactOnDisplayStateChanges(MeeGo::QmDisplayState::DisplayState))); emit HomeApplication::instance()->homeActiveChanged(); QDesktopServices::setUrlHandler("http", this, "openUrl"); QDesktopServices::setUrlHandler("https", this, "openUrl"); QDesktopServices::setUrlHandler("mailto", this, "openUrl"); }
QSGSharedDistanceFieldGlyphCache::QSGSharedDistanceFieldGlyphCache(const QByteArray &cacheId, QPlatformSharedGraphicsCache *sharedGraphicsCache, QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font) : QSGDistanceFieldGlyphCache(man, c, font) , m_cacheId(cacheId) , m_sharedGraphicsCache(sharedGraphicsCache) , m_isInSceneGraphUpdate(false) , m_hasPostedEvents(false) { #if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG) qDebug("QSGSharedDistanceFieldGlyphCache with id %s created in thread %p", cacheId.constData(), QThread::currentThreadId()); #endif Q_ASSERT(sizeof(glyph_t) == sizeof(quint32)); Q_ASSERT(sharedGraphicsCache != 0); connect(sharedGraphicsCache, SIGNAL(itemsMissing(QByteArray,QVector<quint32>)), this, SLOT(reportItemsMissing(QByteArray,QVector<quint32>)), Qt::DirectConnection); connect(sharedGraphicsCache, SIGNAL(itemsAvailable(QByteArray,void*,QVector<quint32>,QVector<QPoint>)), this, SLOT(reportItemsAvailable(QByteArray,void*,QVector<quint32>,QVector<QPoint>)), Qt::DirectConnection); connect(sharedGraphicsCache, SIGNAL(itemsUpdated(QByteArray,void*,QVector<quint32>,QVector<QPoint>)), this, SLOT(reportItemsUpdated(QByteArray,void*,QVector<quint32>,QVector<QPoint>)), Qt::DirectConnection); connect(sharedGraphicsCache, SIGNAL(itemsInvalidated(QByteArray,QVector<quint32>)), this, SLOT(reportItemsInvalidated(QByteArray,QVector<quint32>)), Qt::DirectConnection); Q_ASSERT(c); QQuickWindow *window = static_cast<QQuickWindow *>(c->surface()); Q_ASSERT(window != 0); connect(window, SIGNAL(beforeSynchronizing()), this, SLOT(sceneGraphUpdateStarted()), Qt::DirectConnection); connect(window, SIGNAL(beforeRendering()), this, SLOT(sceneGraphUpdateDone()), Qt::DirectConnection); }