[wayland] Handle unmap in ShellClient

Do not destroy the ShellClient when the Surface gets unmapped. Instead
just hide the ShellClient and show it again on the next damage.
This commit is contained in:
Martin Gräßlin 2015-06-03 21:19:00 +02:00
parent e44bffa097
commit 35abacabc4
3 changed files with 16 additions and 4 deletions

View file

@ -760,8 +760,8 @@ bool Scene::Window::isVisible() const
return false;
if (!toplevel->isOnCurrentActivity())
return false;
if (toplevel->isClient())
return (static_cast< Client *>(toplevel))->isShown(true);
if (AbstractClient *c = dynamic_cast<AbstractClient*>(toplevel))
return c->isShown(true);
return true; // Unmanaged is always visible
}

View file

@ -48,6 +48,7 @@ ShellClient::ShellClient(ShellSurfaceInterface *surface)
setupCompositing();
if (surface->surface()->buffer()) {
setReadyForPainting();
m_unmapped = false;
m_clientSize = surface->surface()->buffer()->size();
} else {
ready_for_painting = false;
@ -68,7 +69,7 @@ ShellClient::ShellClient(ShellSurfaceInterface *surface)
}
);
connect(surface, &ShellSurfaceInterface::destroyed, this, &ShellClient::destroyClient);
connect(surface->surface(), &SurfaceInterface::unmapped, this, &ShellClient::destroyClient);
connect(surface->surface(), &SurfaceInterface::unmapped, this, &ShellClient::unmap);
connect(surface, &ShellSurfaceInterface::titleChanged, this, &ShellClient::captionChanged);
connect(surface, &ShellSurfaceInterface::fullscreenChanged, this, &ShellClient::clientFullScreenChanged);
@ -167,6 +168,7 @@ void ShellClient::addDamage(const QRegion &damage)
}
setDepth(m_shellSurface->surface()->buffer()->hasAlphaChannel() ? 32 : 24);
setReadyForPainting();
m_unmapped = false;
Toplevel::addDamage(damage);
}
@ -266,7 +268,7 @@ bool ShellClient::isResizable() const
bool ShellClient::isShown(bool shaded_is_shown) const
{
Q_UNUSED(shaded_is_shown)
return !m_closing;
return !m_closing && !m_unmapped;
}
void ShellClient::maximize(MaximizeMode)
@ -470,4 +472,12 @@ void ShellClient::resizeWithChecks(int w, int h, ForceGeometry_t force)
m_shellSurface->requestSize(QSize(w, h));
}
void ShellClient::unmap()
{
m_unmapped = true;
ready_for_painting = false;
addWorkspaceRepaint(visibleRect());
workspace()->clientHidden(this);
}
}

View file

@ -109,6 +109,7 @@ private:
void requestGeometry(const QRect &rect);
void setGeometry(const QRect &rect);
void destroyClient();
void unmap();
void createWindowId();
void findInternalWindow();
void updateInternalWindowGeometry();
@ -122,6 +123,7 @@ private:
bool m_closing = false;
quint32 m_windowId = 0;
QWindow *m_internalWindow = nullptr;
bool m_unmapped = true;
};
}