Commit bebe8120 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii Committed by Vlad Zahorodnii
Browse files

Port QPA away from Wayland

Summary:
So far wayland was used by internal clients to submit raster buffers
and position themselves on the screen. While we didn't have issues with
submitting raster buffers, there were some problems with positioning
task switchers. Mostly, because we had effectively two paths that may
alter geometry.

A better approach to deal with internal clients is to let our QPA use
kwin core api directly. This way we can eliminate unnecessary roundtrips
as well make geometry handling much easier and comprehensible.

The last missing piece is shadows. Both Plasma::Dialog and Breeze widget
style use platform-specific APIs to set and unset shadows. We need to
add shadows API to KWindowSystem. Even though some internal clients lack
drop-shadows at the moment, I don't consider it to be a blocker. We can
add shadows back later on.

CCBUG: 386304

Reviewers: #kwin, davidedmundson, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kwin

Tags: #kwin

Maniphest Tasks: T9600

Differential Revision: https://phabricator.kde.org/D22810
parent ca1f66b1
......@@ -3,6 +3,7 @@
This file is part of the KDE project.
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
Copyright (C) 2019 Vlad Zagorodniy <vladzzag@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -1992,4 +1993,9 @@ bool AbstractClient::supportsWindowRules() const
return true;
}
QMargins AbstractClient::frameMargins() const
{
return QMargins(borderLeft(), borderTop(), borderRight(), borderBottom());
}
}
......@@ -3,6 +3,7 @@
This file is part of the KDE project.
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
Copyright (C) 2019 Vlad Zagorodniy <vladzzag@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -834,6 +835,14 @@ public:
*/
virtual bool supportsWindowRules() const;
/**
* Returns the extents of the server-side decoration.
*
* Note that the returned margins object will have all margins set to 0 if
* the client doesn't have a server-side decoration.
*/
QMargins frameMargins() const;
public Q_SLOTS:
virtual void closeWindow() = 0;
......
......@@ -18,11 +18,13 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "kwin_wayland_test.h"
#include "platform.h"
#include "debug_console.h"
#include "internal_client.h"
#include "platform.h"
#include "screens.h"
#include "shell_client.h"
#include "wayland_server.h"
#include "workspace.h"
#include "xcbutils.h"
#include <KWayland/Client/connection_thread.h>
......@@ -57,8 +59,9 @@ private Q_SLOTS:
void DebugConsoleTest::initTestCase()
{
qRegisterMetaType<KWin::ShellClient*>();
qRegisterMetaType<KWin::AbstractClient*>();
qRegisterMetaType<KWin::AbstractClient *>();
qRegisterMetaType<KWin::InternalClient *>();
qRegisterMetaType<KWin::ShellClient *>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid());
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
......@@ -497,8 +500,7 @@ void DebugConsoleTest::testInternalWindow()
w->hide();
w.reset();
QVERIFY(rowsRemovedSpy.wait());
QCOMPARE(rowsRemovedSpy.count(), 1);
QTRY_COMPARE(rowsRemovedSpy.count(), 1);
QCOMPARE(rowsRemovedSpy.first().first().value<QModelIndex>(), internalTopLevelIndex);
}
......@@ -511,12 +513,12 @@ void DebugConsoleTest::testClosingDebugConsole()
QSignalSpy destroyedSpy(console, &QObject::destroyed);
QVERIFY(destroyedSpy.isValid());
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
console->show();
QCOMPARE(console->windowHandle()->isVisible(), true);
QTRY_COMPARE(clientAddedSpy.count(), 1);
ShellClient *c = clientAddedSpy.first().first().value<ShellClient*>();
InternalClient *c = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(c->isInternal());
QCOMPARE(c->internalWindow(), console->windowHandle());
QVERIFY(c->isDecorated());
......
......@@ -18,16 +18,17 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "kwin_wayland_test.h"
#include "platform.h"
#include "abstract_client.h"
#include "cursor.h"
#include "internal_client.h"
#include "platform.h"
#include "pointer_input.h"
#include "touch_input.h"
#include "screenedge.h"
#include "screens.h"
#include "shell_client.h"
#include "wayland_server.h"
#include "workspace.h"
#include "shell_client.h"
#include <kwineffects.h>
#include "decorations/decoratedclient.h"
......@@ -133,8 +134,9 @@ AbstractClient *DecorationInputTest::showWindow(Test::ShellSurfaceType type)
void DecorationInputTest::initTestCase()
{
qRegisterMetaType<KWin::ShellClient*>();
qRegisterMetaType<KWin::AbstractClient*>();
qRegisterMetaType<KWin::AbstractClient *>();
qRegisterMetaType<KWin::InternalClient *>();
qRegisterMetaType<KWin::ShellClient *>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid());
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
......@@ -910,12 +912,12 @@ void DecorationInputTest::testTooltipDoesntEatKeyEvents()
QSignalSpy keyEvent(keyboard, &KWayland::Client::Keyboard::keyChanged);
QVERIFY(keyEvent.isValid());
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
c->decoratedClient()->requestShowToolTip(QStringLiteral("test"));
// now we should get an internal window
QVERIFY(clientAddedSpy.wait());
ShellClient *internal = clientAddedSpy.first().first().value<ShellClient*>();
InternalClient *internal = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internal->isInternal());
QVERIFY(internal->internalWindow()->flags().testFlag(Qt::ToolTip));
......
......@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "deleted.h"
#include "effectloader.h"
#include "effects.h"
#include "internal_client.h"
#include "platform.h"
#include "shell_client.h"
#include "useractions.h"
......@@ -64,6 +65,7 @@ void PopupOpenCloseAnimationTest::initTestCase()
qRegisterMetaType<KWin::AbstractClient *>();
qRegisterMetaType<KWin::Deleted *>();
qRegisterMetaType<KWin::InternalClient *>();
qRegisterMetaType<KWin::ShellClient *>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid());
......@@ -248,11 +250,11 @@ void PopupOpenCloseAnimationTest::testAnimateDecorationTooltips()
QVERIFY(!effect->isActive());
// Show a decoration tooltip.
QSignalSpy tooltipAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy tooltipAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(tooltipAddedSpy.isValid());
client->decoratedClient()->requestShowToolTip(QStringLiteral("KWin rocks!"));
QVERIFY(tooltipAddedSpy.wait());
ShellClient *tooltip = tooltipAddedSpy.first().first().value<ShellClient *>();
InternalClient *tooltip = tooltipAddedSpy.first().first().value<InternalClient *>();
QVERIFY(tooltip->isInternal());
QVERIFY(tooltip->isPopupWindow());
QVERIFY(tooltip->internalWindow()->flags().testFlag(Qt::ToolTip));
......@@ -262,7 +264,7 @@ void PopupOpenCloseAnimationTest::testAnimateDecorationTooltips()
QTRY_VERIFY(!effect->isActive());
// Hide the decoration tooltip.
QSignalSpy tooltipClosedSpy(tooltip, &ShellClient::windowClosed);
QSignalSpy tooltipClosedSpy(tooltip, &InternalClient::windowClosed);
QVERIFY(tooltipClosedSpy.isValid());
client->decoratedClient()->requestHideToolTip();
QVERIFY(tooltipClosedSpy.wait());
......
......@@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "client.h"
#include "cursor.h"
#include "input.h"
#include "internal_client.h"
#include "platform.h"
#include "screens.h"
#include "shell_client.h"
......@@ -63,8 +64,9 @@ private Q_SLOTS:
void GlobalShortcutsTest::initTestCase()
{
qRegisterMetaType<KWin::ShellClient*>();
qRegisterMetaType<KWin::AbstractClient*>();
qRegisterMetaType<KWin::AbstractClient *>();
qRegisterMetaType<KWin::InternalClient *>();
qRegisterMetaType<KWin::ShellClient *>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid());
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
......@@ -346,11 +348,11 @@ void GlobalShortcutsTest::testSetupWindowShortcut()
QVERIFY(client->isActive());
QCOMPARE(client->shortcut(), QKeySequence());
QSignalSpy shortcutDialogAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy shortcutDialogAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(shortcutDialogAddedSpy.isValid());
workspace()->slotSetupWindowShortcut();
QTRY_COMPARE(shortcutDialogAddedSpy.count(), 1);
auto dialog = shortcutDialogAddedSpy.first().first().value<ShellClient*>();
auto dialog = shortcutDialogAddedSpy.first().first().value<InternalClient *>();
QVERIFY(dialog);
QVERIFY(dialog->isInternal());
auto sequenceEdit = workspace()->shortcutDialog()->findChild<QKeySequenceEdit*>();
......
......@@ -22,8 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "cursor.h"
#include "effects.h"
#include "internal_client.h"
#include "shell_client.h"
#include "screens.h"
#include "shell_client.h"
#include "wayland_server.h"
#include "workspace.h"
......@@ -184,8 +184,9 @@ void HelperWindow::keyReleaseEvent(QKeyEvent *event)
void InternalWindowTest::initTestCase()
{
qRegisterMetaType<KWin::ShellClient*>();
qRegisterMetaType<KWin::AbstractClient*>();
qRegisterMetaType<KWin::AbstractClient *>();
qRegisterMetaType<KWin::InternalClient *>();
qRegisterMetaType<KWin::ShellClient *>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid());
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
......@@ -211,26 +212,27 @@ void InternalWindowTest::init()
void InternalWindowTest::cleanup()
{
Test::destroyWaylandConnection();
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
}
void InternalWindowTest::testEnterLeave()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
QVERIFY(!workspace()->findToplevel(nullptr));
QVERIFY(!workspace()->findToplevel(&win));
QVERIFY(!workspace()->findInternal(nullptr));
QVERIFY(!workspace()->findInternal(&win));
win.setGeometry(0, 0, 100, 100);
win.show();
QTRY_COMPARE(clientAddedSpy.count(), 1);
QVERIFY(!workspace()->activeClient());
ShellClient *c = clientAddedSpy.first().first().value<ShellClient*>();
InternalClient *c = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(c);
QVERIFY(c->isInternal());
QVERIFY(qobject_cast<InternalClient*>(c));
QCOMPARE(c->icon().name(), QStringLiteral("wayland"));
QVERIFY(!c->isDecorated());
QCOMPARE(workspace()->findToplevel(&win), c);
QCOMPARE(workspace()->findInternal(&win), c);
QCOMPARE(c->geometry(), QRect(0, 0, 100, 100));
QVERIFY(c->isShown(false));
QVERIFY(workspace()->xStackingOrder().contains(c));
......@@ -262,21 +264,11 @@ void InternalWindowTest::testEnterLeave()
// inside the mask we should still get an enter
kwinApp()->platform()->pointerMotion(QPoint(25, 27), timestamp++);
QTRY_COMPARE(enterSpy.count(), 2);
// hide the window, which should be removed from the stacking order
win.hide();
QTRY_VERIFY(!c->isShown(false));
QVERIFY(!workspace()->xStackingOrder().contains(c));
// show again
win.show();
QTRY_VERIFY(c->isShown(false));
QVERIFY(workspace()->xStackingOrder().contains(c));
}
void InternalWindowTest::testPointerPressRelease()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
......@@ -299,7 +291,7 @@ void InternalWindowTest::testPointerPressRelease()
void InternalWindowTest::testPointerAxis()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
......@@ -327,7 +319,7 @@ void InternalWindowTest::testKeyboard_data()
void InternalWindowTest::testKeyboard()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
......@@ -337,7 +329,7 @@ void InternalWindowTest::testKeyboard()
QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased);
QVERIFY(releaseSpy.isValid());
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QVERIFY(internalClient->isInternal());
QVERIFY(internalClient->readyForPainting());
......@@ -356,7 +348,7 @@ void InternalWindowTest::testKeyboard()
void InternalWindowTest::testKeyboardShowWithoutActivating()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setProperty("_q_showWithoutActivating", true);
......@@ -367,7 +359,7 @@ void InternalWindowTest::testKeyboardShowWithoutActivating()
QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased);
QVERIFY(releaseSpy.isValid());
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QVERIFY(internalClient->isInternal());
QVERIFY(internalClient->readyForPainting());
......@@ -412,7 +404,7 @@ void InternalWindowTest::testKeyboardTriggersLeave()
QCOMPARE(enteredSpy.count(), 1);
// create internal window
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
......@@ -422,7 +414,7 @@ void InternalWindowTest::testKeyboardTriggersLeave()
QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased);
QVERIFY(releaseSpy.isValid());
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QVERIFY(internalClient->isInternal());
QVERIFY(internalClient->readyForPainting());
......@@ -449,7 +441,7 @@ void InternalWindowTest::testKeyboardTriggersLeave()
void InternalWindowTest::testTouch()
{
// touch events for internal windows are emulated through mouse events
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
......@@ -513,20 +505,20 @@ void InternalWindowTest::testTouch()
void InternalWindowTest::testOpacity()
{
// this test verifies that opacity is properly synced from QWindow to ShellClient
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
// this test verifies that opacity is properly synced from QWindow to InternalClient
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setOpacity(0.5);
win.setGeometry(0, 0, 100, 100);
win.show();
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QVERIFY(internalClient->isInternal());
QCOMPARE(internalClient->opacity(), 0.5);
QSignalSpy opacityChangedSpy(internalClient, &ShellClient::opacityChanged);
QSignalSpy opacityChangedSpy(internalClient, &InternalClient::opacityChanged);
QVERIFY(opacityChangedSpy.isValid());
win.setOpacity(0.75);
QCOMPARE(opacityChangedSpy.count(), 1);
......@@ -535,14 +527,14 @@ void InternalWindowTest::testOpacity()
void InternalWindowTest::testMove()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setOpacity(0.5);
win.setGeometry(0, 0, 100, 100);
win.show();
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QCOMPARE(internalClient->geometry(), QRect(0, 0, 100, 100));
......@@ -576,7 +568,7 @@ void InternalWindowTest::testSkipCloseAnimation_data()
void InternalWindowTest::testSkipCloseAnimation()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setOpacity(0.5);
......@@ -585,7 +577,7 @@ void InternalWindowTest::testSkipCloseAnimation()
win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", initial);
win.show();
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QCOMPARE(internalClient->skipsCloseAnimation(), initial);
QSignalSpy skipCloseChangedSpy(internalClient, &Toplevel::skipCloseAnimationChanged);
......@@ -600,14 +592,14 @@ void InternalWindowTest::testSkipCloseAnimation()
void InternalWindowTest::testModifierClickUnrestrictedMove()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
win.setFlags(win.flags() & ~Qt::FramelessWindowHint);
win.show();
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QVERIFY(internalClient->isDecorated());
......@@ -642,14 +634,14 @@ void InternalWindowTest::testModifierClickUnrestrictedMove()
void InternalWindowTest::testModifierScroll()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
win.setFlags(win.flags() & ~Qt::FramelessWindowHint);
win.show();
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QVERIFY(internalClient->isDecorated());
......@@ -676,14 +668,14 @@ void InternalWindowTest::testModifierScroll()
void InternalWindowTest::testPopup()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
win.setFlags(win.flags() | Qt::Popup);
win.show();
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QCOMPARE(internalClient->isPopupWindow(), true);
}
......@@ -695,7 +687,7 @@ void InternalWindowTest::testScale()
Q_ARG(QVector<QRect>, QVector<QRect>({QRect(0,0,1280, 1024), QRect(1280/2, 0, 1280, 1024)})),
Q_ARG(QVector<int>, QVector<int>({2,2})));
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
......@@ -703,10 +695,8 @@ void InternalWindowTest::testScale()
win.show();
QCOMPARE(win.devicePixelRatio(), 2.0);
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
QCOMPARE(internalClient->surface()->scale(), 2);
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QCOMPARE(internalClient->bufferScale(), 2);
}
void InternalWindowTest::testWindowType_data()
......@@ -732,7 +722,7 @@ void InternalWindowTest::testWindowType_data()
void InternalWindowTest::testWindowType()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
......@@ -740,7 +730,7 @@ void InternalWindowTest::testWindowType()
KWindowSystem::setType(win.winId(), windowType);
win.show();
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QCOMPARE(internalClient->windowType(), windowType);
}
......@@ -767,13 +757,13 @@ void InternalWindowTest::testChangeWindowType_data()
void InternalWindowTest::testChangeWindowType()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
win.show();
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QCOMPARE(internalClient->windowType(), NET::Normal);
......@@ -787,13 +777,13 @@ void InternalWindowTest::testChangeWindowType()
void InternalWindowTest::testEffectWindow()
{
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
QSignalSpy clientAddedSpy(workspace(), &Workspace::internalClientAdded);
QVERIFY(clientAddedSpy.isValid());
HelperWindow win;
win.setGeometry(0, 0, 100, 100);
win.show();
QTRY_COMPARE(clientAddedSpy.count(), 1);
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
auto internalClient = clientAddedSpy.first().first().value<InternalClient *>();
QVERIFY(internalClient);
QVERIFY(internalClient->effectWindow());
QCOMPARE(internalClient->effectWindow()->internalWindow(), &win);
......
......@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "decorations/decoratedclient.h"
#include "deleted.h"
#include "effects.h"
#include "internal_client.h"
#include "overlaywindow.h"
#include "platform.h"
#include "scene.h"
......@@ -357,6 +358,10 @@ void Compositor::startupWithWorkspace()
c->setupCompositing();
c->getShadow();
}
for (InternalClient *client : workspace()->internalClients()) {
client->setupCompositing();
client->getShadow();
}
if (auto *server = waylandServer()) {
const auto clients = server->clients();
......@@ -364,11 +369,6 @@ void Compositor::startupWithWorkspace()
c->setupCompositing();
c->getShadow();
}
const auto internalClients = server->internalClients();
for (ShellClient *c : internalClients) {
c->setupCompositing();
c->getShadow();
}
}
m_state = State::On;
......@@ -415,6 +415,9 @@ void Compositor::stop()
for (Unmanaged *c : Workspace::self()->unmanagedList()) {
m_scene->removeToplevel(c);
}
for (InternalClient *client : workspace()->internalClients()) {
m_scene->removeToplevel(client);
}
for (Client *c : Workspace::self()->clientList()) {
c->finishCompositing();
}
......@@ -424,6 +427,9 @@ void Compositor::stop()
for (Unmanaged *c : Workspace::self()->unmanagedList()) {
c->finishCompositing();
}
for (InternalClient *client : workspace()->internalClients()) {
client->finishCompositing();
}
if (auto *con = kwinApp()->x11Connection()) {
xcb_composite_unredirect_subwindows(con, kwinApp()->x11RootWindow(),
XCB_COMPOSITE_REDIRECT_MANUAL);
......@@ -437,15 +443,9 @@ void Compositor::stop()
for (ShellClient *c : waylandServer()->clients()) {
m_scene->removeToplevel(c);
}
for (ShellClient *c : waylandServer()->internalClients()) {
m_scene->removeToplevel(c);
}
for (ShellClient *c : waylandServer()->clients()) {