Commit 1466836b authored by Nils Fenner's avatar Nils Fenner Committed by Vlad Zahorodnii
Browse files

Inherit "Delete" and "Unmanaged" from AbstractClient

Depends on !2224, !2232 

Further changes are blocked until the above MR's are merged.
parent 34c1231d
Pipeline #164382 passed with stage
in 12 minutes and 5 seconds
......@@ -9,7 +9,6 @@
#include "deleted.h"
#include "abstract_client.h"
#include "group.h"
#include "netinfo.h"
#include "shadow.h"
......@@ -22,7 +21,7 @@ namespace KWin
{
Deleted::Deleted()
: Toplevel()
: AbstractClient()
, delete_refcount(1)
, m_frame(XCB_WINDOW_NONE)
, m_layer(UnknownLayer)
......
......@@ -10,14 +10,12 @@
#ifndef KWIN_DELETED_H
#define KWIN_DELETED_H
#include "toplevel.h"
#include "abstract_client.h"
namespace KWin
{
class AbstractClient;
class KWIN_EXPORT Deleted : public Toplevel
class KWIN_EXPORT Deleted : public AbstractClient
{
Q_OBJECT
......@@ -51,7 +49,7 @@ public:
{
return m_modal;
}
QList<AbstractClient *> mainClients() const
QList<AbstractClient *> mainClients() const override
{
return m_mainClients;
}
......@@ -62,7 +60,7 @@ public:
}
QByteArray windowRole() const override;
bool isFullScreen() const
bool isFullScreen() const override
{
return m_fullscreen;
}
......@@ -75,11 +73,34 @@ public:
{
return m_keepBelow;
}
QString caption() const
{
return m_caption;
}
QString captionNormal() const override { return m_caption; }
QString captionSuffix() const override { return {}; }
bool isCloseable() const override { return false; }
bool isShown() const override { return false; }
bool isHiddenInternal() const override { return false; }
void hideClient() override { /* nothing to do */ }
void showClient() override { /* nothing to do */ }
AbstractClient *findModal(bool /*allow_itself*/) override { return nullptr; }
bool isResizable() const override { return false; }
bool isMovable() const override { return false; }
bool isMovableAcrossScreens() const override { return false; }
bool takeFocus() override { return false; }
bool wantsInput() const override { return false; }
void killWindow() override { /* nothing to do */ }
void destroyClient() override { /* nothing to do */ }
void closeWindow() override { /* nothing to do */ }
bool acceptsFocus() const override { return false; }
bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks /*checks*/) const override { return other == this; }
void moveResizeInternal(const QRect & /*rect*/, KWin::AbstractClient::MoveResizeMode /*mode*/) override { /* nothing to do */ }
void updateCaption() override { /* nothing to do */ }
void resizeWithChecks(const QSize&) override { /* nothing to do */ }
/**
* Returns whether the client was a popup.
*
......
......@@ -2073,7 +2073,7 @@ TOPLEVEL_HELPER(QUuid, internalId, internalId)
#undef TOPLEVEL_HELPER
#define CLIENT_HELPER_WITH_DELETED(rettype, prototype, propertyname, defaultValue) \
#define CLIENT_HELPER(rettype, prototype, propertyname, defaultValue) \
rettype EffectWindowImpl::prototype() const \
{ \
auto client = static_cast<AbstractClient *>(toplevel->isClient() ? toplevel : nullptr); \
......@@ -2087,15 +2087,26 @@ TOPLEVEL_HELPER(QUuid, internalId, internalId)
return defaultValue; \
}
CLIENT_HELPER_WITH_DELETED(bool, isMinimized, isMinimized, false)
CLIENT_HELPER_WITH_DELETED(bool, isModal, isModal, false)
CLIENT_HELPER_WITH_DELETED(bool, isFullScreen, isFullScreen, false)
CLIENT_HELPER_WITH_DELETED(bool, keepAbove, keepAbove, false)
CLIENT_HELPER_WITH_DELETED(bool, keepBelow, keepBelow, false)
CLIENT_HELPER_WITH_DELETED(QString, caption, caption, QString());
CLIENT_HELPER_WITH_DELETED(QVector<uint>, desktops, x11DesktopIds, QVector<uint>());
CLIENT_HELPER(bool, isMinimized, isMinimized, false)
CLIENT_HELPER(bool, isModal, isModal, false)
CLIENT_HELPER(bool, isFullScreen, isFullScreen, false)
CLIENT_HELPER(bool, keepAbove, keepAbove, false)
CLIENT_HELPER(bool, keepBelow, keepBelow, false)
CLIENT_HELPER(QString, caption, caption, QString());
CLIENT_HELPER(QVector<uint>, desktops, x11DesktopIds, QVector<uint>());
CLIENT_HELPER(bool, isMovable, isMovable, false)
CLIENT_HELPER(bool, isMovableAcrossScreens, isMovableAcrossScreens, false)
CLIENT_HELPER(bool, isUserMove, isInteractiveMove, false)
CLIENT_HELPER(bool, isUserResize, isInteractiveResize, false)
CLIENT_HELPER(QRect, iconGeometry, iconGeometry, QRect())
CLIENT_HELPER(bool, isSpecialWindow, isSpecialWindow, true)
CLIENT_HELPER(bool, acceptsFocus, wantsInput, true) // We don't actually know...
CLIENT_HELPER(QIcon, icon, icon, QIcon())
CLIENT_HELPER(bool, isSkipSwitcher, skipSwitcher, false)
CLIENT_HELPER(bool, decorationHasAlpha, decorationHasAlpha, false)
CLIENT_HELPER(bool, isUnresponsive, unresponsive, false)
#undef CLIENT_HELPER_WITH_DELETED
#undef CLIENT_HELPER
// legacy from tab groups, can be removed when no effects use this any more.
bool EffectWindowImpl::isCurrentTab() const
......@@ -2118,30 +2129,6 @@ NET::WindowType EffectWindowImpl::windowType() const
return toplevel->windowType();
}
#define CLIENT_HELPER(rettype, prototype, propertyname, defaultValue) \
rettype EffectWindowImpl::prototype() const \
{ \
auto client = static_cast<AbstractClient *>(toplevel->isClient() ? toplevel : nullptr); \
if (client) { \
return client->propertyname(); \
} \
return defaultValue; \
}
CLIENT_HELPER(bool, isMovable, isMovable, false)
CLIENT_HELPER(bool, isMovableAcrossScreens, isMovableAcrossScreens, false)
CLIENT_HELPER(bool, isUserMove, isInteractiveMove, false)
CLIENT_HELPER(bool, isUserResize, isInteractiveResize, false)
CLIENT_HELPER(QRect, iconGeometry, iconGeometry, QRect())
CLIENT_HELPER(bool, isSpecialWindow, isSpecialWindow, true)
CLIENT_HELPER(bool, acceptsFocus, wantsInput, true) // We don't actually know...
CLIENT_HELPER(QIcon, icon, icon, QIcon())
CLIENT_HELPER(bool, isSkipSwitcher, skipSwitcher, false)
CLIENT_HELPER(bool, decorationHasAlpha, decorationHasAlpha, false)
CLIENT_HELPER(bool, isUnresponsive, unresponsive, false)
#undef CLIENT_HELPER
QSize EffectWindowImpl::basicUnit() const
{
if (auto client = qobject_cast<X11Client *>(toplevel)) {
......@@ -2249,9 +2236,11 @@ EffectWindowList EffectWindowImpl::mainWindows() const
if (auto client = static_cast<AbstractClient *>(toplevel->isClient() ? toplevel : nullptr)) {
return getMainWindows(client);
}
if (auto deleted = static_cast<Deleted *>(toplevel->isDeleted() ? toplevel : nullptr)) {
return getMainWindows(deleted);
}
return {};
}
......
......@@ -51,7 +51,7 @@ const NET::WindowTypes SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK = NET::NormalMask
| NET::CriticalNotificationMask;
Unmanaged::Unmanaged()
: Toplevel()
: AbstractClient()
{
switch (kwinApp()->operationMode()) {
case Application::OperationModeXwayland:
......
......@@ -12,12 +12,12 @@
#include <netwm.h>
#include "toplevel.h"
#include "abstract_client.h"
namespace KWin
{
class KWIN_EXPORT Unmanaged : public Toplevel
class KWIN_EXPORT Unmanaged : public AbstractClient
{
Q_OBJECT
public:
......@@ -37,6 +37,28 @@ public:
NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
bool isOutline() const override;
QString captionNormal() const override { return {}; }
QString captionSuffix() const override { return {}; }
bool isCloseable() const override { return false; }
bool isShown() const override { return false; }
bool isHiddenInternal() const override { return false; }
void hideClient() override { /* nothing to do */ }
void showClient() override { /* nothing to do */ }
AbstractClient *findModal(bool /*allow_itself*/) override { return nullptr; }
bool isResizable() const override { return false; }
bool isMovable() const override { return false; }
bool isMovableAcrossScreens() const override { return false; }
bool takeFocus() override { return false; }
bool wantsInput() const override { return false; }
void killWindow() override { /* nothing to do */ }
void destroyClient() override { /* nothing to do */ }
void closeWindow() override { /* nothing to do */ }
bool acceptsFocus() const override { return false; }
bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks /*checks*/) const override { return other == this; }
void moveResizeInternal(const QRect & /*rect*/, KWin::AbstractClient::MoveResizeMode /*mode*/) override { /* nothing to do */ }
void updateCaption() override { /* nothing to do */ }
void resizeWithChecks(const QSize&) override { /* nothing to do */ }
public Q_SLOTS:
void release(ReleaseReason releaseReason = ReleaseReason::Release);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment