diff options
Diffstat (limited to 'src/compositor/compositor_api/qwaylandoutput.cpp')
-rw-r--r-- | src/compositor/compositor_api/qwaylandoutput.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp index 4fb9b3cdc..081393a2c 100644 --- a/src/compositor/compositor_api/qwaylandoutput.cpp +++ b/src/compositor/compositor_api/qwaylandoutput.cpp @@ -249,15 +249,19 @@ void QWaylandOutput::initialize() Q_ASSERT(!d->initialized); Q_ASSERT(d->compositor); Q_ASSERT(d->compositor->isCreated()); - Q_ASSERT(d->window); - d->mode.size = d->window->size(); + if (d->window) + d->mode.size = d->window->size(); + else + d->sizeFollowsWindow = false; QWaylandCompositorPrivate::get(d->compositor)->addOutput(this); - QObject::connect(d->window, &QWindow::widthChanged, this, &QWaylandOutput::setWidth); - QObject::connect(d->window, &QWindow::heightChanged, this, &QWaylandOutput::setHeight); - QObject::connect(d->window, &QObject::destroyed, this, &QWaylandOutput::handleWindowDestroyed); + if (d->window) { + QObject::connect(d->window, &QWindow::widthChanged, this, &QWaylandOutput::setWidth); + QObject::connect(d->window, &QWindow::heightChanged, this, &QWaylandOutput::setHeight); + QObject::connect(d->window, &QObject::destroyed, this, &QWaylandOutput::handleWindowDestroyed); + } d->init(d->compositor->display(), 2); @@ -726,7 +730,7 @@ void QWaylandOutput::setScaleFactor(int scale) * This property controls whether the size of the WaylandOutput matches the * size of its window. * - * The default is true. + * The default is true if this WaylandOutput has a window. */ /*! @@ -735,7 +739,7 @@ void QWaylandOutput::setScaleFactor(int scale) * This property controls whether the size of the QWaylandOutput matches the * size of its window. * - * The default is true. + * The default is true if this QWaylandOutput has a window. */ bool QWaylandOutput::sizeFollowsWindow() const { @@ -745,6 +749,12 @@ bool QWaylandOutput::sizeFollowsWindow() const void QWaylandOutput::setSizeFollowsWindow(bool follow) { Q_D(QWaylandOutput); + + if (!d->window) { + qWarning("Setting QWaylandOutput::sizeFollowsWindow without a window has no effect"); + return; + } + if (follow != d->sizeFollowsWindow) { if (follow) { QObject::connect(d->window, &QWindow::widthChanged, this, &QWaylandOutput::setWidth); |