QWindowCompositor::QWindowCompositor(QOpenGLWindow *window) : QWaylandCompositor(window) , m_window(window) , m_textureBlitter(0) , m_renderScheduler(this) , m_draggingWindow(0) , m_dragKeyIsPressed(false) , m_cursorSurface(0) , m_cursorHotspotX(0) , m_cursorHotspotY(0) , m_modifiers(Qt::NoModifier) { enableSubSurfaceExtension(); m_window->makeCurrent(); m_textureCache = new QOpenGLTextureCache(m_window->context()); m_textureBlitter = new TextureBlitter(); m_backgroundImage = makeBackgroundImage(QLatin1String(":/background.jpg")); m_renderScheduler.setSingleShot(true); connect(&m_renderScheduler,SIGNAL(timeout()),this,SLOT(render())); QOpenGLFunctions *functions = m_window->context()->functions(); functions->glGenFramebuffers(1, &m_surface_fbo); window->installEventFilter(this); setRetainedSelectionEnabled(true); setOutputGeometry(QRect(QPoint(0, 0), window->size())); setOutputRefreshRate(qRound(qGuiApp->primaryScreen()->refreshRate() * 1000.0)); }
SystemCompositor::SystemCompositor() : VCompositor(this) , m_currentSurface(0) { // Enable the subsurface extension enableSubSurfaceExtension(); // System compositor protocol m_protocol = new SystemCompositorServer(this, QWaylandCompositor::handle()); // Allow QML to access this compositor rootContext()->setContextProperty("compositor", this); // All the screen is initially available m_availableGeometry = screen()->availableGeometry(); connect(screen(), SIGNAL(virtualGeometryChanged(QRect)), this, SIGNAL(screenGeometryChanged())); // Load the QML code setSource(QUrl("qrc:///qml/Compositor.qml")); setResizeMode(QQuickView::SizeRootObjectToView); setColor(Qt::black); winId(); connect(this, SIGNAL(windowAdded(QVariant)), rootObject(), SLOT(windowAdded(QVariant))); connect(this, SIGNAL(windowDestroyed(QVariant)), rootObject(), SLOT(windowDestroyed(QVariant))); connect(this, SIGNAL(windowResized(QVariant)), rootObject(), SLOT(windowResized(QVariant))); connect(this, SIGNAL(sceneGraphInitialized()), this, SLOT(sceneGraphInitialized()), Qt::DirectConnection); connect(this, SIGNAL(frameSwapped()), this, SLOT(frameSwapped())); }