Replace Deleted with Window where possible

With this, Window and Deleted can be interchanged, which makes merging
the two easier.
This commit is contained in:
Vlad Zahorodnii 2023-03-02 23:08:15 +02:00
parent 149db99c6a
commit 2f56cdc3fe
51 changed files with 62 additions and 197 deletions

View file

@ -11,7 +11,6 @@
#include "activities.h"
#include "core/output.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "pointer_input.h"
#include "utils/xcbutils.h"
#include "wayland_server.h"
@ -47,7 +46,6 @@ private:
void ActivitiesTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -12,7 +12,6 @@
#include "atoms.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "rules.h"
#include "virtualdesktops.h"
#include "wayland_server.h"
@ -54,7 +53,6 @@ private Q_SLOTS:
void TestDbusInterface::initTestCase()
{
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::Window *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);

View file

@ -10,7 +10,6 @@
#include "core/output.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "pointer_input.h"
#include "utils/xcbutils.h"
#include "wayland_server.h"
@ -42,7 +41,6 @@ private:
void X11DesktopWindowTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -10,7 +10,6 @@
#include "composite.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "effectloader.h"
#include "effects.h"
#include "scripting/scriptedeffect.h"
@ -43,7 +42,6 @@ private Q_SLOTS:
void DontCrashCancelAnimationFromAnimationEndedTest::initTestCase()
{
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::Window *>();
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -9,7 +9,6 @@
#include "kwin_wayland_test.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "wayland_server.h"
#include "window.h"
#include "workspace.h"
@ -32,7 +31,7 @@ private Q_SLOTS:
void DontCrashGlxgearsTest::initTestCase()
{
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::Window *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -13,7 +13,6 @@
#include "core/output.h"
#include "core/outputbackend.h"
#include "core/renderbackend.h"
#include "deleted.h"
#include "effectloader.h"
#include "effects.h"
#include "wayland_server.h"
@ -45,7 +44,6 @@ void DontCrashReinitializeCompositorTest::initTestCase()
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -10,7 +10,6 @@
#include "kwin_wayland_test.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "effectloader.h"
#include "effects.h"
#include "internalwindow.h"
@ -48,7 +47,6 @@ void PopupOpenCloseAnimationTest::initTestCase()
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::InternalWindow *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));

View file

@ -13,7 +13,6 @@
#include "core/outputbackend.h"
#include "core/renderbackend.h"
#include "cursor.h"
#include "deleted.h"
#include "effectloader.h"
#include "effects.h"
#include "libkwineffects/anidata_p.h"
@ -127,7 +126,6 @@ bool ScriptedEffectWithDebugSpy::load(const QString &name)
void ScriptedEffectsTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::Effect *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));

View file

@ -10,7 +10,6 @@
#include "core/outputbackend.h"
#include "core/renderbackend.h"
#include "cursor.h"
#include "deleted.h"
#include "effectloader.h"
#include "effects.h"
#include "kwin_wayland_test.h"
@ -49,7 +48,6 @@ void SlidingPopupsTest::initTestCase()
{
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::Effect *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));

View file

@ -12,7 +12,6 @@
#include "composite.h"
#include "core/outputbackend.h"
#include "core/renderbackend.h"
#include "deleted.h"
#include "effectloader.h"
#include "effects.h"
#include "wayland_server.h"
@ -45,7 +44,6 @@ void ToplevelOpenCloseAnimationTest::initTestCase()
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -10,7 +10,6 @@
#include "core/output.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "pointer_input.h"
#include "wayland/seat_interface.h"
#include "wayland_server.h"
@ -48,7 +47,6 @@ private:
void InputStackingOrderTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -10,7 +10,6 @@
#include "core/output.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "effects.h"
#include "inputmethod.h"
#include "keyboard_input.h"
@ -79,7 +78,6 @@ void InputMethodTest::initTestCase()
{
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.kwin.testvirtualkeyboard"));
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWayland::Client::Output *>();

View file

@ -10,7 +10,6 @@
#include "core/output.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "effects.h"
#include "internalwindow.h"
#include "pointer_input.h"
@ -171,7 +170,6 @@ void HelperWindow::keyReleaseEvent(QKeyEvent *event)
void InternalWindowTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::InternalWindow *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));

View file

@ -13,7 +13,6 @@
#include "core/output.h"
#include "core/outputbackend.h"
#include "cursor.h"
#include "deleted.h"
#include "effects.h"
#include "placement.h"
#include "pointer_input.h"
@ -82,7 +81,6 @@ private:
void MoveResizeWindowTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::MaximizeMode>("MaximizeMode");
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));

View file

@ -11,7 +11,6 @@
#include "core/output.h"
#include "core/outputbackend.h"
#include "cursor.h"
#include "deleted.h"
#include "effects.h"
#include "options.h"
#include "pointer_input.h"
@ -132,7 +131,6 @@ private:
void PointerInputTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -10,7 +10,6 @@
#include "core/output.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "pointer_input.h"
#include "screenedge.h"
#include "wayland_server.h"
@ -41,7 +40,6 @@ private Q_SLOTS:
void ScreenEdgeClientShowTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -11,7 +11,6 @@
#include "atoms.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "main.h"
#include "wayland_server.h"
#include "window.h"
@ -53,7 +52,6 @@ private Q_SLOTS:
void StackingOrderTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
@ -182,7 +180,7 @@ void StackingOrderTest::testRaiseTransient()
struct WindowUnrefDeleter
{
void operator()(Deleted *d)
void operator()(Window *d)
{
if (d != nullptr) {
d->unref();
@ -243,7 +241,7 @@ void StackingOrderTest::testDeletedTransient()
QTRY_VERIFY(!transient2->isActive());
// Close the top-most transient.
connect(transient2, &Window::windowClosed, this, [](Window *original, Deleted *deleted) {
connect(transient2, &Window::windowClosed, this, [](Window *original, Window *deleted) {
deleted->ref();
});
@ -252,8 +250,8 @@ void StackingOrderTest::testDeletedTransient()
transient2Surface.reset();
QVERIFY(windowClosedSpy.wait());
std::unique_ptr<Deleted, WindowUnrefDeleter> deletedTransient(
windowClosedSpy.first().at(1).value<Deleted *>());
std::unique_ptr<Window, WindowUnrefDeleter> deletedTransient(
windowClosedSpy.first().at(1).value<Window *>());
QVERIFY(deletedTransient.get());
// The deleted transient still has to be above its old parent (transient1).
@ -646,7 +644,7 @@ void StackingOrderTest::testDeletedGroupTransient()
QCOMPARE(workspace()->stackingOrder(), (QList<Window *>{leader, member1, member2, transient}));
// Unmap the transient.
connect(transient, &X11Window::windowClosed, this, [](Window *original, Deleted *deleted) {
connect(transient, &X11Window::windowClosed, this, [](Window *original, Window *deleted) {
deleted->ref();
});
@ -655,8 +653,8 @@ void StackingOrderTest::testDeletedGroupTransient()
xcb_flush(conn.get());
QVERIFY(windowClosedSpy.wait());
std::unique_ptr<Deleted, WindowUnrefDeleter> deletedTransient(
windowClosedSpy.first().at(1).value<Deleted *>());
std::unique_ptr<Window, WindowUnrefDeleter> deletedTransient(
windowClosedSpy.first().at(1).value<Window *>());
QVERIFY(deletedTransient.get());
// The transient has to be above each member of the window group.

View file

@ -10,7 +10,6 @@
#include "core/output.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "pointer_input.h"
#include "screenedge.h"
#include "virtualdesktops.h"
@ -60,7 +59,6 @@ private:
void StrutsTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -11,7 +11,6 @@
#include "atoms.h"
#include "core/output.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "pointer_input.h"
#include "rules.h"
#include "wayland_server.h"
@ -40,7 +39,6 @@ private Q_SLOTS:
void WindowRuleTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -12,7 +12,6 @@
#include "composite.h"
#include "core/outputbackend.h"
#include "cursor.h"
#include "deleted.h"
#include "effectloader.h"
#include "effects.h"
#include "wayland_server.h"
@ -62,7 +61,6 @@ void X11WindowTest::initTestCase_data()
void X11WindowTest::initTestCase()
{
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::Window *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
@ -749,7 +747,7 @@ void X11WindowTest::testX11WindowId()
QUuid deletedUuid;
QCOMPARE(deletedUuid.isNull(), true);
connect(window, &X11Window::windowClosed, this, [&deletedUuid](Window *, Deleted *d) {
connect(window, &X11Window::windowClosed, this, [&deletedUuid](Window *, Window *d) {
deletedUuid = d->internalId();
});

View file

@ -13,7 +13,6 @@
#include "core/outputbackend.h"
#include "decorations/decorationbridge.h"
#include "decorations/settings.h"
#include "deleted.h"
#include "effects.h"
#include "pointer_input.h"
#include "virtualdesktops.h"
@ -160,7 +159,6 @@ void TestXdgShellWindow::testXdgWindowRepositioning()
void TestXdgShellWindow::initTestCase()
{
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWayland::Client::Output *>();

View file

@ -10,7 +10,6 @@
#include "core/output.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "pointer_input.h"
#include "wayland/seat_interface.h"
#include "wayland_server.h"
@ -40,7 +39,6 @@ private Q_SLOTS:
void XWaylandInputTest::initTestCase()
{
qRegisterMetaType<KWin::Window *>();
qRegisterMetaType<KWin::Deleted *>();
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
QVERIFY(waylandServer()->init(s_socketName));
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));

View file

@ -20,7 +20,6 @@
#include "cursordelegate_qpainter.h"
#include "dbusinterface.h"
#include "decorations/decoratedclient.h"
#include "deleted.h"
#include "effects.h"
#include "ftrace.h"
#include "internalwindow.h"

View file

@ -25,12 +25,7 @@ Deleted::Deleted()
, m_frame(XCB_WINDOW_NONE)
, m_layer(UnknownLayer)
, m_shade(false)
, m_minimized(false)
, m_modal(false)
, m_wasClient(false)
, m_fullscreen(false)
, m_keepAbove(false)
, m_keepBelow(false)
, m_wasPopupWindow(false)
, m_wasOutline(false)
, m_wasLockScreen(false)
@ -80,16 +75,11 @@ void Deleted::copyToDeleted(Window *window)
decoration_right,
decoration_bottom);
}
m_wasClient = true;
m_minimized = window->isMinimized();
m_modal = window->isModal();
m_mainWindows = window->mainWindows();
for (Window *w : std::as_const(m_mainWindows)) {
connect(w, &Window::windowClosed, this, &Deleted::mainWindowClosed);
}
m_fullscreen = window->isFullScreen();
m_keepAbove = window->keepAbove();
m_keepBelow = window->keepBelow();
m_caption = window->caption();
for (auto vd : std::as_const(m_desktops)) {

View file

@ -37,23 +37,11 @@ public:
{
return m_shade;
}
bool isMinimized() const
{
return m_minimized;
}
bool isModal() const
{
return m_modal;
}
QList<Window *> mainWindows() const override
{
return m_mainWindows;
}
NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
bool wasClient() const
{
return m_wasClient;
}
QString windowRole() const override;
bool isFullScreen() const override
@ -61,20 +49,6 @@ public:
return m_fullscreen;
}
bool keepAbove() const
{
return m_keepAbove;
}
bool keepBelow() const
{
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; }
@ -147,15 +121,10 @@ private:
QRectF decoration_bottom;
Layer m_layer;
bool m_shade;
bool m_minimized;
bool m_modal;
QList<Window *> m_mainWindows;
bool m_wasClient;
NET::WindowType m_type = NET::Unknown;
QString m_windowRole;
bool m_fullscreen;
bool m_keepAbove;
bool m_keepBelow;
QString m_caption;
bool m_wasPopupWindow;
bool m_wasOutline;

View file

@ -21,7 +21,6 @@
#include "core/renderbackend.h"
#include "core/renderlayer.h"
#include "cursor.h"
#include "deleted.h"
#include "group.h"
#include "input_event.h"
#include "internalwindow.h"
@ -177,7 +176,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, WorkspaceScene *s
connect(ws, &Workspace::windowActivated, this, [this](Window *window) {
Q_EMIT windowActivated(window ? window->effectWindow() : nullptr);
});
connect(ws, &Workspace::deletedRemoved, this, [this](KWin::Deleted *d) {
connect(ws, &Workspace::deletedRemoved, this, [this](KWin::Window *d) {
Q_EMIT windowDeleted(d->effectWindow());
elevated_windows.removeAll(d->effectWindow());
});
@ -525,7 +524,7 @@ void EffectsHandlerImpl::slotUnmanagedShown(Window *window)
Q_EMIT windowAdded(u->effectWindow());
}
void EffectsHandlerImpl::slotWindowClosed(Window *original, Deleted *d)
void EffectsHandlerImpl::slotWindowClosed(Window *original, Window *d)
{
original->disconnect(this);
if (d) {
@ -1976,16 +1975,16 @@ const EffectWindowGroup *EffectWindowImpl::group() const
void EffectWindowImpl::refWindow()
{
if (auto d = static_cast<Deleted *>(m_window->isDeleted() ? m_window : nullptr)) {
return d->ref();
if (m_window->isDeleted()) {
return m_window->ref();
}
Q_UNREACHABLE(); // TODO
}
void EffectWindowImpl::unrefWindow()
{
if (auto d = static_cast<Deleted *>(m_window->isDeleted() ? m_window : nullptr)) {
return d->unref(); // delays deletion in case
if (m_window->isDeleted()) {
return m_window->unref();
}
Q_UNREACHABLE(); // TODO
}
@ -2041,44 +2040,26 @@ WINDOW_HELPER(bool, isLockScreen, isLockScreen)
WINDOW_HELPER(pid_t, pid, pid)
WINDOW_HELPER(qlonglong, windowId, window)
WINDOW_HELPER(QUuid, internalId, internalId)
WINDOW_HELPER(bool, isMinimized, isMinimized)
WINDOW_HELPER(bool, isModal, isModal)
WINDOW_HELPER(bool, isFullScreen, isFullScreen)
WINDOW_HELPER(bool, keepAbove, keepAbove)
WINDOW_HELPER(bool, keepBelow, keepBelow)
WINDOW_HELPER(QString, caption, caption)
WINDOW_HELPER(bool, isMovable, isMovable)
WINDOW_HELPER(bool, isMovableAcrossScreens, isMovableAcrossScreens)
WINDOW_HELPER(bool, isUserMove, isInteractiveMove)
WINDOW_HELPER(bool, isUserResize, isInteractiveResize)
WINDOW_HELPER(QRectF, iconGeometry, iconGeometry)
WINDOW_HELPER(bool, isSpecialWindow, isSpecialWindow)
WINDOW_HELPER(bool, acceptsFocus, wantsInput)
WINDOW_HELPER(QIcon, icon, icon)
WINDOW_HELPER(bool, isSkipSwitcher, skipSwitcher)
WINDOW_HELPER(bool, decorationHasAlpha, decorationHasAlpha)
WINDOW_HELPER(bool, isUnresponsive, unresponsive)
#undef WINDOW_HELPER
// TODO: Merge Window and Deleted.
#define MANAGED_HELPER(rettype, prototype, propertyname, defaultValue) \
rettype EffectWindowImpl::prototype() const \
{ \
auto client = static_cast<Window *>(m_window->isClient() ? m_window : nullptr); \
if (client) { \
return client->propertyname(); \
} \
auto deleted = static_cast<Deleted *>(m_window->isDeleted() ? m_window : nullptr); \
if (deleted) { \
return deleted->propertyname(); \
} \
return defaultValue; \
}
MANAGED_HELPER(bool, isMinimized, isMinimized, false)
MANAGED_HELPER(bool, isModal, isModal, false)
MANAGED_HELPER(bool, isFullScreen, isFullScreen, false)
MANAGED_HELPER(bool, keepAbove, keepAbove, false)
MANAGED_HELPER(bool, keepBelow, keepBelow, false)
MANAGED_HELPER(QString, caption, caption, QString());
MANAGED_HELPER(bool, isMovable, isMovable, false)
MANAGED_HELPER(bool, isMovableAcrossScreens, isMovableAcrossScreens, false)
MANAGED_HELPER(bool, isUserMove, isInteractiveMove, false)
MANAGED_HELPER(bool, isUserResize, isInteractiveResize, false)
MANAGED_HELPER(QRectF, iconGeometry, iconGeometry, QRectF())
MANAGED_HELPER(bool, isSpecialWindow, isSpecialWindow, true)
MANAGED_HELPER(bool, acceptsFocus, wantsInput, true) // We don't actually know...
MANAGED_HELPER(QIcon, icon, icon, QIcon())
MANAGED_HELPER(bool, isSkipSwitcher, skipSwitcher, false)
MANAGED_HELPER(bool, decorationHasAlpha, decorationHasAlpha, false)
MANAGED_HELPER(bool, isUnresponsive, unresponsive, false)
#undef MANAGED_HELPER
QVector<uint> EffectWindowImpl::desktops() const
{
const auto desks = m_window->desktops();
@ -2193,15 +2174,7 @@ EffectWindowList getMainWindows(T *c)
EffectWindowList EffectWindowImpl::mainWindows() const
{
if (auto client = static_cast<Window *>(m_window->isClient() ? m_window : nullptr)) {
return getMainWindows(client);
}
if (auto deleted = static_cast<Deleted *>(m_window->isDeleted() ? m_window : nullptr)) {
return getMainWindows(deleted);
}
return {};
return getMainWindows(m_window);
}
void EffectWindowImpl::setData(int role, const QVariant &data)

View file

@ -35,7 +35,6 @@ namespace KWin
{
class Window;
class Compositor;
class Deleted;
class EffectLoader;
class Group;
class Unmanaged;
@ -274,7 +273,7 @@ public Q_SLOTS:
protected Q_SLOTS:
void slotWindowShown(KWin::Window *);
void slotUnmanagedShown(KWin::Window *);
void slotWindowClosed(KWin::Window *original, KWin::Deleted *d);
void slotWindowClosed(KWin::Window *original, KWin::Window *d);
void slotOpacityChanged(KWin::Window *window, qreal oldOpacity);
void slotClientModalityChanged();
void slotWindowDamaged(KWin::Window *window);

View file

@ -8,7 +8,6 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "idle_inhibition.h"
#include "deleted.h"
#include "input.h"
#include "virtualdesktops.h"
#include "wayland/surface_interface.h"

View file

@ -21,7 +21,6 @@
#if KWIN_BUILD_SCREENLOCKER
#include "screenlockerwatcher.h"
#endif
#include "deleted.h"
#include "tablet_input.h"
#include "touch_input.h"
#include "wayland/display.h"

View file

@ -7,7 +7,6 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "keyboard_layout_switching.h"
#include "deleted.h"
#include "keyboard_layout.h"
#include "virtualdesktops.h"
#include "window.h"

View file

@ -65,7 +65,6 @@
*/
#include "composite.h"
#include "deleted.h"
#include "effects.h"
#include "focuschain.h"
#include "group.h"

View file

@ -10,7 +10,6 @@
#include "composite.h"
#include "core/output.h"
#include "core/outputbackend.h"
#include "deleted.h"
#include "effects.h"
#include "kwingltexture.h"
#include "outputscreencastsource.h"

View file

@ -10,7 +10,6 @@
#include "composite.h"
#include "core/output.h"
#include "core/renderloop.h"
#include "deleted.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "libkwineffects/kwingltexture.h"

View file

@ -5,7 +5,6 @@
*/
#include "popup_input_filter.h"
#include "deleted.h"
#include "input_event.h"
#include "internalwindow.h"
#include "wayland/seat_interface.h"

View file

@ -9,7 +9,6 @@
#include "composite.h"
#include "core/output.h"
#include "decorations/decoratedclient.h"
#include "deleted.h"
#include "scene/workspacescene.h"
#include <cmath>
@ -166,7 +165,7 @@ void DecorationItem::handleFrameGeometryChanged()
setSize(m_window->size().toSize());
}
void DecorationItem::handleWindowClosed(Window *original, Deleted *deleted)
void DecorationItem::handleWindowClosed(Window *original, Window *deleted)
{
m_window = deleted;

View file

@ -17,7 +17,6 @@ namespace KWin
{
class Window;
class Deleted;
class Output;
namespace Decoration
@ -88,7 +87,7 @@ public:
private Q_SLOTS:
void handleFrameGeometryChanged();
void handleWindowClosed(Window *original, Deleted *deleted);
void handleWindowClosed(Window *original, Window *deleted);
void handleOutputChanged();
void handleOutputScaleChanged();

View file

@ -6,7 +6,6 @@
#include "scene/shadowitem.h"
#include "composite.h"
#include "deleted.h"
#include "scene/workspacescene.h"
#include "shadow.h"
@ -68,7 +67,7 @@ void ShadowItem::handleTextureChanged()
m_textureDirty = true;
}
void ShadowItem::handleWindowClosed(Window *original, Deleted *deleted)
void ShadowItem::handleWindowClosed(Window *original, Window *deleted)
{
m_window = deleted;
}

View file

@ -11,7 +11,6 @@
namespace KWin
{
class Deleted;
class Shadow;
class Window;
@ -50,7 +49,7 @@ protected:
private Q_SLOTS:
void handleTextureChanged();
void updateGeometry();
void handleWindowClosed(Window *original, Deleted *deleted);
void handleWindowClosed(Window *original, Window *deleted);
private:
Window *m_window;

View file

@ -7,7 +7,6 @@
#include "scene/surfaceitem_internal.h"
#include "composite.h"
#include "core/renderbackend.h"
#include "deleted.h"
#include "internalwindow.h"
#include <QOpenGLFramebufferObject>
@ -55,7 +54,7 @@ void SurfaceItemInternal::handleBufferGeometryChanged(const QRectF &old)
setSize(m_window->bufferGeometry().size());
}
void SurfaceItemInternal::handleWindowClosed(Window *original, Deleted *deleted)
void SurfaceItemInternal::handleWindowClosed(Window *original, Window *deleted)
{
m_window = deleted;
}

View file

@ -13,7 +13,6 @@ class QOpenGLFramebufferObject;
namespace KWin
{
class Deleted;
class InternalWindow;
/**
@ -32,7 +31,7 @@ public:
private Q_SLOTS:
void handleBufferGeometryChanged(const QRectF &old);
void handleWindowClosed(Window *original, Deleted *deleted);
void handleWindowClosed(Window *original, Window *deleted);
protected:
std::unique_ptr<SurfacePixmap> createPixmap() override;

View file

@ -7,10 +7,10 @@
#include "scene/surfaceitem_wayland.h"
#include "composite.h"
#include "core/renderbackend.h"
#include "deleted.h"
#include "wayland/clientbuffer.h"
#include "wayland/subcompositor_interface.h"
#include "wayland/surface_interface.h"
#include "window.h"
namespace KWin
{
@ -222,7 +222,7 @@ QVector<QRectF> SurfaceItemXwayland::shape() const
return shape;
}
void SurfaceItemXwayland::handleWindowClosed(Window *original, Deleted *deleted)
void SurfaceItemXwayland::handleWindowClosed(Window *original, Window *deleted)
{
m_window = deleted;
}

View file

@ -18,8 +18,6 @@ class SurfaceInterface;
namespace KWin
{
class Deleted;
/**
* The SurfaceItemWayland class represents a Wayland surface in the scene.
*/
@ -92,7 +90,7 @@ public:
QVector<QRectF> shape() const override;
private:
void handleWindowClosed(Window *original, Deleted *deleted);
void handleWindowClosed(Window *original, Window *deleted);
Window *m_window;
};

View file

@ -7,8 +7,8 @@
#include "scene/surfaceitem_x11.h"
#include "composite.h"
#include "core/renderbackend.h"
#include "deleted.h"
#include "x11syncmanager.h"
#include "x11window.h"
namespace KWin
{
@ -49,7 +49,7 @@ Window *SurfaceItemX11::window() const
return m_window;
}
void SurfaceItemX11::handleWindowClosed(Window *original, Deleted *deleted)
void SurfaceItemX11::handleWindowClosed(Window *original, Window *deleted)
{
m_window = deleted;
}

View file

@ -14,8 +14,6 @@
namespace KWin
{
class Deleted;
/**
* The SurfaceItemX11 class represents an X11 surface in the scene.
*/
@ -42,7 +40,7 @@ public:
private Q_SLOTS:
void handleBufferGeometryChanged(const QRectF &old);
void handleGeometryShapeChanged();
void handleWindowClosed(Window *original, Deleted *deleted);
void handleWindowClosed(Window *original, Window *deleted);
protected:
std::unique_ptr<SurfacePixmap> createPixmap() override;

View file

@ -5,7 +5,6 @@
*/
#include "scene/windowitem.h"
#include "deleted.h"
#include "internalwindow.h"
#include "scene/decorationitem.h"
#include "scene/shadowitem.h"
@ -125,7 +124,7 @@ void WindowItem::unrefVisible(int reason)
updateVisibility();
}
void WindowItem::handleWindowClosed(Window *original, Deleted *deleted)
void WindowItem::handleWindowClosed(Window *original, Window *deleted)
{
m_window = deleted;
}

View file

@ -17,7 +17,6 @@ namespace KWin
{
class Window;
class DecorationItem;
class Deleted;
class InternalWindow;
class Shadow;
class ShadowItem;
@ -57,7 +56,7 @@ protected:
void updateSurfaceItem(SurfaceItem *surfaceItem);
private Q_SLOTS:
void handleWindowClosed(Window *original, Deleted *deleted);
void handleWindowClosed(Window *original, Window *deleted);
void updateDecorationItem();
void updateShadowItem();
void updateSurfacePosition();

View file

@ -57,7 +57,6 @@
#include "core/output.h"
#include "core/renderlayer.h"
#include "core/renderloop.h"
#include "deleted.h"
#include "effects.h"
#include "internalwindow.h"
#include "libkwineffects/renderviewport.h"

View file

@ -220,6 +220,10 @@ void Window::copyToDeleted(Window *c)
m_shapeRegionIsValid = c->m_shapeRegionIsValid;
m_shapeRegion = c->m_shapeRegion;
m_stackingOrder = c->m_stackingOrder;
m_minimized = c->m_minimized;
m_modal = c->m_modal;
m_keepAbove = c->m_keepAbove;
m_keepBelow = c->m_keepBelow;
}
// before being deleted, remove references to everything that's now

View file

@ -49,7 +49,6 @@ namespace KWin
class Group;
class Output;
class ClientMachine;
class Deleted;
class EffectWindowImpl;
class Tile;
class Scene;
@ -1409,7 +1408,7 @@ Q_SIGNALS:
void damaged(KWin::Window *window);
void inputTransformationChanged();
void geometryShapeChanged(const QRectF &old);
void windowClosed(KWin::Window *window, KWin::Deleted *deleted);
void windowClosed(KWin::Window *window, KWin::Window *deleted);
void windowShown(KWin::Window *window);
void windowHidden(KWin::Window *window);
/**

View file

@ -25,7 +25,6 @@
#include "core/outputconfiguration.h"
#include "cursor.h"
#include "dbusinterface.h"
#include "deleted.h"
#include "effects.h"
#include "focuschain.h"
#include "group.h"
@ -642,7 +641,7 @@ void Workspace::addToStack(Window *window)
}
}
void Workspace::replaceInStack(Window *original, Deleted *deleted)
void Workspace::replaceInStack(Window *original, Window *deleted)
{
const int unconstraintedIndex = unconstrained_stacking_order.indexOf(original);
if (unconstraintedIndex != -1) {
@ -793,22 +792,19 @@ void Workspace::removeUnmanaged(Unmanaged *window)
Q_EMIT unmanagedRemoved(window);
}
void Workspace::addDeleted(Deleted *c, Window *orig)
void Workspace::addDeleted(Window *c, Window *orig)
{
Q_ASSERT(!deleted.contains(c));
deleted.append(c);
replaceInStack(orig, c);
}
void Workspace::removeDeleted(Deleted *c)
void Workspace::removeDeleted(Window *c)
{
Q_ASSERT(deleted.contains(c));
Q_EMIT deletedRemoved(c);
deleted.removeAll(c);
removeFromStack(c);
if (!c->wasClient()) {
return;
}
if (X11Compositor *compositor = X11Compositor::self()) {
compositor->updateClientCompositeBlocking();
}

View file

@ -54,7 +54,6 @@ class Window;
class Output;
class ColorMapper;
class Compositor;
class Deleted;
class Group;
class InternalWindow;
class KillWindow;
@ -259,7 +258,7 @@ public:
/**
* @return List of deleted "windows" currently managed by Workspace
*/
const QList<Deleted *> &deletedList() const
const QList<Window *> &deletedList() const
{
return deleted;
}
@ -384,8 +383,8 @@ public:
int unconstainedStackingOrderIndex(const X11Window *c) const;
void removeUnmanaged(Unmanaged *); // Only called from Unmanaged::release()
void removeDeleted(Deleted *);
void addDeleted(Deleted *, Window *);
void removeDeleted(Window *);
void addDeleted(Window *, Window *);
bool checkStartupNotification(xcb_window_t w, KStartupInfoId &id, KStartupInfoData &data);
@ -583,7 +582,7 @@ Q_SIGNALS:
void groupAdded(KWin::Group *);
void unmanagedAdded(KWin::Unmanaged *);
void unmanagedRemoved(KWin::Unmanaged *);
void deletedRemoved(KWin::Deleted *);
void deletedRemoved(KWin::Window *);
void configChanged();
void showingDesktopChanged(bool showing, bool animated);
void outputOrderChanged();
@ -628,7 +627,7 @@ private:
void fixPositionAfterCrash(xcb_window_t w, const xcb_get_geometry_reply_t *geom);
void saveOldScreenSizes();
void addToStack(Window *window);
void replaceInStack(Window *original, Deleted *deleted);
void replaceInStack(Window *original, Window *deleted);
void removeFromStack(Window *window);
/// This is the right way to create a new X11 window
@ -691,7 +690,7 @@ private:
QList<X11Window *> m_x11Clients;
QList<Window *> m_allClients;
QList<Unmanaged *> m_unmanaged;
QList<Deleted *> deleted;
QList<Window *> deleted;
QList<InternalWindow *> m_internalWindows;
QList<Window *> unconstrained_stacking_order; // Topmost last