diff --git a/abstract_client.h b/abstract_client.h index 481c061843..40a633097b 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -425,8 +425,7 @@ public: virtual bool isHiddenInternal() const = 0; // TODO: remove boolean trap virtual void hideClient(bool hide) = 0; - bool isFullScreenable() const; - bool isFullScreenable(bool fullscreen_hack) const; + virtual bool isFullScreenable() const = 0; virtual bool isFullScreen() const = 0; // TODO: remove boolean trap virtual AbstractClient *findModal(bool allow_itself = false) = 0; diff --git a/client.cpp b/client.cpp index 81cc598588..46dd033c42 100644 --- a/client.cpp +++ b/client.cpp @@ -595,6 +595,30 @@ bool Client::userNoBorder() const return noborder; } +bool Client::isFullScreenable() const +{ + return isFullScreenable(false); +} + +bool Client::isFullScreenable(bool fullscreenHack) const +{ + if (!rules()->checkFullScreen(true)) { + return false; + } + if (fullscreenHack) { + return isNormalWindow(); + } + if (rules()->checkStrictGeometry(true)) { + // check geometry constraints (rule to obey is set) + const QRect fsarea = workspace()->clientArea(FullScreenArea, this); + if (sizeForClientSize(fsarea.size(), SizemodeAny, true) != fsarea.size()) { + return false; // the app wouldn't fit exactly fullscreen geometry due to its strict geometry requirements + } + } + // don't check size constrains - some apps request fullscreen despite requesting fixed size + return !isSpecialWindow(); // also better disallow only weird types to go fullscreen +} + bool Client::noBorder() const { return userNoBorder() || isFullScreen(); diff --git a/client.h b/client.h index 1af8df6982..0284fbbf11 100644 --- a/client.h +++ b/client.h @@ -143,6 +143,7 @@ public: bool isMinimizable() const override; QRect iconGeometry() const override; + bool isFullScreenable() const override; void setFullScreen(bool set, bool user = true) override; bool isFullScreen() const override; bool userCanSetFullScreen() const override; @@ -347,6 +348,8 @@ private: Client* findAutogroupCandidate() const; + bool isFullScreenable(bool fullscreenHack) const; + protected: virtual void debug(QDebug& stream) const; void addDamage(const QRegion &damage) override; diff --git a/geometry.cpp b/geometry.cpp index e971f9488f..f36744cff8 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2449,26 +2449,6 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust) emit quickTileModeChanged(); } -bool AbstractClient::isFullScreenable() const -{ - return isFullScreenable(false); -} - -bool AbstractClient::isFullScreenable(bool fullscreen_hack) const -{ - if (!rules()->checkFullScreen(true)) - return false; - if (fullscreen_hack) - return isNormalWindow(); - if (rules()->checkStrictGeometry(true)) { // allow rule to ignore geometry constraints - QRect fsarea = workspace()->clientArea(FullScreenArea, this); - if (sizeForClientSize(fsarea.size(), SizemodeAny, true) != fsarea.size()) - return false; // the app wouldn't fit exactly fullscreen geometry due to its strict geometry requirements - } - // don't check size constrains - some apps request fullscreen despite requesting fixed size - return !isSpecialWindow(); // also better disallow only weird types to go fullscreen -} - bool Client::userCanSetFullScreen() const { if (fullscreen_mode == FullScreenHack) diff --git a/shell_client.cpp b/shell_client.cpp index 2f6216dedf..d6d22059e5 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -931,6 +931,14 @@ bool ShellClient::noBorder() const return true; } +bool ShellClient::isFullScreenable() const +{ + if (!rules()->checkFullScreen(true)) { + return false; + } + return !isSpecialWindow(); +} + void ShellClient::setFullScreen(bool set, bool user) { if (!isFullScreen() && !set) diff --git a/shell_client.h b/shell_client.h index 557fc8ee85..3abf3dea04 100644 --- a/shell_client.h +++ b/shell_client.h @@ -77,6 +77,7 @@ public: void closeWindow() override; AbstractClient *findModal(bool allow_itself = false) override; bool isCloseable() const override; + bool isFullScreenable() const override; bool isFullScreen() const override; bool isMaximizable() const override; bool isMinimizable() const override;