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())); }
void SystemCompositor::surfaceUnmapped() { // Set to 0 the current surface if it was unmapped QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender()); if (surface == m_currentSurface) m_currentSurface = 0; // Announce this window was destroyed QQuickItem *item = surface->surfaceItem(); emit windowDestroyed(QVariant::fromValue(item)); }
void SystemCompositor::surfaceDestroyed(QObject *object) { // Set to 0 the current surface if it was destroyed QWaylandSurface *surface = static_cast<QWaylandSurface *>(object); if (surface == m_currentSurface) m_currentSurface = 0; // Announce this window was destroyed QQuickItem *item = surface->surfaceItem(); if (item) emit windowDestroyed(QVariant::fromValue(item)); }
ChatWindow::~ChatWindow() { emit windowDestroyed(this); }
ViewHistoryWindow::~ViewHistoryWindow() { emit windowDestroyed(); }