diff --git a/xdgshellclient.h b/xdgshellclient.h --- a/xdgshellclient.h +++ b/xdgshellclient.h @@ -142,7 +142,6 @@ private Q_SLOTS: void handleConfigureAcknowledged(quint32 serial); - void handleSurfaceSizeChanged(); void handleTransientForChanged(); void handleWindowClassChanged(const QByteArray &windowClass); void handleWindowTitleChanged(const QString &title); @@ -156,6 +155,7 @@ void handlePingDelayed(quint32 serial); void handlePingTimeout(quint32 serial); void handlePongReceived(quint32 serial); + void handleCommitted(); private: /** diff --git a/xdgshellclient.cpp b/xdgshellclient.cpp --- a/xdgshellclient.cpp +++ b/xdgshellclient.cpp @@ -100,7 +100,6 @@ m_windowType = NET::OnScreenDisplay; } - connect(surface(), &SurfaceInterface::sizeChanged, this, &XdgShellClient::handleSurfaceSizeChanged); connect(surface(), &SurfaceInterface::unmapped, this, &XdgShellClient::unmap); connect(surface(), &SurfaceInterface::unbound, this, &XdgShellClient::destroyClient); connect(surface(), &SurfaceInterface::destroyed, this, &XdgShellClient::destroyClient); @@ -180,6 +179,8 @@ { disconnect(surface(), &SurfaceInterface::committed, this, &XdgShellClient::finishInit); + connect(surface(), &SurfaceInterface::committed, this, &XdgShellClient::handleCommitted); + bool needsPlacement = !isInitialPositionSet(); if (supportsWindowRules()) { @@ -383,14 +384,6 @@ void XdgShellClient::addDamage(const QRegion &damage) { - auto s = surface(); - if (s->size().isValid()) { - m_clientSize = s->size(); - updateWindowMargins(); - updatePendingGeometry(); - } - markAsMapped(); - setDepth((s->buffer()->hasAlphaChannel() && !isDesktop()) ? 32 : 24); repaints_region += damage.translated(clientPos()); Toplevel::addDamage(damage); } @@ -1082,12 +1075,6 @@ m_lastAckedConfigureRequest = serial; } -void XdgShellClient::handleSurfaceSizeChanged() -{ - m_clientSize = surface()->size(); - doSetGeometry(QRect(pos(), m_clientSize + QSize(borderLeft() + borderRight(), borderTop() + borderBottom()))); -} - void XdgShellClient::handleTransientForChanged() { SurfaceInterface *transientSurface = nullptr; @@ -1255,6 +1242,21 @@ } } +void XdgShellClient::handleCommitted() +{ + if (!surface()->buffer()) { + return; + } + + m_clientSize = surface()->size(); + + updateWindowMargins(); + updatePendingGeometry(); + + setDepth((surface()->buffer()->hasAlphaChannel() && !isDesktop()) ? 32 : 24); + markAsMapped(); +} + void XdgShellClient::resizeWithChecks(int w, int h, ForceGeometry_t force) { Q_UNUSED(force)