diff --git a/inputpanelv1client.cpp b/inputpanelv1client.cpp index 98840e3c4c..3a607bed2f 100644 --- a/inputpanelv1client.cpp +++ b/inputpanelv1client.cpp @@ -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) { diff --git a/inputpanelv1client.h b/inputpanelv1client.h index 3fdd3529f5..93b127d5a9 100644 --- a/inputpanelv1client.h +++ b/inputpanelv1client.h @@ -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 m_output; Mode m_mode = Toplevel; const QPointer m_panelSurface; - bool m_visible = true; }; } diff --git a/waylandclient.cpp b/waylandclient.cpp index 0ec537650d..cf895d9ed6 100644 --- a/waylandclient.cpp +++ b/waylandclient.cpp @@ -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 diff --git a/waylandclient.h b/waylandclient.h index a47c866505..1f4f57e139 100644 --- a/waylandclient.h +++ b/waylandclient.h @@ -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 diff --git a/xdgshellclient.cpp b/xdgshellclient.cpp index dc623fa256..7b27e08872 100644 --- a/xdgshellclient.cpp +++ b/xdgshellclient.cpp @@ -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(); diff --git a/xdgshellclient.h b/xdgshellclient.h index 49f74e1fec..6e5e2dcb3a 100644 --- a/xdgshellclient.h +++ b/xdgshellclient.h @@ -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; };