Commit 84de8d13 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

[wayland] Process pending state and map the client on commit

Summary:
Move unrelated code out of XdgShellClient::addDamage() into a separate
method.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24328
parent 493bbdc2
...@@ -100,7 +100,6 @@ void XdgShellClient::init() ...@@ -100,7 +100,6 @@ void XdgShellClient::init()
m_windowType = NET::OnScreenDisplay; m_windowType = NET::OnScreenDisplay;
} }
connect(surface(), &SurfaceInterface::sizeChanged, this, &XdgShellClient::handleSurfaceSizeChanged);
connect(surface(), &SurfaceInterface::unmapped, this, &XdgShellClient::unmap); connect(surface(), &SurfaceInterface::unmapped, this, &XdgShellClient::unmap);
connect(surface(), &SurfaceInterface::unbound, this, &XdgShellClient::destroyClient); connect(surface(), &SurfaceInterface::unbound, this, &XdgShellClient::destroyClient);
connect(surface(), &SurfaceInterface::destroyed, this, &XdgShellClient::destroyClient); connect(surface(), &SurfaceInterface::destroyed, this, &XdgShellClient::destroyClient);
...@@ -180,6 +179,8 @@ void XdgShellClient::finishInit() ...@@ -180,6 +179,8 @@ void XdgShellClient::finishInit()
{ {
disconnect(surface(), &SurfaceInterface::committed, this, &XdgShellClient::finishInit); disconnect(surface(), &SurfaceInterface::committed, this, &XdgShellClient::finishInit);
connect(surface(), &SurfaceInterface::committed, this, &XdgShellClient::handleCommitted);
bool needsPlacement = !isInitialPositionSet(); bool needsPlacement = !isInitialPositionSet();
if (supportsWindowRules()) { if (supportsWindowRules()) {
...@@ -383,14 +384,6 @@ void XdgShellClient::setOpacity(double opacity) ...@@ -383,14 +384,6 @@ void XdgShellClient::setOpacity(double opacity)
void XdgShellClient::addDamage(const QRegion &damage) 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()); repaints_region += damage.translated(clientPos());
Toplevel::addDamage(damage); Toplevel::addDamage(damage);
} }
...@@ -1082,12 +1075,6 @@ void XdgShellClient::handleConfigureAcknowledged(quint32 serial) ...@@ -1082,12 +1075,6 @@ void XdgShellClient::handleConfigureAcknowledged(quint32 serial)
m_lastAckedConfigureRequest = serial; m_lastAckedConfigureRequest = serial;
} }
void XdgShellClient::handleSurfaceSizeChanged()
{
m_clientSize = surface()->size();
doSetGeometry(QRect(pos(), m_clientSize + QSize(borderLeft() + borderRight(), borderTop() + borderBottom())));
}
void XdgShellClient::handleTransientForChanged() void XdgShellClient::handleTransientForChanged()
{ {
SurfaceInterface *transientSurface = nullptr; SurfaceInterface *transientSurface = nullptr;
...@@ -1255,6 +1242,21 @@ void XdgShellClient::handlePongReceived(quint32 serial) ...@@ -1255,6 +1242,21 @@ void XdgShellClient::handlePongReceived(quint32 serial)
} }
} }
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) void XdgShellClient::resizeWithChecks(int w, int h, ForceGeometry_t force)
{ {
Q_UNUSED(force) Q_UNUSED(force)
......
...@@ -142,7 +142,6 @@ protected: ...@@ -142,7 +142,6 @@ protected:
private Q_SLOTS: private Q_SLOTS:
void handleConfigureAcknowledged(quint32 serial); void handleConfigureAcknowledged(quint32 serial);
void handleSurfaceSizeChanged();
void handleTransientForChanged(); void handleTransientForChanged();
void handleWindowClassChanged(const QByteArray &windowClass); void handleWindowClassChanged(const QByteArray &windowClass);
void handleWindowTitleChanged(const QString &title); void handleWindowTitleChanged(const QString &title);
...@@ -156,6 +155,7 @@ private Q_SLOTS: ...@@ -156,6 +155,7 @@ private Q_SLOTS:
void handlePingDelayed(quint32 serial); void handlePingDelayed(quint32 serial);
void handlePingTimeout(quint32 serial); void handlePingTimeout(quint32 serial);
void handlePongReceived(quint32 serial); void handlePongReceived(quint32 serial);
void handleCommitted();
private: private:
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment