From f67db3a918cab5aa8dc51a3376e2973a4c875ecd Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sun, 15 Sep 2019 12:41:21 +0300 Subject: [PATCH] Cleanup XdgShellClient header Don't put method definitions in the header file of XdgShellClient class as it makes the code visually inconsistent. InternalClient is a good example of how the header file of a subclass of AbstractClient class should look like. This change also cleans up the order of things in the header file, thus making it a bit more obvious where new things should go. --- xdgshellclient.cpp | 35 ++++++++++++++++++++++ xdgshellclient.h | 75 +++++++++++++--------------------------------- 2 files changed, 56 insertions(+), 54 deletions(-) diff --git a/xdgshellclient.cpp b/xdgshellclient.cpp index d3aeb8c429..4f344a3b6c 100644 --- a/xdgshellclient.cpp +++ b/xdgshellclient.cpp @@ -694,6 +694,16 @@ void XdgShellClient::blockActivityUpdates(bool b) Q_UNUSED(b) } +QString XdgShellClient::captionNormal() const +{ + return m_caption; +} + +QString XdgShellClient::captionSuffix() const +{ + return m_captionSuffix; +} + void XdgShellClient::updateCaption() { const QString oldSuffix = m_captionSuffix; @@ -809,6 +819,11 @@ bool XdgShellClient::isShown(bool shaded_is_shown) const return !m_closing && !m_unmapped && !isMinimized() && !m_hidden; } +bool XdgShellClient::isHiddenInternal() const +{ + return m_unmapped || m_hidden; +} + void XdgShellClient::hideClient(bool hide) { if (m_hidden == hide) { @@ -926,6 +941,11 @@ void XdgShellClient::changeMaximize(bool horizontal, bool vertical, bool adjust) } } +void XdgShellClient::setGeometryRestore(const QRect &geo) +{ + m_geomMaximizeRestore = geo; +} + MaximizeMode XdgShellClient::maximizeMode() const { return m_maximizeMode; @@ -936,6 +956,11 @@ MaximizeMode XdgShellClient::requestedMaximizeMode() const return m_requestedMaximizeMode; } +QRect XdgShellClient::geometryRestore() const +{ + return m_geomMaximizeRestore; +} + bool XdgShellClient::noBorder() const { if (m_serverDecoration) { @@ -1451,6 +1476,11 @@ bool XdgShellClient::hasStrut() const return m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible; } +quint32 XdgShellClient::windowId() const +{ + return m_windowId; +} + void XdgShellClient::updateIcon() { const QString waylandIconName = QStringLiteral("wayland"); @@ -1819,6 +1849,11 @@ void XdgShellClient::killWindow() QTimer::singleShot(5000, c, &ClientConnection::destroy); } +bool XdgShellClient::isLocalhost() const +{ + return true; +} + bool XdgShellClient::hasPopupGrab() const { return m_hasPopupGrab; diff --git a/xdgshellclient.h b/xdgshellclient.h index 82a2e6bfb3..cbfebaa916 100644 --- a/xdgshellclient.h +++ b/xdgshellclient.h @@ -23,6 +23,7 @@ along with this program. If not, see . #pragma once #include "abstract_client.h" + #include namespace KWayland @@ -51,6 +52,7 @@ enum class PingReason { class KWIN_EXPORT XdgShellClient : public AbstractClient { Q_OBJECT + public: XdgShellClient(KWayland::Server::XdgShellSurfaceInterface *surface); XdgShellClient(KWayland::Server::XdgShellPopupInterface *surface); @@ -65,14 +67,9 @@ public: double opacity() const override; void setOpacity(double opacity) override; QByteArray windowRole() const override; - void blockActivityUpdates(bool b = true) override; - QString captionNormal() const override { - return m_caption; - } - QString captionSuffix() const override { - return m_captionSuffix; - } + QString captionNormal() const override; + QString captionSuffix() const override; void closeWindow() override; AbstractClient *findModal(bool allow_itself = false) override; bool isCloseable() const override; @@ -84,16 +81,11 @@ public: bool isMovableAcrossScreens() const override; bool isResizable() const override; bool isShown(bool shaded_is_shown) const override; - bool isHiddenInternal() const override { - return m_unmapped || m_hidden; - } + bool isHiddenInternal() const override; void hideClient(bool hide) override; MaximizeMode maximizeMode() const override; MaximizeMode requestedMaximizeMode() const override; - - QRect geometryRestore() const override { - return m_geomMaximizeRestore; - } + QRect geometryRestore() const override; bool noBorder() const override; void setFullScreen(bool set, bool user = true) override; void setNoBorder(bool set) override; @@ -109,21 +101,23 @@ public: using AbstractClient::setGeometry; void setGeometry(int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet) override; bool hasStrut() const override; - - quint32 windowId() const override { - return m_windowId; - } - - /** - * The process for this client. - * Note that processes started by kwin will share its process id. - * @since 5.11 - * @returns the process if for this client. - */ + quint32 windowId() const override; pid_t pid() const override; - bool isLockScreen() const override; bool isInputMethod() const override; + bool isInitialPositionSet() const override; + bool isTransient() const override; + bool hasTransientPlacementHint() const override; + QRect transientPlacement(const QRect &bounds) const override; + QMatrix4x4 inputTransformation() const override; + void showOnScreenEdge() override; + bool hasPopupGrab() const override; + void popupDone() override; + void updateColorScheme() override; + bool isPopupWindow() const override; + void killWindow() override; + bool isLocalhost() const override; + bool supportsWindowRules() const override; void installPlasmaShellSurface(KWayland::Server::PlasmaShellSurfaceInterface *surface); void installServerSideDecoration(KWayland::Server::ServerSideDecorationInterface *decoration); @@ -131,33 +125,8 @@ public: void installPalette(KWayland::Server::ServerSideDecorationPaletteInterface *palette); void installXdgDecoration(KWayland::Server::XdgDecorationInterface *decoration); - bool isInitialPositionSet() const override; - - bool isTransient() const override; - bool hasTransientPlacementHint() const override; - QRect transientPlacement(const QRect &bounds) const override; - - QMatrix4x4 inputTransformation() const override; - void showOnScreenEdge() override; - - void killWindow() override; - void placeIn(const QRect &area); - bool hasPopupGrab() const override; - void popupDone() override; - - void updateColorScheme() override; - - bool isPopupWindow() const override; - - bool isLocalhost() const override - { - return true; - } - - bool supportsWindowRules() const override; - protected: void addDamage(const QRegion &damage) override; bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const override; @@ -165,9 +134,7 @@ protected: bool belongsToDesktop() const override; Layer layerForDock() const override; void changeMaximize(bool horizontal, bool vertical, bool adjust) override; - void setGeometryRestore(const QRect &geo) override { - m_geomMaximizeRestore = geo; - } + void setGeometryRestore(const QRect &geo) override; void doResizeSync() override; bool acceptsFocus() const override; void doMinimize() override;