Commit 40dca1c9 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Implement window hiding in the WaylandClient class

This change upstreams window hiding functionality from the XdgSurfaceClient
class to the WaylandClient class in order to reduce the amount of duplicated
code in new wayland client sub-classes.
parent b4b0b931
......@@ -129,21 +129,6 @@ QRect InputPanelV1Client::inputGeometry() const
return surface()->input().boundingRect().translated(pos());
}
void InputPanelV1Client::hideClient(bool hide)
{
m_visible = !hide;
if (hide) {
workspace()->clientHidden(this);
addWorkspaceRepaint(visibleRect());
Q_EMIT windowHidden(this);
} else {
reposition();
addRepaintFull();
Q_EMIT windowShown(this);
autoRaise();
}
}
void InputPanelV1Client::setOutput(OutputInterface *outputIface)
{
if (m_output) {
......
......@@ -43,13 +43,10 @@ public:
void showOnScreenEdge() override {}
bool supportsWindowRules() const override { return false; }
void closeWindow() override {}
void hideClient(bool hide) override;
bool isHiddenInternal() const override { return !m_visible; }
bool takeFocus() override { return false; }
void updateColorScheme() override {}
bool wantsInput() const override { return false; }
bool isInputMethod() const override { return true; }
bool isShown(bool /*shaded_is_shown*/) const override { return m_visible && !isZombie(); }
bool isInitialPositionSet() const override { return true; }
void updateDecoration(bool /*check_workspace_pos*/, bool /*force*/) override {}
void setNoBorder(bool /*set*/) override {}
......@@ -66,7 +63,6 @@ private:
QPointer<AbstractWaylandOutput> m_output;
Mode m_mode = Toplevel;
const QPointer<KWaylandServer::InputPanelSurfaceV1Interface> m_panelSurface;
bool m_visible = true;
};
}
......@@ -283,4 +283,53 @@ void WaylandClient::updateDepth()
}
}
bool WaylandClient::isShown(bool shaded_is_shown) const
{
Q_UNUSED(shaded_is_shown)
return !isZombie() && !isHidden() && !isMinimized();
}
bool WaylandClient::isHiddenInternal() const
{
return isHidden();
}
void WaylandClient::hideClient(bool hide)
{
if (hide) {
internalHide();
} else {
internalShow();
}
}
bool WaylandClient::isHidden() const
{
return m_isHidden;
}
void WaylandClient::internalShow()
{
if (!isHidden()) {
return;
}
m_isHidden = false;
addRepaintFull();
emit windowShown(this);
}
void WaylandClient::internalHide()
{
if (isHidden()) {
return;
}
if (isMoveResize()) {
leaveMoveResize();
}
m_isHidden = true;
addWorkspaceRepaint(visibleRect());
workspace()->clientHidden(this);
emit windowHidden(this);
}
} // namespace KWin
......@@ -36,6 +36,11 @@ public:
void resizeWithChecks(const QSize &size, ForceGeometry_t force = NormalGeometrySet) override;
void killWindow() override;
QByteArray windowRole() const override;
bool isShown(bool shaded_is_shown) const override;
bool isHiddenInternal() const override;
void hideClient(bool hide) override;
bool isHidden() const;
void updateDepth();
void setCaption(const QString &caption);
......@@ -51,11 +56,14 @@ private:
void updateClientOutputs();
void updateIcon();
void updateResourceName();
void internalShow();
void internalHide();
QString m_captionNormal;
QString m_captionSuffix;
double m_opacity = 1.0;
quint32 m_windowId;
bool m_isHidden = false;
};
} // namespace KWin
......@@ -498,55 +498,6 @@ void XdgSurfaceClient::addDamage(const QRegion &damage)
Toplevel::addDamage(damage);
}
bool XdgSurfaceClient::isShown(bool shaded_is_shown) const
{
Q_UNUSED(shaded_is_shown)
return !isZombie() && !isHidden() && !isMinimized();
}
bool XdgSurfaceClient::isHiddenInternal() const
{
return isHidden();
}
void XdgSurfaceClient::hideClient(bool hide)
{
if (hide) {
internalHide();
} else {
internalShow();
}
}
bool XdgSurfaceClient::isHidden() const
{
return m_isHidden;
}
void XdgSurfaceClient::internalShow()
{
if (!isHidden()) {
return;
}
m_isHidden = false;
addRepaintFull();
emit windowShown(this);
}
void XdgSurfaceClient::internalHide()
{
if (isHidden()) {
return;
}
if (isMoveResize()) {
leaveMoveResize();
}
m_isHidden = true;
addWorkspaceRepaint(visibleRect());
workspace()->clientHidden(this);
emit windowHidden(this);
}
void XdgSurfaceClient::destroyClient()
{
markAsZombie();
......
......@@ -59,10 +59,7 @@ public:
void setFrameGeometry(const QRect &rect, ForceGeometry_t force = NormalGeometrySet) override;
using AbstractClient::move;
void move(int x, int y, ForceGeometry_t force = NormalGeometrySet) override;
bool isShown(bool shaded_is_shown) const override;
bool isHiddenInternal() const override;
bool isInitialPositionSet() const override;
void hideClient(bool hide) override;
void destroyClient() override;
QRect frameRectToBufferRect(const QRect &rect) const;
......@@ -71,7 +68,6 @@ public:
QSize requestedSize() const;
QRect requestedClientGeometry() const;
QSize requestedClientSize() const;
bool isHidden() const;
virtual void installPlasmaShellSurface(KWaylandServer::PlasmaShellSurfaceInterface *shellSurface) = 0;
......@@ -99,8 +95,6 @@ private:
void resetHaveNextWindowGeometry();
QRect adjustMoveResizeGeometry(const QRect &rect) const;
void updateGeometryRestoreHack();
void internalShow();
void internalHide();
void cleanGrouping();
void cleanTabBox();
......@@ -112,7 +106,6 @@ private:
QRect m_requestedFrameGeometry;
QRect m_bufferGeometry;
QRect m_requestedClientGeometry;
bool m_isHidden = false;
bool m_haveNextWindowGeometry = false;
};
......
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