Make support for full screen mode optional

Summary:
In long term, we want to split XdgShellClient into several classes. One
class for xdg-toplevel clients, and the other one for xdg-popup clients.

xdg-popup clients are much simpler than xdg-toplevel clients, they can't
be maximized or shown in full screen mode, they can't be interactively
moved on the screen, and so on. In the end, we will have to plumb many
pure virtual methods, which looks a bit ugly.

This change makes support for full screen mode in AbstractClient optional
so we don't have to add those no-op methods and keep code more or less
"clean."

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27162
master
Vlad Zahorodnii 2020-02-04 20:12:07 +02:00
parent 624317a78d
commit 4ec24bc43f
4 changed files with 50 additions and 29 deletions

View File

@ -3116,4 +3116,50 @@ QSize AbstractClient::adjustedSize() const
return sizeForClientSize(clientSize());
}
/**
* Returns @c true if the AbstractClient can be shown in full screen mode; otherwise @c false.
*
* Default implementation returns @c false.
*/
bool AbstractClient::isFullScreenable() const
{
return false;
}
/**
* Returns @c true if the AbstractClient is currently being shown in full screen mode; otherwise @c false.
*
* A client in full screen mode occupies the entire screen with no window frame around it.
*
* Default implementation returns @c false.
*/
bool AbstractClient::isFullScreen() const
{
return false;
}
/**
* Returns whether requests initiated by the user to enter or leave full screen mode are honored.
*
* Default implementation returns @c false.
*/
bool AbstractClient::userCanSetFullScreen() const
{
return false;
}
/**
* Asks the AbstractClient to enter or leave full screen mode.
*
* Default implementation does nothing.
*
* @param set @c true if the AbstractClient has to be shown in full screen mode, otherwise @c false
* @param user @c true if the request is initiated by the user, otherwise @c false
*/
void AbstractClient::setFullScreen(bool set, bool user)
{
Q_UNUSED(set)
Q_UNUSED(user)
}
}

View File

@ -416,8 +416,8 @@ public:
virtual bool isHiddenInternal() const = 0;
// TODO: remove boolean trap
virtual void hideClient(bool hide) = 0;
virtual bool isFullScreenable() const = 0;
virtual bool isFullScreen() const = 0;
virtual bool isFullScreenable() const;
virtual bool isFullScreen() const;
// TODO: remove boolean trap
virtual AbstractClient *findModal(bool allow_itself = false) = 0;
virtual bool isTransient() const;
@ -484,7 +484,7 @@ public:
bool isMinimized() const {
return m_minimized;
}
virtual void setFullScreen(bool set, bool user = true) = 0;
virtual void setFullScreen(bool set, bool user = true);
virtual void setClientShown(bool shown);
@ -546,7 +546,7 @@ public:
virtual bool isMaximizable() const = 0;
virtual bool isMinimizable() const = 0;
virtual QRect iconGeometry() const;
virtual bool userCanSetFullScreen() const = 0;
virtual bool userCanSetFullScreen() const;
virtual bool userCanSetNoBorder() const = 0;
virtual void checkNoBorder();
virtual void setOnActivities(QStringList newActivitiesList);

View File

@ -208,16 +208,6 @@ bool InternalClient::isCloseable() const
return true;
}
bool InternalClient::isFullScreenable() const
{
return false;
}
bool InternalClient::isFullScreen() const
{
return false;
}
bool InternalClient::isMaximizable() const
{
return false;
@ -397,17 +387,6 @@ void InternalClient::takeFocus()
{
}
bool InternalClient::userCanSetFullScreen() const
{
return false;
}
void InternalClient::setFullScreen(bool set, bool user)
{
Q_UNUSED(set)
Q_UNUSED(user)
}
void InternalClient::setNoBorder(bool set)
{
if (!userCanSetNoBorder()) {

View File

@ -53,8 +53,6 @@ public:
QByteArray windowRole() const override;
void closeWindow() override;
bool isCloseable() const override;
bool isFullScreenable() const override;
bool isFullScreen() const override;
bool isMaximizable() const override;
bool isMinimizable() const override;
bool isMovable() const override;
@ -82,8 +80,6 @@ public:
AbstractClient *findModal(bool allow_itself = false) override;
void setOnAllActivities(bool set) override;
void takeFocus() override;
bool userCanSetFullScreen() const override;
void setFullScreen(bool set, bool user = true) override;
void setNoBorder(bool set) override;
void updateDecoration(bool check_workspace_pos, bool force = false) override;
void updateColorScheme() override;