Merge Window::maximize() and Window::changeMaximize()

This commit is contained in:
Vlad Zahorodnii 2022-09-22 17:19:10 +03:00
parent a1d5849d81
commit 903e18d88c
6 changed files with 9 additions and 18 deletions

View file

@ -1580,9 +1580,10 @@ void Window::blockGeometryUpdates(bool block)
}
}
void Window::maximize(MaximizeMode m)
void Window::maximize(MaximizeMode mode)
{
changeMaximize(m);
Q_UNUSED(mode)
qCWarning(KWIN_CORE, "%s doesn't support setting maximized state", metaObject()->className());
}
void Window::setMaximize(bool vertically, bool horizontally)
@ -4332,12 +4333,6 @@ void Window::setGeometryRestore(const QRectF &rect)
m_maximizeGeometryRestore = rect;
}
void Window::changeMaximize(MaximizeMode mode)
{
Q_UNUSED(mode)
qCWarning(KWIN_CORE, "%s doesn't support setting maximized state", metaObject()->className());
}
void Window::invalidateDecoration()
{
}

View file

@ -1028,7 +1028,7 @@ public:
QRectF geometryRestore() const;
virtual MaximizeMode maximizeMode() const;
virtual MaximizeMode requestedMaximizeMode() const;
void maximize(MaximizeMode);
virtual void maximize(MaximizeMode mode);
/**
* Sets the maximization according to @p vertically and @p horizontally.
*/
@ -1721,7 +1721,6 @@ protected:
int borderRight() const;
int borderTop() const;
int borderBottom() const;
virtual void changeMaximize(MaximizeMode mode);
void setGeometryRestore(const QRectF &rect);
void blockGeometryUpdates(bool block);

View file

@ -4265,7 +4265,7 @@ void X11Window::updateServerGeometry()
}
static bool changeMaximizeRecursion = false;
void X11Window::changeMaximize(MaximizeMode mode)
void X11Window::maximize(MaximizeMode mode)
{
if (changeMaximizeRecursion) {
return;
@ -4320,7 +4320,7 @@ void X11Window::changeMaximize(MaximizeMode mode)
// so restore first and then maximize the other way
if ((old_mode == MaximizeVertical && mode == MaximizeHorizontal)
|| (old_mode == MaximizeHorizontal && mode == MaximizeVertical)) {
changeMaximize(MaximizeRestore); // restore
maximize(MaximizeRestore); // restore
}
Q_EMIT clientMaximizedStateAboutToChange(this, mode);

View file

@ -158,6 +158,7 @@ public:
bool isShadeable() const override;
bool isMaximizable() const override;
MaximizeMode maximizeMode() const override;
void maximize(MaximizeMode mode) override;
bool isMinimizable() const override;
QRectF iconGeometry() const override;
@ -392,7 +393,6 @@ private:
bool isManaged() const; ///< Returns false if this client is not yet managed
void updateAllowedActions(bool force = false);
QRect fullscreenMonitorsArea(NETFullscreenMonitors topology) const;
void changeMaximize(MaximizeMode mode) override;
void getWmNormalHints();
void getMotifHints();
void getIcons();

View file

@ -1638,11 +1638,8 @@ void XdgToplevelWindow::setFullScreen(bool set, bool user)
doSetFullScreen();
}
/**
* \todo Move to Window.
*/
static bool changeMaximizeRecursion = false;
void XdgToplevelWindow::changeMaximize(MaximizeMode mode)
void XdgToplevelWindow::maximize(MaximizeMode mode)
{
if (changeMaximizeRecursion) {
return;

View file

@ -162,6 +162,7 @@ public:
void showOnScreenEdge() override;
void setFullScreen(bool set, bool user) override;
void closeWindow() override;
void maximize(MaximizeMode mode) override;
void installAppMenu(KWaylandServer::AppMenuInterface *appMenu);
void installServerDecoration(KWaylandServer::ServerSideDecorationInterface *decoration);
@ -180,7 +181,6 @@ protected:
bool doStartInteractiveMoveResize() override;
void doFinishInteractiveMoveResize() override;
bool acceptsFocus() const override;
void changeMaximize(MaximizeMode mode) override;
Layer layerForDock() const override;
void doSetQuickTileMode() override;