From 4b91c6163f3e4ebac81f8bd83e48fff28e5c7ad8 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 22 Apr 2022 21:11:29 +0300 Subject: [PATCH] Rename XdgShellClient to XdgShellWindow The word "client" means different things in wayland and kwin. Use a better word to refer to windows. --- autotests/integration/CMakeLists.txt | 4 +- ...test.cpp => xdgshellwindow_rules_test.cpp} | 204 +++++----- ...lient_test.cpp => xdgshellwindow_test.cpp} | 110 +++--- src/CMakeLists.txt | 2 +- src/wayland/xdgshell_interface.cpp | 2 +- src/wayland_server.cpp | 28 +- src/wayland_server.h | 14 +- src/xdgshellintegration.cpp | 18 +- src/xdgshellintegration.h | 2 +- ...{xdgshellclient.cpp => xdgshellwindow.cpp} | 356 +++++++++--------- src/{xdgshellclient.h => xdgshellwindow.h} | 18 +- 11 files changed, 379 insertions(+), 379 deletions(-) rename autotests/integration/{xdgshellclient_rules_test.cpp => xdgshellwindow_rules_test.cpp} (94%) rename autotests/integration/{xdgshellclient_test.cpp => xdgshellwindow_test.cpp} (96%) rename src/{xdgshellclient.cpp => xdgshellwindow.cpp} (85%) rename src/{xdgshellclient.h => xdgshellwindow.h} (95%) diff --git a/autotests/integration/CMakeLists.txt b/autotests/integration/CMakeLists.txt index a01c59192d..525e656f81 100644 --- a/autotests/integration/CMakeLists.txt +++ b/autotests/integration/CMakeLists.txt @@ -107,7 +107,7 @@ integrationTest(NAME testDebugConsole SRCS debug_console_test.cpp) integrationTest(NAME testDontCrashEmptyDeco SRCS dont_crash_empty_deco.cpp) integrationTest(WAYLAND_ONLY NAME testPlasmaSurface SRCS plasma_surface_test.cpp) integrationTest(WAYLAND_ONLY NAME testMaximized SRCS maximize_test.cpp) -integrationTest(WAYLAND_ONLY NAME testXdgShellClient SRCS xdgshellclient_test.cpp) +integrationTest(WAYLAND_ONLY NAME testXdgShellWindow SRCS xdgshellwindow_test.cpp) integrationTest(WAYLAND_ONLY NAME testDontCrashNoBorder SRCS dont_crash_no_border.cpp) integrationTest(NAME testXwaylandSelections SRCS xwayland_selections_test.cpp) integrationTest(WAYLAND_ONLY NAME testSceneOpenGL SRCS scene_opengl_test.cpp ) @@ -126,7 +126,7 @@ integrationTest(WAYLAND_ONLY NAME testDontCrashUseractionsMenu SRCS dont_crash_u integrationTest(WAYLAND_ONLY NAME testKWinBindings SRCS kwinbindings_test.cpp) integrationTest(WAYLAND_ONLY NAME testLayerShellV1Window SRCS layershellv1window_test.cpp) integrationTest(WAYLAND_ONLY NAME testVirtualDesktop SRCS virtual_desktop_test.cpp) -integrationTest(WAYLAND_ONLY NAME testXdgShellClientRules SRCS xdgshellclient_rules_test.cpp) +integrationTest(WAYLAND_ONLY NAME testXdgShellWindowRules SRCS xdgshellwindow_rules_test.cpp) integrationTest(WAYLAND_ONLY NAME testIdleInhibition SRCS idle_inhibition_test.cpp) integrationTest(WAYLAND_ONLY NAME testDontCrashCursorPhysicalSizeEmpty SRCS dont_crash_cursor_physical_size_empty.cpp) integrationTest(WAYLAND_ONLY NAME testDontCrashReinitializeCompositor SRCS dont_crash_reinitialize_compositor.cpp) diff --git a/autotests/integration/xdgshellclient_rules_test.cpp b/autotests/integration/xdgshellwindow_rules_test.cpp similarity index 94% rename from autotests/integration/xdgshellclient_rules_test.cpp rename to autotests/integration/xdgshellwindow_rules_test.cpp index a023285045..45572599dd 100644 --- a/autotests/integration/xdgshellclient_rules_test.cpp +++ b/autotests/integration/xdgshellwindow_rules_test.cpp @@ -28,9 +28,9 @@ using namespace KWin; using namespace KWayland::Client; -static const QString s_socketName = QStringLiteral("wayland_test_kwin_xdgshellclient_rules-0"); +static const QString s_socketName = QStringLiteral("wayland_test_kwin_xdgshellwindow_rules-0"); -class TestXdgShellClientRules : public QObject +class TestXdgShellWindowRules : public QObject { Q_OBJECT @@ -174,7 +174,7 @@ private: QScopedPointer m_surfaceConfigureRequestedSpy; }; -void TestXdgShellClientRules::initTestCase() +void TestXdgShellWindowRules::initTestCase() { qRegisterMetaType(); @@ -196,7 +196,7 @@ void TestXdgShellClientRules::initTestCase() RuleBook::self()->setConfig(m_config); } -void TestXdgShellClientRules::init() +void TestXdgShellWindowRules::init() { VirtualDesktopManager::self()->setCurrent(VirtualDesktopManager::self()->desktops().first()); QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::XdgDecorationV1)); @@ -204,7 +204,7 @@ void TestXdgShellClientRules::init() workspace()->setActiveOutput(QPoint(640, 512)); } -void TestXdgShellClientRules::cleanup() +void TestXdgShellWindowRules::cleanup() { if (!m_shellSurface.isNull()) { destroyTestWindow(); @@ -223,7 +223,7 @@ void TestXdgShellClientRules::cleanup() QCOMPARE(VirtualDesktopManager::self()->count(), 1u); } -void TestXdgShellClientRules::createTestWindow(ClientFlags flags) +void TestXdgShellWindowRules::createTestWindow(ClientFlags flags) { // Apply flags for special windows and rules const bool createClient = !(flags & ReturnAfterSurfaceConfiguration); @@ -250,7 +250,7 @@ void TestXdgShellClientRules::createTestWindow(ClientFlags flags) } } -void TestXdgShellClientRules::mapClientToSurface(QSize clientSize, ClientFlags flags) +void TestXdgShellWindowRules::mapClientToSurface(QSize clientSize, ClientFlags flags) { const bool clientShouldBeActive = !(flags & ClientShouldBeInactive); @@ -267,7 +267,7 @@ void TestXdgShellClientRules::mapClientToSurface(QSize clientSize, ClientFlags f QCOMPARE(m_client->isActive(), clientShouldBeActive); } -void TestXdgShellClientRules::destroyTestWindow() +void TestXdgShellWindowRules::destroyTestWindow() { m_surfaceConfigureRequestedSpy.reset(); m_toplevelConfigureRequestedSpy.reset(); @@ -277,7 +277,7 @@ void TestXdgShellClientRules::destroyTestWindow() } template -void TestXdgShellClientRules::setWindowRule(const QString &property, const T &value, int policy) +void TestXdgShellWindowRules::setWindowRule(const QString &property, const T &value, int policy) { // Initialize RuleBook with the test rule. m_config->group("General").writeEntry("count", 1); @@ -294,7 +294,7 @@ void TestXdgShellClientRules::setWindowRule(const QString &property, const T &va workspace()->slotReconfigure(); } -void TestXdgShellClientRules::testPositionDontAffect() +void TestXdgShellWindowRules::testPositionDontAffect() { setWindowRule("position", QPoint(42, 42), int(Rules::DontAffect)); @@ -309,7 +309,7 @@ void TestXdgShellClientRules::testPositionDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testPositionApply() +void TestXdgShellWindowRules::testPositionApply() { setWindowRule("position", QPoint(42, 42), int(Rules::Apply)); @@ -362,7 +362,7 @@ void TestXdgShellClientRules::testPositionApply() destroyTestWindow(); } -void TestXdgShellClientRules::testPositionRemember() +void TestXdgShellWindowRules::testPositionRemember() { setWindowRule("position", QPoint(42, 42), int(Rules::Remember)); createTestWindow(); @@ -414,7 +414,7 @@ void TestXdgShellClientRules::testPositionRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testPositionForce() +void TestXdgShellWindowRules::testPositionForce() { setWindowRule("position", QPoint(42, 42), int(Rules::Force)); @@ -448,7 +448,7 @@ void TestXdgShellClientRules::testPositionForce() destroyTestWindow(); } -void TestXdgShellClientRules::testPositionApplyNow() +void TestXdgShellWindowRules::testPositionApplyNow() { createTestWindow(); @@ -507,7 +507,7 @@ void TestXdgShellClientRules::testPositionApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testPositionForceTemporarily() +void TestXdgShellWindowRules::testPositionForceTemporarily() { setWindowRule("position", QPoint(42, 42), int(Rules::ForceTemporarily)); @@ -541,7 +541,7 @@ void TestXdgShellClientRules::testPositionForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testSizeDontAffect() +void TestXdgShellWindowRules::testSizeDontAffect() { setWindowRule("size", QSize(480, 640), int(Rules::DontAffect)); @@ -565,7 +565,7 @@ void TestXdgShellClientRules::testSizeDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testSizeApply() +void TestXdgShellWindowRules::testSizeApply() { setWindowRule("size", QSize(480, 640), int(Rules::Apply)); @@ -666,7 +666,7 @@ void TestXdgShellClientRules::testSizeApply() destroyTestWindow(); } -void TestXdgShellClientRules::testSizeRemember() +void TestXdgShellWindowRules::testSizeRemember() { setWindowRule("size", QSize(480, 640), int(Rules::Remember)); @@ -767,7 +767,7 @@ void TestXdgShellClientRules::testSizeRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testSizeForce() +void TestXdgShellWindowRules::testSizeForce() { setWindowRule("size", QSize(480, 640), int(Rules::Force)); @@ -820,7 +820,7 @@ void TestXdgShellClientRules::testSizeForce() destroyTestWindow(); } -void TestXdgShellClientRules::testSizeApplyNow() +void TestXdgShellWindowRules::testSizeApplyNow() { createTestWindow(ReturnAfterSurfaceConfiguration); @@ -863,7 +863,7 @@ void TestXdgShellClientRules::testSizeApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testSizeForceTemporarily() +void TestXdgShellWindowRules::testSizeForceTemporarily() { setWindowRule("size", QSize(480, 640), int(Rules::ForceTemporarily)); @@ -916,7 +916,7 @@ void TestXdgShellClientRules::testSizeForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testMaximizeDontAffect() +void TestXdgShellWindowRules::testMaximizeDontAffect() { setWindowRule("maximizehoriz", true, int(Rules::DontAffect)); setWindowRule("maximizevert", true, int(Rules::DontAffect)); @@ -951,7 +951,7 @@ void TestXdgShellClientRules::testMaximizeDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testMaximizeApply() +void TestXdgShellWindowRules::testMaximizeApply() { setWindowRule("maximizehoriz", true, int(Rules::Apply)); setWindowRule("maximizevert", true, int(Rules::Apply)); @@ -1029,7 +1029,7 @@ void TestXdgShellClientRules::testMaximizeApply() destroyTestWindow(); } -void TestXdgShellClientRules::testMaximizeRemember() +void TestXdgShellWindowRules::testMaximizeRemember() { setWindowRule("maximizehoriz", true, int(Rules::Remember)); setWindowRule("maximizevert", true, int(Rules::Remember)); @@ -1108,7 +1108,7 @@ void TestXdgShellClientRules::testMaximizeRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testMaximizeForce() +void TestXdgShellWindowRules::testMaximizeForce() { setWindowRule("maximizehoriz", true, int(Rules::Force)); setWindowRule("maximizevert", true, int(Rules::Force)); @@ -1176,7 +1176,7 @@ void TestXdgShellClientRules::testMaximizeForce() destroyTestWindow(); } -void TestXdgShellClientRules::testMaximizeApplyNow() +void TestXdgShellWindowRules::testMaximizeApplyNow() { createTestWindow(ReturnAfterSurfaceConfiguration); @@ -1258,7 +1258,7 @@ void TestXdgShellClientRules::testMaximizeApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testMaximizeForceTemporarily() +void TestXdgShellWindowRules::testMaximizeForceTemporarily() { setWindowRule("maximizehoriz", true, int(Rules::ForceTemporarily)); setWindowRule("maximizevert", true, int(Rules::ForceTemporarily)); @@ -1326,7 +1326,7 @@ void TestXdgShellClientRules::testMaximizeForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testDesktopsDontAffect() +void TestXdgShellWindowRules::testDesktopsDontAffect() { // We need at least two virtual desktop for this test. VirtualDesktopManager::self()->setCount(2); @@ -1348,7 +1348,7 @@ void TestXdgShellClientRules::testDesktopsDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testDesktopsApply() +void TestXdgShellWindowRules::testDesktopsApply() { // We need at least two virtual desktop for this test. VirtualDesktopManager::self()->setCount(2); @@ -1384,7 +1384,7 @@ void TestXdgShellClientRules::testDesktopsApply() destroyTestWindow(); } -void TestXdgShellClientRules::testDesktopsRemember() +void TestXdgShellWindowRules::testDesktopsRemember() { // We need at least two virtual desktop for this test. VirtualDesktopManager::self()->setCount(2); @@ -1417,7 +1417,7 @@ void TestXdgShellClientRules::testDesktopsRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testDesktopsForce() +void TestXdgShellWindowRules::testDesktopsForce() { // We need at least two virtual desktop for this test. VirtualDesktopManager::self()->setCount(2); @@ -1453,7 +1453,7 @@ void TestXdgShellClientRules::testDesktopsForce() destroyTestWindow(); } -void TestXdgShellClientRules::testDesktopsApplyNow() +void TestXdgShellWindowRules::testDesktopsApplyNow() { // We need at least two virtual desktop for this test. VirtualDesktopManager::self()->setCount(2); @@ -1488,7 +1488,7 @@ void TestXdgShellClientRules::testDesktopsApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testDesktopsForceTemporarily() +void TestXdgShellWindowRules::testDesktopsForceTemporarily() { // We need at least two virtual desktop for this test. VirtualDesktopManager::self()->setCount(2); @@ -1533,7 +1533,7 @@ void TestXdgShellClientRules::testDesktopsForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testMinimizeDontAffect() +void TestXdgShellWindowRules::testMinimizeDontAffect() { setWindowRule("minimize", true, int(Rules::DontAffect)); @@ -1546,7 +1546,7 @@ void TestXdgShellClientRules::testMinimizeDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testMinimizeApply() +void TestXdgShellWindowRules::testMinimizeApply() { setWindowRule("minimize", true, int(Rules::Apply)); @@ -1569,7 +1569,7 @@ void TestXdgShellClientRules::testMinimizeApply() destroyTestWindow(); } -void TestXdgShellClientRules::testMinimizeRemember() +void TestXdgShellWindowRules::testMinimizeRemember() { setWindowRule("minimize", false, int(Rules::Remember)); @@ -1590,7 +1590,7 @@ void TestXdgShellClientRules::testMinimizeRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testMinimizeForce() +void TestXdgShellWindowRules::testMinimizeForce() { setWindowRule("minimize", false, int(Rules::Force)); @@ -1613,7 +1613,7 @@ void TestXdgShellClientRules::testMinimizeForce() destroyTestWindow(); } -void TestXdgShellClientRules::testMinimizeApplyNow() +void TestXdgShellWindowRules::testMinimizeApplyNow() { createTestWindow(); QVERIFY(m_client->isMinimizable()); @@ -1637,7 +1637,7 @@ void TestXdgShellClientRules::testMinimizeApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testMinimizeForceTemporarily() +void TestXdgShellWindowRules::testMinimizeForceTemporarily() { setWindowRule("minimize", false, int(Rules::ForceTemporarily)); @@ -1660,7 +1660,7 @@ void TestXdgShellClientRules::testMinimizeForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipTaskbarDontAffect() +void TestXdgShellWindowRules::testSkipTaskbarDontAffect() { setWindowRule("skiptaskbar", true, int(Rules::DontAffect)); @@ -1672,7 +1672,7 @@ void TestXdgShellClientRules::testSkipTaskbarDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipTaskbarApply() +void TestXdgShellWindowRules::testSkipTaskbarApply() { setWindowRule("skiptaskbar", true, int(Rules::Apply)); @@ -1693,7 +1693,7 @@ void TestXdgShellClientRules::testSkipTaskbarApply() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipTaskbarRemember() +void TestXdgShellWindowRules::testSkipTaskbarRemember() { setWindowRule("skiptaskbar", true, int(Rules::Remember)); @@ -1716,7 +1716,7 @@ void TestXdgShellClientRules::testSkipTaskbarRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipTaskbarForce() +void TestXdgShellWindowRules::testSkipTaskbarForce() { setWindowRule("skiptaskbar", true, int(Rules::Force)); @@ -1739,7 +1739,7 @@ void TestXdgShellClientRules::testSkipTaskbarForce() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipTaskbarApplyNow() +void TestXdgShellWindowRules::testSkipTaskbarApplyNow() { createTestWindow(); QVERIFY(!m_client->skipTaskbar()); @@ -1760,7 +1760,7 @@ void TestXdgShellClientRules::testSkipTaskbarApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipTaskbarForceTemporarily() +void TestXdgShellWindowRules::testSkipTaskbarForceTemporarily() { setWindowRule("skiptaskbar", true, int(Rules::ForceTemporarily)); @@ -1785,7 +1785,7 @@ void TestXdgShellClientRules::testSkipTaskbarForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipPagerDontAffect() +void TestXdgShellWindowRules::testSkipPagerDontAffect() { setWindowRule("skippager", true, int(Rules::DontAffect)); @@ -1797,7 +1797,7 @@ void TestXdgShellClientRules::testSkipPagerDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipPagerApply() +void TestXdgShellWindowRules::testSkipPagerApply() { setWindowRule("skippager", true, int(Rules::Apply)); @@ -1818,7 +1818,7 @@ void TestXdgShellClientRules::testSkipPagerApply() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipPagerRemember() +void TestXdgShellWindowRules::testSkipPagerRemember() { setWindowRule("skippager", true, int(Rules::Remember)); @@ -1841,7 +1841,7 @@ void TestXdgShellClientRules::testSkipPagerRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipPagerForce() +void TestXdgShellWindowRules::testSkipPagerForce() { setWindowRule("skippager", true, int(Rules::Force)); @@ -1864,7 +1864,7 @@ void TestXdgShellClientRules::testSkipPagerForce() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipPagerApplyNow() +void TestXdgShellWindowRules::testSkipPagerApplyNow() { createTestWindow(); QVERIFY(!m_client->skipPager()); @@ -1885,7 +1885,7 @@ void TestXdgShellClientRules::testSkipPagerApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipPagerForceTemporarily() +void TestXdgShellWindowRules::testSkipPagerForceTemporarily() { setWindowRule("skippager", true, int(Rules::ForceTemporarily)); @@ -1910,7 +1910,7 @@ void TestXdgShellClientRules::testSkipPagerForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipSwitcherDontAffect() +void TestXdgShellWindowRules::testSkipSwitcherDontAffect() { setWindowRule("skipswitcher", true, int(Rules::DontAffect)); @@ -1922,7 +1922,7 @@ void TestXdgShellClientRules::testSkipSwitcherDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipSwitcherApply() +void TestXdgShellWindowRules::testSkipSwitcherApply() { setWindowRule("skipswitcher", true, int(Rules::Apply)); @@ -1943,7 +1943,7 @@ void TestXdgShellClientRules::testSkipSwitcherApply() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipSwitcherRemember() +void TestXdgShellWindowRules::testSkipSwitcherRemember() { setWindowRule("skipswitcher", true, int(Rules::Remember)); @@ -1966,7 +1966,7 @@ void TestXdgShellClientRules::testSkipSwitcherRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipSwitcherForce() +void TestXdgShellWindowRules::testSkipSwitcherForce() { setWindowRule("skipswitcher", true, int(Rules::Force)); @@ -1989,7 +1989,7 @@ void TestXdgShellClientRules::testSkipSwitcherForce() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipSwitcherApplyNow() +void TestXdgShellWindowRules::testSkipSwitcherApplyNow() { createTestWindow(); QVERIFY(!m_client->skipSwitcher()); @@ -2010,7 +2010,7 @@ void TestXdgShellClientRules::testSkipSwitcherApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testSkipSwitcherForceTemporarily() +void TestXdgShellWindowRules::testSkipSwitcherForceTemporarily() { setWindowRule("skipswitcher", true, int(Rules::ForceTemporarily)); @@ -2035,7 +2035,7 @@ void TestXdgShellClientRules::testSkipSwitcherForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepAboveDontAffect() +void TestXdgShellWindowRules::testKeepAboveDontAffect() { setWindowRule("above", true, int(Rules::DontAffect)); @@ -2047,7 +2047,7 @@ void TestXdgShellClientRules::testKeepAboveDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepAboveApply() +void TestXdgShellWindowRules::testKeepAboveApply() { setWindowRule("above", true, int(Rules::Apply)); @@ -2068,7 +2068,7 @@ void TestXdgShellClientRules::testKeepAboveApply() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepAboveRemember() +void TestXdgShellWindowRules::testKeepAboveRemember() { setWindowRule("above", true, int(Rules::Remember)); @@ -2089,7 +2089,7 @@ void TestXdgShellClientRules::testKeepAboveRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepAboveForce() +void TestXdgShellWindowRules::testKeepAboveForce() { setWindowRule("above", true, int(Rules::Force)); @@ -2110,7 +2110,7 @@ void TestXdgShellClientRules::testKeepAboveForce() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepAboveApplyNow() +void TestXdgShellWindowRules::testKeepAboveApplyNow() { createTestWindow(); QVERIFY(!m_client->keepAbove()); @@ -2131,7 +2131,7 @@ void TestXdgShellClientRules::testKeepAboveApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepAboveForceTemporarily() +void TestXdgShellWindowRules::testKeepAboveForceTemporarily() { setWindowRule("above", true, int(Rules::ForceTemporarily)); @@ -2158,7 +2158,7 @@ void TestXdgShellClientRules::testKeepAboveForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepBelowDontAffect() +void TestXdgShellWindowRules::testKeepBelowDontAffect() { setWindowRule("below", true, int(Rules::DontAffect)); @@ -2170,7 +2170,7 @@ void TestXdgShellClientRules::testKeepBelowDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepBelowApply() +void TestXdgShellWindowRules::testKeepBelowApply() { setWindowRule("below", true, int(Rules::Apply)); @@ -2191,7 +2191,7 @@ void TestXdgShellClientRules::testKeepBelowApply() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepBelowRemember() +void TestXdgShellWindowRules::testKeepBelowRemember() { setWindowRule("below", true, int(Rules::Remember)); @@ -2212,7 +2212,7 @@ void TestXdgShellClientRules::testKeepBelowRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepBelowForce() +void TestXdgShellWindowRules::testKeepBelowForce() { setWindowRule("below", true, int(Rules::Force)); @@ -2233,7 +2233,7 @@ void TestXdgShellClientRules::testKeepBelowForce() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepBelowApplyNow() +void TestXdgShellWindowRules::testKeepBelowApplyNow() { createTestWindow(); QVERIFY(!m_client->keepBelow()); @@ -2254,7 +2254,7 @@ void TestXdgShellClientRules::testKeepBelowApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testKeepBelowForceTemporarily() +void TestXdgShellWindowRules::testKeepBelowForceTemporarily() { setWindowRule("below", true, int(Rules::ForceTemporarily)); @@ -2281,7 +2281,7 @@ void TestXdgShellClientRules::testKeepBelowForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testShortcutDontAffect() +void TestXdgShellWindowRules::testShortcutDontAffect() { setWindowRule("shortcut", "Ctrl+Alt+1", int(Rules::DontAffect)); @@ -2306,7 +2306,7 @@ void TestXdgShellClientRules::testShortcutDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testShortcutApply() +void TestXdgShellWindowRules::testShortcutApply() { setWindowRule("shortcut", "Ctrl+Alt+1", int(Rules::Apply)); @@ -2364,7 +2364,7 @@ void TestXdgShellClientRules::testShortcutApply() destroyTestWindow(); } -void TestXdgShellClientRules::testShortcutRemember() +void TestXdgShellWindowRules::testShortcutRemember() { QSKIP("KWin core doesn't try to save the last used window shortcut"); @@ -2412,7 +2412,7 @@ void TestXdgShellClientRules::testShortcutRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testShortcutForce() +void TestXdgShellWindowRules::testShortcutForce() { QSKIP("KWin core can't release forced window shortcuts"); @@ -2460,7 +2460,7 @@ void TestXdgShellClientRules::testShortcutForce() destroyTestWindow(); } -void TestXdgShellClientRules::testShortcutApplyNow() +void TestXdgShellWindowRules::testShortcutApplyNow() { createTestWindow(); QVERIFY(m_client->shortcut().isEmpty()); @@ -2504,7 +2504,7 @@ void TestXdgShellClientRules::testShortcutApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testShortcutForceTemporarily() +void TestXdgShellWindowRules::testShortcutForceTemporarily() { QSKIP("KWin core can't release forced window shortcuts"); @@ -2550,7 +2550,7 @@ void TestXdgShellClientRules::testShortcutForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testDesktopFileDontAffect() +void TestXdgShellWindowRules::testDesktopFileDontAffect() { // Currently, the desktop file name is derived from the app id. If the app id is // changed, then the old rules will be lost. Either setDesktopFileName should @@ -2558,7 +2558,7 @@ void TestXdgShellClientRules::testDesktopFileDontAffect() QSKIP("Needs changes in KWin core to pass"); } -void TestXdgShellClientRules::testDesktopFileApply() +void TestXdgShellWindowRules::testDesktopFileApply() { // Currently, the desktop file name is derived from the app id. If the app id is // changed, then the old rules will be lost. Either setDesktopFileName should @@ -2566,7 +2566,7 @@ void TestXdgShellClientRules::testDesktopFileApply() QSKIP("Needs changes in KWin core to pass"); } -void TestXdgShellClientRules::testDesktopFileRemember() +void TestXdgShellWindowRules::testDesktopFileRemember() { // Currently, the desktop file name is derived from the app id. If the app id is // changed, then the old rules will be lost. Either setDesktopFileName should @@ -2574,7 +2574,7 @@ void TestXdgShellClientRules::testDesktopFileRemember() QSKIP("Needs changes in KWin core to pass"); } -void TestXdgShellClientRules::testDesktopFileForce() +void TestXdgShellWindowRules::testDesktopFileForce() { // Currently, the desktop file name is derived from the app id. If the app id is // changed, then the old rules will be lost. Either setDesktopFileName should @@ -2582,7 +2582,7 @@ void TestXdgShellClientRules::testDesktopFileForce() QSKIP("Needs changes in KWin core to pass"); } -void TestXdgShellClientRules::testDesktopFileApplyNow() +void TestXdgShellWindowRules::testDesktopFileApplyNow() { // Currently, the desktop file name is derived from the app id. If the app id is // changed, then the old rules will be lost. Either setDesktopFileName should @@ -2590,7 +2590,7 @@ void TestXdgShellClientRules::testDesktopFileApplyNow() QSKIP("Needs changes in KWin core to pass"); } -void TestXdgShellClientRules::testDesktopFileForceTemporarily() +void TestXdgShellWindowRules::testDesktopFileForceTemporarily() { // Currently, the desktop file name is derived from the app id. If the app id is // changed, then the old rules will be lost. Either setDesktopFileName should @@ -2598,7 +2598,7 @@ void TestXdgShellClientRules::testDesktopFileForceTemporarily() QSKIP("Needs changes in KWin core to pass"); } -void TestXdgShellClientRules::testActiveOpacityDontAffect() +void TestXdgShellWindowRules::testActiveOpacityDontAffect() { setWindowRule("opacityactive", 90, int(Rules::DontAffect)); @@ -2611,7 +2611,7 @@ void TestXdgShellClientRules::testActiveOpacityDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testActiveOpacityForce() +void TestXdgShellWindowRules::testActiveOpacityForce() { setWindowRule("opacityactive", 90, int(Rules::Force)); @@ -2622,7 +2622,7 @@ void TestXdgShellClientRules::testActiveOpacityForce() destroyTestWindow(); } -void TestXdgShellClientRules::testActiveOpacityForceTemporarily() +void TestXdgShellWindowRules::testActiveOpacityForceTemporarily() { setWindowRule("opacityactive", 90, int(Rules::ForceTemporarily)); @@ -2639,7 +2639,7 @@ void TestXdgShellClientRules::testActiveOpacityForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testInactiveOpacityDontAffect() +void TestXdgShellWindowRules::testInactiveOpacityDontAffect() { setWindowRule("opacityinactive", 80, int(Rules::DontAffect)); @@ -2656,7 +2656,7 @@ void TestXdgShellClientRules::testInactiveOpacityDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testInactiveOpacityForce() +void TestXdgShellWindowRules::testInactiveOpacityForce() { setWindowRule("opacityinactive", 80, int(Rules::Force)); @@ -2674,7 +2674,7 @@ void TestXdgShellClientRules::testInactiveOpacityForce() destroyTestWindow(); } -void TestXdgShellClientRules::testInactiveOpacityForceTemporarily() +void TestXdgShellWindowRules::testInactiveOpacityForceTemporarily() { setWindowRule("opacityinactive", 80, int(Rules::ForceTemporarily)); @@ -2702,7 +2702,7 @@ void TestXdgShellClientRules::testInactiveOpacityForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testNoBorderDontAffect() +void TestXdgShellWindowRules::testNoBorderDontAffect() { setWindowRule("noborder", true, int(Rules::DontAffect)); createTestWindow(ServerSideDecoration); @@ -2713,7 +2713,7 @@ void TestXdgShellClientRules::testNoBorderDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testNoBorderApply() +void TestXdgShellWindowRules::testNoBorderApply() { setWindowRule("noborder", true, int(Rules::Apply)); createTestWindow(ServerSideDecoration); @@ -2735,7 +2735,7 @@ void TestXdgShellClientRules::testNoBorderApply() destroyTestWindow(); } -void TestXdgShellClientRules::testNoBorderRemember() +void TestXdgShellWindowRules::testNoBorderRemember() { setWindowRule("noborder", true, int(Rules::Remember)); createTestWindow(ServerSideDecoration); @@ -2758,7 +2758,7 @@ void TestXdgShellClientRules::testNoBorderRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testNoBorderForce() +void TestXdgShellWindowRules::testNoBorderForce() { setWindowRule("noborder", true, int(Rules::Force)); createTestWindow(ServerSideDecoration); @@ -2781,7 +2781,7 @@ void TestXdgShellClientRules::testNoBorderForce() destroyTestWindow(); } -void TestXdgShellClientRules::testNoBorderApplyNow() +void TestXdgShellWindowRules::testNoBorderApplyNow() { createTestWindow(ServerSideDecoration); QVERIFY(!m_client->noBorder()); @@ -2803,7 +2803,7 @@ void TestXdgShellClientRules::testNoBorderApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testNoBorderForceTemporarily() +void TestXdgShellWindowRules::testNoBorderForceTemporarily() { setWindowRule("noborder", true, int(Rules::ForceTemporarily)); createTestWindow(ServerSideDecoration); @@ -2829,7 +2829,7 @@ void TestXdgShellClientRules::testNoBorderForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testScreenDontAffect() +void TestXdgShellWindowRules::testScreenDontAffect() { const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs(); @@ -2847,7 +2847,7 @@ void TestXdgShellClientRules::testScreenDontAffect() destroyTestWindow(); } -void TestXdgShellClientRules::testScreenApply() +void TestXdgShellWindowRules::testScreenApply() { const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs(); @@ -2866,7 +2866,7 @@ void TestXdgShellClientRules::testScreenApply() destroyTestWindow(); } -void TestXdgShellClientRules::testScreenRemember() +void TestXdgShellWindowRules::testScreenRemember() { const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs(); @@ -2891,7 +2891,7 @@ void TestXdgShellClientRules::testScreenRemember() destroyTestWindow(); } -void TestXdgShellClientRules::testScreenForce() +void TestXdgShellWindowRules::testScreenForce() { const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs(); @@ -2933,7 +2933,7 @@ void TestXdgShellClientRules::testScreenForce() destroyTestWindow(); } -void TestXdgShellClientRules::testScreenApplyNow() +void TestXdgShellWindowRules::testScreenApplyNow() { const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs(); @@ -2956,7 +2956,7 @@ void TestXdgShellClientRules::testScreenApplyNow() destroyTestWindow(); } -void TestXdgShellClientRules::testScreenForceTemporarily() +void TestXdgShellWindowRules::testScreenForceTemporarily() { const KWin::Outputs outputs = kwinApp()->platform()->enabledOutputs(); @@ -2981,7 +2981,7 @@ void TestXdgShellClientRules::testScreenForceTemporarily() destroyTestWindow(); } -void TestXdgShellClientRules::testMatchAfterNameChange() +void TestXdgShellWindowRules::testMatchAfterNameChange() { setWindowRule("above", true, int(Rules::Force)); @@ -3001,5 +3001,5 @@ void TestXdgShellClientRules::testMatchAfterNameChange() QCOMPARE(c->keepAbove(), true); } -WAYLANDTEST_MAIN(TestXdgShellClientRules) -#include "xdgshellclient_rules_test.moc" +WAYLANDTEST_MAIN(TestXdgShellWindowRules) +#include "xdgshellwindow_rules_test.moc" diff --git a/autotests/integration/xdgshellclient_test.cpp b/autotests/integration/xdgshellwindow_test.cpp similarity index 96% rename from autotests/integration/xdgshellclient_test.cpp rename to autotests/integration/xdgshellwindow_test.cpp index c6253cf33e..6a6cced6f3 100644 --- a/autotests/integration/xdgshellclient_test.cpp +++ b/autotests/integration/xdgshellwindow_test.cpp @@ -50,9 +50,9 @@ using namespace KWin; using namespace KWayland::Client; -static const QString s_socketName = QStringLiteral("wayland_test_kwin_xdgshellclient-0"); +static const QString s_socketName = QStringLiteral("wayland_test_kwin_xdgshellwindow-0"); -class TestXdgShellClient : public QObject +class TestXdgShellWindow : public QObject { Q_OBJECT private Q_SLOTS: @@ -108,7 +108,7 @@ private Q_SLOTS: void testChangeDecorationModeAfterInitialCommit(); }; -void TestXdgShellClient::testXdgWindowReactive() +void TestXdgShellWindow::testXdgWindowReactive() { QScopedPointer positioner(Test::createXdgPositioner()); positioner->set_size(10, 10); @@ -134,7 +134,7 @@ void TestXdgShellClient::testXdgWindowReactive() QCOMPARE(popupConfigureRequested.count(), 1); } -void TestXdgShellClient::testXdgWindowRepositioning() +void TestXdgShellWindow::testXdgWindowRepositioning() { QScopedPointer positioner(Test::createXdgPositioner()); positioner->set_size(10, 10); @@ -163,7 +163,7 @@ void TestXdgShellClient::testXdgWindowRepositioning() QCOMPARE(reconfigureSpy.count(), 1); } -void TestXdgShellClient::initTestCase() +void TestXdgShellWindow::initTestCase() { qRegisterMetaType(); qRegisterMetaType(); @@ -184,7 +184,7 @@ void TestXdgShellClient::initTestCase() Test::initWaylandWorkspace(); } -void TestXdgShellClient::init() +void TestXdgShellWindow::init() { QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::XdgDecorationV1 | Test::AdditionalWaylandInterface::AppMenu)); QVERIFY(Test::waitForWaylandPointer()); @@ -194,14 +194,14 @@ void TestXdgShellClient::init() KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); } -void TestXdgShellClient::cleanup() +void TestXdgShellWindow::cleanup() { Test::destroyWaylandConnection(); } -void TestXdgShellClient::testMapUnmap() +void TestXdgShellWindow::testMapUnmap() { - // This test verifies that the compositor destroys XdgToplevelClient when the + // This test verifies that the compositor destroys XdgToplevelWindow when the // associated xdg_toplevel surface is unmapped. // Create a wl_surface and an xdg_toplevel, but don't commit them yet! @@ -262,7 +262,7 @@ void TestXdgShellClient::testMapUnmap() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testDesktopPresenceChanged() +void TestXdgShellWindow::testDesktopPresenceChanged() { // this test verifies that the desktop presence changed signals are properly emitted QScopedPointer surface(Test::createSurface()); @@ -295,7 +295,7 @@ void TestXdgShellClient::testDesktopPresenceChanged() QCOMPARE(desktopPresenceChangedEffectsSpy.first().at(2).toInt(), 2); } -void TestXdgShellClient::testWindowOutputs() +void TestXdgShellWindow::testWindowOutputs() { QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data())); @@ -332,7 +332,7 @@ void TestXdgShellClient::testWindowOutputs() QCOMPARE(surface->outputs().first()->globalPosition(), QPoint(1280, 0)); } -void TestXdgShellClient::testMinimizeActiveWindow() +void TestXdgShellWindow::testMinimizeActiveWindow() { // this test verifies that when minimizing the active window it gets deactivated QScopedPointer surface(Test::createSurface()); @@ -363,7 +363,7 @@ void TestXdgShellClient::testMinimizeActiveWindow() QCOMPARE(workspace()->activeClient(), c); } -void TestXdgShellClient::testFullscreen_data() +void TestXdgShellWindow::testFullscreen_data() { QTest::addColumn("decoMode"); @@ -371,7 +371,7 @@ void TestXdgShellClient::testFullscreen_data() QTest::newRow("server-side deco") << Test::XdgToplevelDecorationV1::mode_server_side; } -void TestXdgShellClient::testFullscreen() +void TestXdgShellWindow::testFullscreen() { // this test verifies that a window can be properly fullscreened @@ -452,7 +452,7 @@ void TestXdgShellClient::testFullscreen() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testUserCanSetFullscreen() +void TestXdgShellWindow::testUserCanSetFullscreen() { QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data())); @@ -463,7 +463,7 @@ void TestXdgShellClient::testUserCanSetFullscreen() QVERIFY(c->userCanSetFullScreen()); } -void TestXdgShellClient::testMaximizedToFullscreen_data() +void TestXdgShellWindow::testMaximizedToFullscreen_data() { QTest::addColumn("decoMode"); @@ -471,7 +471,7 @@ void TestXdgShellClient::testMaximizedToFullscreen_data() QTest::newRow("server-side deco") << Test::XdgToplevelDecorationV1::mode_server_side; } -void TestXdgShellClient::testMaximizedToFullscreen() +void TestXdgShellWindow::testMaximizedToFullscreen() { // this test verifies that a window can be properly fullscreened after maximizing @@ -562,7 +562,7 @@ void TestXdgShellClient::testMaximizedToFullscreen() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testFullscreenMultipleOutputs() +void TestXdgShellWindow::testFullscreenMultipleOutputs() { // this test verifies that kwin will place fullscreen windows in the outputs its instructed to @@ -615,7 +615,7 @@ void TestXdgShellClient::testFullscreenMultipleOutputs() } } -void TestXdgShellClient::testHidden() +void TestXdgShellWindow::testHidden() { // this test verifies that when hiding window it doesn't get shown QScopedPointer surface(Test::createSurface()); @@ -643,7 +643,7 @@ void TestXdgShellClient::testHidden() // QCOMPARE(workspace()->activeClient(), c); } -void TestXdgShellClient::testDesktopFileName() +void TestXdgShellWindow::testDesktopFileName() { QIcon::setThemeName(QStringLiteral("breeze")); // this test verifies that desktop file name is passed correctly to the window @@ -655,7 +655,7 @@ void TestXdgShellClient::testDesktopFileName() QVERIFY(c); QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.foo")); QCOMPARE(c->resourceClass(), QByteArrayLiteral("org.kde.foo")); - QVERIFY(c->resourceName().startsWith("testXdgShellClient")); + QVERIFY(c->resourceName().startsWith("testXdgShellWindow")); // the desktop file does not exist, so icon should be generic Wayland QCOMPARE(c->icon().name(), QStringLiteral("wayland")); @@ -667,7 +667,7 @@ void TestXdgShellClient::testDesktopFileName() QVERIFY(desktopFileNameChangedSpy.wait()); QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.bar")); QCOMPARE(c->resourceClass(), QByteArrayLiteral("org.kde.bar")); - QVERIFY(c->resourceName().startsWith("testXdgShellClient")); + QVERIFY(c->resourceName().startsWith("testXdgShellWindow")); // icon should still be wayland QCOMPARE(c->icon().name(), QStringLiteral("wayland")); QVERIFY(iconChangedSpy.isEmpty()); @@ -680,7 +680,7 @@ void TestXdgShellClient::testDesktopFileName() QCOMPARE(c->icon().name(), QStringLiteral("kwin")); } -void TestXdgShellClient::testCaptionSimplified() +void TestXdgShellWindow::testCaptionSimplified() { // this test verifies that caption is properly trimmed // see BUG 323798 comment #12 @@ -695,7 +695,7 @@ void TestXdgShellClient::testCaptionSimplified() QCOMPARE(c->caption(), origTitle.simplified()); } -void TestXdgShellClient::testCaptionMultipleWindows() +void TestXdgShellWindow::testCaptionMultipleWindows() { QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data())); @@ -742,7 +742,7 @@ void TestXdgShellClient::testCaptionMultipleWindows() QCOMPARE(c4->captionSuffix(), QStringLiteral(" <4>")); } -void TestXdgShellClient::testUnresponsiveWindow_data() +void TestXdgShellWindow::testUnresponsiveWindow_data() { QTest::addColumn("shellInterface"); // see env selection in qwaylandintegration.cpp QTest::addColumn("socketMode"); @@ -751,7 +751,7 @@ void TestXdgShellClient::testUnresponsiveWindow_data() QTest::newRow("xdg socket") << "xdg-shell" << true; } -void TestXdgShellClient::testUnresponsiveWindow() +void TestXdgShellWindow::testUnresponsiveWindow() { // this test verifies that killWindow properly terminates a process // for this an external binary is launched @@ -826,7 +826,7 @@ void TestXdgShellClient::testUnresponsiveWindow() QVERIFY(elapsed2 > 1800); // second ping comes in a second later } -void TestXdgShellClient::testAppMenu() +void TestXdgShellWindow::testAppMenu() { // register a faux appmenu client QVERIFY(QDBusConnection::sessionBus().registerService("org.kde.kappmenu")); @@ -846,7 +846,7 @@ void TestXdgShellClient::testAppMenu() QVERIFY(QDBusConnection::sessionBus().unregisterService("org.kde.kappmenu")); } -void TestXdgShellClient::testSendClientWithTransientToDesktop() +void TestXdgShellWindow::testSendClientWithTransientToDesktop() { // this test verifies that when sending a client to a desktop all transients are also send to that desktop @@ -897,7 +897,7 @@ void TestXdgShellClient::testSendClientWithTransientToDesktop() QCOMPARE(transient->desktops(), QVector{desktops[0]}); } -void TestXdgShellClient::testMinimizeWindowWithTransients() +void TestXdgShellWindow::testMinimizeWindowWithTransients() { // this test verifies that when minimizing/unminimizing a window all its // transients will be minimized/unminimized as well @@ -930,7 +930,7 @@ void TestXdgShellClient::testMinimizeWindowWithTransients() QVERIFY(!transient->isMinimized()); } -void TestXdgShellClient::testXdgDecoration_data() +void TestXdgShellWindow::testXdgDecoration_data() { QTest::addColumn("requestedMode"); QTest::addColumn("expectedMode"); @@ -939,7 +939,7 @@ void TestXdgShellClient::testXdgDecoration_data() QTest::newRow("server side requested") << Test::XdgToplevelDecorationV1::mode_server_side << Test::XdgToplevelDecorationV1::mode_server_side; } -void TestXdgShellClient::testXdgDecoration() +void TestXdgShellWindow::testXdgDecoration() { QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data())); @@ -966,14 +966,14 @@ void TestXdgShellClient::testXdgDecoration() QCOMPARE(c->isDecorated(), expectedMode == Test::XdgToplevelDecorationV1::mode_server_side); } -void TestXdgShellClient::testXdgNeverCommitted() +void TestXdgShellWindow::testXdgNeverCommitted() { // check we don't crash if we create a shell object but delete the XdgShellClient before committing it QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly)); } -void TestXdgShellClient::testXdgInitialState() +void TestXdgShellWindow::testXdgInitialState() { QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly)); @@ -994,7 +994,7 @@ void TestXdgShellClient::testXdgInitialState() QCOMPARE(c->size(), QSize(200, 100)); } -void TestXdgShellClient::testXdgInitiallyMaximised() +void TestXdgShellWindow::testXdgInitiallyMaximised() { QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly)); @@ -1021,7 +1021,7 @@ void TestXdgShellClient::testXdgInitiallyMaximised() QCOMPARE(c->size(), QSize(1280, 1024)); } -void TestXdgShellClient::testXdgInitiallyFullscreen() +void TestXdgShellWindow::testXdgInitiallyFullscreen() { QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly)); @@ -1048,7 +1048,7 @@ void TestXdgShellClient::testXdgInitiallyFullscreen() QCOMPARE(c->size(), QSize(1280, 1024)); } -void TestXdgShellClient::testXdgInitiallyMinimized() +void TestXdgShellWindow::testXdgInitiallyMinimized() { QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data(), Test::CreationSetup::CreateOnly)); @@ -1074,7 +1074,7 @@ void TestXdgShellClient::testXdgInitiallyMinimized() QVERIFY(c->isMinimized()); } -void TestXdgShellClient::testXdgWindowGeometryIsntSet() +void TestXdgShellWindow::testXdgWindowGeometryIsntSet() { // This test verifies that the effective window geometry corresponds to the // bounding rectangle of the main surface and its sub-surfaces if no window @@ -1111,7 +1111,7 @@ void TestXdgShellClient::testXdgWindowGeometryIsntSet() QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); } -void TestXdgShellClient::testXdgWindowGeometryAttachBuffer() +void TestXdgShellWindow::testXdgWindowGeometryAttachBuffer() { // This test verifies that the effective window geometry remains the same when // a new buffer is attached and xdg_surface.set_window_geometry is not called @@ -1159,7 +1159,7 @@ void TestXdgShellClient::testXdgWindowGeometryAttachBuffer() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testXdgWindowGeometryAttachSubSurface() +void TestXdgShellWindow::testXdgWindowGeometryAttachSubSurface() { // This test verifies that the effective window geometry remains the same // when a new sub-surface is added and xdg_surface.set_window_geometry is @@ -1204,7 +1204,7 @@ void TestXdgShellClient::testXdgWindowGeometryAttachSubSurface() QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); } -void TestXdgShellClient::testXdgWindowGeometryInteractiveResize() +void TestXdgShellWindow::testXdgWindowGeometryInteractiveResize() { // This test verifies that correct window geometry is provided along each // configure event when an xdg-shell is being interactively resized. @@ -1297,7 +1297,7 @@ void TestXdgShellClient::testXdgWindowGeometryInteractiveResize() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testXdgWindowGeometryFullScreen() +void TestXdgShellWindow::testXdgWindowGeometryFullScreen() { // This test verifies that an xdg-shell receives correct window geometry when // its fullscreen state gets changed. @@ -1354,7 +1354,7 @@ void TestXdgShellClient::testXdgWindowGeometryFullScreen() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testXdgWindowGeometryMaximize() +void TestXdgShellWindow::testXdgWindowGeometryMaximize() { // This test verifies that an xdg-shell receives correct window geometry when // its maximized state gets changed. @@ -1411,9 +1411,9 @@ void TestXdgShellClient::testXdgWindowGeometryMaximize() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testPointerInputTransform() +void TestXdgShellWindow::testPointerInputTransform() { - // This test verifies that XdgToplevelClient provides correct input transform matrix. + // This test verifies that XdgToplevelWindow provides correct input transform matrix. // The input transform matrix is used by seat to map pointer events from the global // screen coordinates to the surface-local coordinates. @@ -1470,7 +1470,7 @@ void TestXdgShellClient::testPointerInputTransform() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testReentrantSetFrameGeometry() +void TestXdgShellWindow::testReentrantSetFrameGeometry() { // This test verifies that calling moveResize() from a slot connected directly // to the frameGeometryChanged() signal won't cause an infinite recursion. @@ -1498,7 +1498,7 @@ void TestXdgShellClient::testReentrantSetFrameGeometry() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testDoubleMaximize() +void TestXdgShellWindow::testDoubleMaximize() { // This test verifies that the case where a client issues two set_maximized() requests // separated by the initial commit is handled properly. @@ -1533,7 +1533,7 @@ void TestXdgShellClient::testDoubleMaximize() QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized)); } -void TestXdgShellClient::testDoubleFullscreenSeparatedByCommit() +void TestXdgShellWindow::testDoubleFullscreenSeparatedByCommit() { // Some applications do weird things at startup and this is one of them. This test verifies // that the window will have good frame geometry if the client has issued several @@ -1566,7 +1566,7 @@ void TestXdgShellClient::testDoubleFullscreenSeparatedByCommit() QCOMPARE(client->frameGeometry(), QRect(0, 0, 1280, 1024)); } -void TestXdgShellClient::testMaximizeHorizontal() +void TestXdgShellWindow::testMaximizeHorizontal() { // Create the test client. QScopedPointer surface(Test::createSurface()); @@ -1646,7 +1646,7 @@ void TestXdgShellClient::testMaximizeHorizontal() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testMaximizeVertical() +void TestXdgShellWindow::testMaximizeVertical() { // Create the test client. QScopedPointer surface(Test::createSurface()); @@ -1726,7 +1726,7 @@ void TestXdgShellClient::testMaximizeVertical() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testMaximizeFull() +void TestXdgShellWindow::testMaximizeFull() { // Create the test client. QScopedPointer surface(Test::createSurface()); @@ -1806,7 +1806,7 @@ void TestXdgShellClient::testMaximizeFull() QVERIFY(Test::waitForWindowDestroyed(client)); } -void TestXdgShellClient::testMaximizeAndChangeDecorationModeAfterInitialCommit() +void TestXdgShellWindow::testMaximizeAndChangeDecorationModeAfterInitialCommit() { // Ideally, the app would initialize the xdg-toplevel surface before the initial commit, but // many don't do it. They initialize the surface after the first commit. @@ -1834,7 +1834,7 @@ void TestXdgShellClient::testMaximizeAndChangeDecorationModeAfterInitialCommit() QCOMPARE(toplevelConfigureRequestedSpy.last().at(1).value(), Test::XdgToplevel::State::Maximized); } -void TestXdgShellClient::testFullScreenAndChangeDecorationModeAfterInitialCommit() +void TestXdgShellWindow::testFullScreenAndChangeDecorationModeAfterInitialCommit() { // Ideally, the app would initialize the xdg-toplevel surface before the initial commit, but // many don't do it. They initialize the surface after the first commit. @@ -1862,7 +1862,7 @@ void TestXdgShellClient::testFullScreenAndChangeDecorationModeAfterInitialCommit QCOMPARE(toplevelConfigureRequestedSpy.last().at(1).value(), Test::XdgToplevel::State::Fullscreen); } -void TestXdgShellClient::testChangeDecorationModeAfterInitialCommit() +void TestXdgShellWindow::testChangeDecorationModeAfterInitialCommit() { // This test verifies that the compositor will respond with a good configure event when // the decoration mode changes after the first surface commit but before the surface is mapped. @@ -1889,5 +1889,5 @@ void TestXdgShellClient::testChangeDecorationModeAfterInitialCommit() QCOMPARE(decorationConfigureRequestedSpy.last().at(0).value(), Test::XdgToplevelDecorationV1::mode_client_side); } -WAYLANDTEST_MAIN(TestXdgShellClient) -#include "xdgshellclient_test.moc" +WAYLANDTEST_MAIN(TestXdgShellWindow) +#include "xdgshellwindow_test.moc" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3ea7e3c96a..dfe4653a9f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -155,8 +155,8 @@ target_sources(kwin PRIVATE x11window.cpp xcursortheme.cpp xdgactivationv1.cpp - xdgshellclient.cpp xdgshellintegration.cpp + xdgshellwindow.cpp xkb.cpp xwaylandclient.cpp xwayland/xwayland_interface.cpp diff --git a/src/wayland/xdgshell_interface.cpp b/src/wayland/xdgshell_interface.cpp index 048d44cb75..876214a66f 100644 --- a/src/wayland/xdgshell_interface.cpp +++ b/src/wayland/xdgshell_interface.cpp @@ -45,7 +45,7 @@ void XdgShellInterfacePrivate::unregisterXdgSurface(XdgSurfaceInterface *surface /** * @todo Whether the ping is delayed or has timed out is out of domain of the XdgShellInterface. - * Such matter must be handled somewhere else, e.g. XdgToplevelClient, not here! + * Such matter must be handled somewhere else, e.g. XdgToplevelWindow, not here! */ void XdgShellInterfacePrivate::registerPing(quint32 serial) { diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp index 0fb4925821..e1e7dbb1ab 100644 --- a/src/wayland_server.cpp +++ b/src/wayland_server.cpp @@ -66,8 +66,8 @@ #include "workspace.h" #include "x11window.h" #include "xdgactivationv1.h" -#include "xdgshellclient.h" #include "xdgshellintegration.h" +#include "xdgshellwindow.h" // Qt #include @@ -229,7 +229,7 @@ void WaylandServer::registerShellClient(Window *client) m_clients << client; } -void WaylandServer::registerXdgToplevelClient(XdgToplevelClient *client) +void WaylandServer::registerXdgToplevelWindow(XdgToplevelWindow *client) { // TODO: Find a better way and more generic to install extensions. @@ -260,12 +260,12 @@ void WaylandServer::registerXdgToplevelClient(XdgToplevelClient *client) void WaylandServer::registerXdgGenericClient(Window *client) { - XdgToplevelClient *toplevelClient = qobject_cast(client); + XdgToplevelWindow *toplevelClient = qobject_cast(client); if (toplevelClient) { - registerXdgToplevelClient(toplevelClient); + registerXdgToplevelWindow(toplevelClient); return; } - XdgPopupClient *popupClient = qobject_cast(client); + XdgPopupWindow *popupClient = qobject_cast(client); if (popupClient) { registerShellClient(popupClient); if (auto shellSurface = PlasmaShellSurfaceInterface::get(client->surface())) { @@ -405,7 +405,7 @@ bool WaylandServer::init(InitializationFlags flags) m_xdgDecorationManagerV1 = new XdgDecorationManagerV1Interface(m_display, m_display); connect(m_xdgDecorationManagerV1, &XdgDecorationManagerV1Interface::decorationCreated, this, [this](XdgToplevelDecorationV1Interface *decoration) { - if (XdgToplevelClient *toplevel = findXdgToplevelClient(decoration->toplevel()->surface())) { + if (XdgToplevelWindow *toplevel = findXdgToplevelWindow(decoration->toplevel()->surface())) { toplevel->installXdgDecoration(decoration); } }); @@ -425,19 +425,19 @@ bool WaylandServer::init(InitializationFlags flags) new IdleInhibitManagerV1Interface(m_display, m_display); m_plasmaShell = new PlasmaShellInterface(m_display, m_display); connect(m_plasmaShell, &PlasmaShellInterface::surfaceCreated, this, [this](PlasmaShellSurfaceInterface *surface) { - if (XdgSurfaceClient *client = findXdgSurfaceClient(surface->surface())) { + if (XdgSurfaceWindow *client = findXdgSurfaceWindow(surface->surface())) { client->installPlasmaShellSurface(surface); } }); m_appMenuManager = new AppMenuManagerInterface(m_display, m_display); connect(m_appMenuManager, &AppMenuManagerInterface::appMenuCreated, this, [this](AppMenuInterface *appMenu) { - if (XdgToplevelClient *client = findXdgToplevelClient(appMenu->surface())) { + if (XdgToplevelWindow *client = findXdgToplevelWindow(appMenu->surface())) { client->installAppMenu(appMenu); } }); m_paletteManager = new ServerSideDecorationPaletteManagerInterface(m_display, m_display); connect(m_paletteManager, &ServerSideDecorationPaletteManagerInterface::paletteCreated, this, [this](ServerSideDecorationPaletteInterface *palette) { - if (XdgToplevelClient *client = findXdgToplevelClient(palette->surface())) { + if (XdgToplevelWindow *client = findXdgToplevelWindow(palette->surface())) { client->installPalette(palette); } }); @@ -476,7 +476,7 @@ bool WaylandServer::init(InitializationFlags flags) m_decorationManager = new ServerSideDecorationManagerInterface(m_display, m_display); connect(m_decorationManager, &ServerSideDecorationManagerInterface::decorationCreated, this, [this](ServerSideDecorationInterface *decoration) { - if (XdgToplevelClient *client = findXdgToplevelClient(decoration->surface())) { + if (XdgToplevelWindow *client = findXdgToplevelWindow(decoration->surface())) { client->installServerDecoration(decoration); } }); @@ -708,14 +708,14 @@ Window *WaylandServer::findClient(const KWaylandServer::SurfaceInterface *surfac return nullptr; } -XdgToplevelClient *WaylandServer::findXdgToplevelClient(SurfaceInterface *surface) const +XdgToplevelWindow *WaylandServer::findXdgToplevelWindow(SurfaceInterface *surface) const { - return qobject_cast(findClient(surface)); + return qobject_cast(findClient(surface)); } -XdgSurfaceClient *WaylandServer::findXdgSurfaceClient(SurfaceInterface *surface) const +XdgSurfaceWindow *WaylandServer::findXdgSurfaceWindow(SurfaceInterface *surface) const { - return qobject_cast(findClient(surface)); + return qobject_cast(findClient(surface)); } bool WaylandServer::isScreenLocked() const diff --git a/src/wayland_server.h b/src/wayland_server.h index 8e4668262a..33bb4932e4 100644 --- a/src/wayland_server.h +++ b/src/wayland_server.h @@ -55,9 +55,9 @@ namespace KWin class Window; class Output; -class XdgPopupClient; -class XdgSurfaceClient; -class XdgToplevelClient; +class XdgPopupWindow; +class XdgSurfaceWindow; +class XdgToplevelWindow; class WaylandOutput; class WaylandOutputDevice; @@ -144,8 +144,8 @@ public: } void removeClient(Window *c); Window *findClient(const KWaylandServer::SurfaceInterface *surface) const; - XdgToplevelClient *findXdgToplevelClient(KWaylandServer::SurfaceInterface *surface) const; - XdgSurfaceClient *findXdgSurfaceClient(KWaylandServer::SurfaceInterface *surface) const; + XdgToplevelWindow *findXdgToplevelWindow(KWaylandServer::SurfaceInterface *surface) const; + XdgSurfaceWindow *findXdgSurfaceWindow(KWaylandServer::SurfaceInterface *surface) const; /** * @returns a transient parent of a surface imported with the foreign protocol, if any @@ -244,8 +244,8 @@ private: void shellClientShown(Window *t); void initScreenLocker(); void registerXdgGenericClient(Window *client); - void registerXdgToplevelClient(XdgToplevelClient *client); - void registerXdgPopupClient(XdgPopupClient *client); + void registerXdgToplevelWindow(XdgToplevelWindow *client); + void registerXdgPopupWindow(XdgPopupWindow *client); void registerShellClient(Window *client); void handleOutputAdded(Output *output); void handleOutputRemoved(Output *output); diff --git a/src/xdgshellintegration.cpp b/src/xdgshellintegration.cpp index ae33741259..197748402e 100644 --- a/src/xdgshellintegration.cpp +++ b/src/xdgshellintegration.cpp @@ -9,7 +9,7 @@ #include "wayland/xdgshell_interface.h" #include "wayland_server.h" #include "workspace.h" -#include "xdgshellclient.h" +#include "xdgshellwindow.h" using namespace KWaylandServer; @@ -20,11 +20,11 @@ namespace KWin * The WaylandXdgShellIntegration class is a factory class for xdg-shell clients. * * The xdg-shell protocol defines two surface roles - xdg_toplevel and xdg_popup. On the - * compositor side, those roles are represented by XdgToplevelClient and XdgPopupClient, + * compositor side, those roles are represented by XdgToplevelWindow and XdgPopupWindow, * respectively. * * WaylandXdgShellIntegration monitors for new xdg_toplevel and xdg_popup objects. If it - * detects one, it will create an XdgToplevelClient or XdgPopupClient based on the current + * detects one, it will create an XdgToplevelWindow or XdgPopupWindow based on the current * surface role of the underlying xdg_surface object. */ @@ -42,18 +42,18 @@ XdgShellIntegration::XdgShellIntegration(QObject *parent) void XdgShellIntegration::registerXdgToplevel(XdgToplevelInterface *toplevel) { // Note that the client is going to be destroyed and immediately re-created when the - // underlying surface is unmapped. XdgToplevelClient is re-created right away since + // underlying surface is unmapped. XdgToplevelWindow is re-created right away since // we don't want too loose any client requests that are allowed to be sent prior to // the first initial commit, e.g. set_maximized or set_fullscreen. connect(toplevel, &XdgToplevelInterface::resetOccurred, this, [this, toplevel] { - createXdgToplevelClient(toplevel); + createXdgToplevelWindow(toplevel); }); - createXdgToplevelClient(toplevel); + createXdgToplevelWindow(toplevel); } -void XdgShellIntegration::createXdgToplevelClient(XdgToplevelInterface *toplevel) +void XdgShellIntegration::createXdgToplevelWindow(XdgToplevelInterface *toplevel) { if (!workspace()) { qCWarning(KWIN_CORE, "An xdg-toplevel surface has been created while the compositor " @@ -61,7 +61,7 @@ void XdgShellIntegration::createXdgToplevelClient(XdgToplevelInterface *toplevel return; } - Q_EMIT clientCreated(new XdgToplevelClient(toplevel)); + Q_EMIT clientCreated(new XdgToplevelWindow(toplevel)); } void XdgShellIntegration::registerXdgPopup(XdgPopupInterface *popup) @@ -72,7 +72,7 @@ void XdgShellIntegration::registerXdgPopup(XdgPopupInterface *popup) return; } - Q_EMIT clientCreated(new XdgPopupClient(popup)); + Q_EMIT clientCreated(new XdgPopupWindow(popup)); } } // namespace KWin diff --git a/src/xdgshellintegration.h b/src/xdgshellintegration.h index 4f7b309dfb..b96e5a8e4a 100644 --- a/src/xdgshellintegration.h +++ b/src/xdgshellintegration.h @@ -27,7 +27,7 @@ public: private: void registerXdgToplevel(KWaylandServer::XdgToplevelInterface *toplevel); void registerXdgPopup(KWaylandServer::XdgPopupInterface *popup); - void createXdgToplevelClient(KWaylandServer::XdgToplevelInterface *surface); + void createXdgToplevelWindow(KWaylandServer::XdgToplevelInterface *surface); }; } // namespace KWin diff --git a/src/xdgshellclient.cpp b/src/xdgshellwindow.cpp similarity index 85% rename from src/xdgshellclient.cpp rename to src/xdgshellwindow.cpp index 65b6faf357..fc02bee420 100644 --- a/src/xdgshellclient.cpp +++ b/src/xdgshellwindow.cpp @@ -8,7 +8,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ -#include "xdgshellclient.h" +#include "xdgshellwindow.h" #include "output.h" #if KWIN_BUILD_ACTIVITIES #include "activities.h" @@ -39,26 +39,26 @@ using namespace KWaylandServer; namespace KWin { -XdgSurfaceClient::XdgSurfaceClient(XdgSurfaceInterface *shellSurface) +XdgSurfaceWindow::XdgSurfaceWindow(XdgSurfaceInterface *shellSurface) : WaylandWindow(shellSurface->surface()) , m_shellSurface(shellSurface) , m_configureTimer(new QTimer(this)) { setupPlasmaShellIntegration(); connect(shellSurface, &XdgSurfaceInterface::configureAcknowledged, - this, &XdgSurfaceClient::handleConfigureAcknowledged); + this, &XdgSurfaceWindow::handleConfigureAcknowledged); connect(shellSurface, &XdgSurfaceInterface::resetOccurred, - this, &XdgSurfaceClient::destroyClient); + this, &XdgSurfaceWindow::destroyClient); connect(shellSurface->surface(), &SurfaceInterface::committed, - this, &XdgSurfaceClient::handleCommit); + this, &XdgSurfaceWindow::handleCommit); #if 0 // TODO: Refactor kwin core in order to uncomment this code. connect(shellSurface->surface(), &SurfaceInterface::mapped, - this, &XdgSurfaceClient::setReadyForPainting); + this, &XdgSurfaceWindow::setReadyForPainting); #endif connect(shellSurface, &XdgSurfaceInterface::aboutToBeDestroyed, - this, &XdgSurfaceClient::destroyClient); + this, &XdgSurfaceWindow::destroyClient); connect(shellSurface->surface(), &SurfaceInterface::aboutToBeDestroyed, - this, &XdgSurfaceClient::destroyClient); + this, &XdgSurfaceWindow::destroyClient); // The effective window geometry is determined by two things: (a) the rectangle that bounds // the main surface and all of its sub-surfaces, (b) the client-specified window geometry, if @@ -71,63 +71,63 @@ XdgSurfaceClient::XdgSurfaceClient(XdgSurfaceInterface *shellSurface) SubSurfaceMonitor *treeMonitor = new SubSurfaceMonitor(surface(), this); connect(treeMonitor, &SubSurfaceMonitor::subSurfaceAdded, - this, &XdgSurfaceClient::setHaveNextWindowGeometry); + this, &XdgSurfaceWindow::setHaveNextWindowGeometry); connect(treeMonitor, &SubSurfaceMonitor::subSurfaceRemoved, - this, &XdgSurfaceClient::setHaveNextWindowGeometry); + this, &XdgSurfaceWindow::setHaveNextWindowGeometry); connect(treeMonitor, &SubSurfaceMonitor::subSurfaceMoved, - this, &XdgSurfaceClient::setHaveNextWindowGeometry); + this, &XdgSurfaceWindow::setHaveNextWindowGeometry); connect(treeMonitor, &SubSurfaceMonitor::subSurfaceResized, - this, &XdgSurfaceClient::setHaveNextWindowGeometry); + this, &XdgSurfaceWindow::setHaveNextWindowGeometry); connect(shellSurface, &XdgSurfaceInterface::windowGeometryChanged, - this, &XdgSurfaceClient::setHaveNextWindowGeometry); + this, &XdgSurfaceWindow::setHaveNextWindowGeometry); connect(surface(), &SurfaceInterface::sizeChanged, - this, &XdgSurfaceClient::setHaveNextWindowGeometry); + this, &XdgSurfaceWindow::setHaveNextWindowGeometry); // Configure events are not sent immediately, but rather scheduled to be sent when the event // loop is about to be idle. By doing this, we can avoid sending configure events that do // nothing, and implementation-wise, it's simpler. m_configureTimer->setSingleShot(true); - connect(m_configureTimer, &QTimer::timeout, this, &XdgSurfaceClient::sendConfigure); + connect(m_configureTimer, &QTimer::timeout, this, &XdgSurfaceWindow::sendConfigure); } -XdgSurfaceClient::~XdgSurfaceClient() +XdgSurfaceWindow::~XdgSurfaceWindow() { qDeleteAll(m_configureEvents); } -NET::WindowType XdgSurfaceClient::windowType(bool direct, int supported_types) const +NET::WindowType XdgSurfaceWindow::windowType(bool direct, int supported_types) const { Q_UNUSED(direct) Q_UNUSED(supported_types) return m_windowType; } -QRect XdgSurfaceClient::inputGeometry() const +QRect XdgSurfaceWindow::inputGeometry() const { return isDecorated() ? Window::inputGeometry() : bufferGeometry(); } -QMatrix4x4 XdgSurfaceClient::inputTransformation() const +QMatrix4x4 XdgSurfaceWindow::inputTransformation() const { QMatrix4x4 transformation; transformation.translate(-bufferGeometry().x(), -bufferGeometry().y()); return transformation; } -XdgSurfaceConfigure *XdgSurfaceClient::lastAcknowledgedConfigure() const +XdgSurfaceConfigure *XdgSurfaceWindow::lastAcknowledgedConfigure() const { return m_lastAcknowledgedConfigure.data(); } -void XdgSurfaceClient::scheduleConfigure() +void XdgSurfaceWindow::scheduleConfigure() { if (!isZombie()) { m_configureTimer->start(); } } -void XdgSurfaceClient::sendConfigure() +void XdgSurfaceWindow::sendConfigure() { XdgSurfaceConfigure *configureEvent = sendRoleConfigure(); @@ -144,12 +144,12 @@ void XdgSurfaceClient::sendConfigure() m_configureEvents.append(configureEvent); } -void XdgSurfaceClient::handleConfigureAcknowledged(quint32 serial) +void XdgSurfaceWindow::handleConfigureAcknowledged(quint32 serial) { m_lastAcknowledgedConfigureSerial = serial; } -void XdgSurfaceClient::handleCommit() +void XdgSurfaceWindow::handleCommit() { if (!surface()->buffer()) { return; @@ -179,15 +179,15 @@ void XdgSurfaceClient::handleCommit() updateDepth(); } -void XdgSurfaceClient::handleRolePrecommit() +void XdgSurfaceWindow::handleRolePrecommit() { } -void XdgSurfaceClient::handleRoleCommit() +void XdgSurfaceWindow::handleRoleCommit() { } -void XdgSurfaceClient::maybeUpdateMoveResizeGeometry(const QRect &rect) +void XdgSurfaceWindow::maybeUpdateMoveResizeGeometry(const QRect &rect) { // We are about to send a configure event, ignore the committed window geometry. if (m_configureTimer->isActive()) { @@ -237,7 +237,7 @@ static QRect gravitateGeometry(const QRect &rect, const QRect &bounds, Gravity g return geometry; } -void XdgSurfaceClient::handleNextWindowGeometry() +void XdgSurfaceWindow::handleNextWindowGeometry() { const QRect boundingGeometry = surface()->boundingRect(); @@ -274,22 +274,22 @@ void XdgSurfaceClient::handleNextWindowGeometry() updateGeometry(frameGeometry); } -bool XdgSurfaceClient::haveNextWindowGeometry() const +bool XdgSurfaceWindow::haveNextWindowGeometry() const { return m_haveNextWindowGeometry || m_lastAcknowledgedConfigure; } -void XdgSurfaceClient::setHaveNextWindowGeometry() +void XdgSurfaceWindow::setHaveNextWindowGeometry() { m_haveNextWindowGeometry = true; } -void XdgSurfaceClient::resetHaveNextWindowGeometry() +void XdgSurfaceWindow::resetHaveNextWindowGeometry() { m_haveNextWindowGeometry = false; } -void XdgSurfaceClient::moveResizeInternal(const QRect &rect, MoveResizeMode mode) +void XdgSurfaceWindow::moveResizeInternal(const QRect &rect, MoveResizeMode mode) { if (areGeometryUpdatesBlocked()) { setPendingMoveResizeMode(mode); @@ -314,14 +314,14 @@ void XdgSurfaceClient::moveResizeInternal(const QRect &rect, MoveResizeMode mode } } -QRect XdgSurfaceClient::frameRectToBufferRect(const QRect &rect) const +QRect XdgSurfaceWindow::frameRectToBufferRect(const QRect &rect) const { const int left = rect.left() + borderLeft() - m_windowGeometry.left(); const int top = rect.top() + borderTop() - m_windowGeometry.top(); return QRect(QPoint(left, top), surface()->size()); } -void XdgSurfaceClient::destroyClient() +void XdgSurfaceWindow::destroyClient() { markAsZombie(); if (isInteractiveMoveResize()) { @@ -341,14 +341,14 @@ void XdgSurfaceClient::destroyClient() delete this; } -void XdgSurfaceClient::updateClientArea() +void XdgSurfaceWindow::updateClientArea() { if (hasStrut()) { workspace()->updateClientArea(); } } -void XdgSurfaceClient::updateShowOnScreenEdge() +void XdgSurfaceWindow::updateShowOnScreenEdge() { if (!ScreenEdges::self()) { return; @@ -431,7 +431,7 @@ void XdgSurfaceClient::updateShowOnScreenEdge() * proprietary protocol that doesn't piggyback on existing shell surface protocols. It'll lead * to cleaner code and will be technically correct, but I'm not sure whether this is do-able. */ -void XdgSurfaceClient::installPlasmaShellSurface(PlasmaShellSurfaceInterface *shellSurface) +void XdgSurfaceWindow::installPlasmaShellSurface(PlasmaShellSurfaceInterface *shellSurface) { m_plasmaShellSurface = shellSurface; @@ -513,10 +513,10 @@ void XdgSurfaceClient::installPlasmaShellSurface(PlasmaShellSurfaceInterface *sh } updateRole(); updateShowOnScreenEdge(); - connect(this, &XdgSurfaceClient::frameGeometryChanged, - this, &XdgSurfaceClient::updateShowOnScreenEdge); - connect(this, &XdgSurfaceClient::windowShown, - this, &XdgSurfaceClient::updateShowOnScreenEdge); + connect(this, &XdgSurfaceWindow::frameGeometryChanged, + this, &XdgSurfaceWindow::updateShowOnScreenEdge); + connect(this, &XdgSurfaceWindow::windowShown, + this, &XdgSurfaceWindow::updateShowOnScreenEdge); setSkipTaskbar(shellSurface->skipTaskbar()); connect(shellSurface, &PlasmaShellSurfaceInterface::skipTaskbarChanged, this, [this] { @@ -529,16 +529,16 @@ void XdgSurfaceClient::installPlasmaShellSurface(PlasmaShellSurfaceInterface *sh }); } -void XdgSurfaceClient::setupPlasmaShellIntegration() +void XdgSurfaceWindow::setupPlasmaShellIntegration() { connect(surface(), &SurfaceInterface::mapped, - this, &XdgSurfaceClient::updateShowOnScreenEdge); - connect(this, &XdgSurfaceClient::frameGeometryChanged, - this, &XdgSurfaceClient::updateClientArea); + this, &XdgSurfaceWindow::updateShowOnScreenEdge); + connect(this, &XdgSurfaceWindow::frameGeometryChanged, + this, &XdgSurfaceWindow::updateClientArea); } -XdgToplevelClient::XdgToplevelClient(XdgToplevelInterface *shellSurface) - : XdgSurfaceClient(shellSurface->xdgSurface()) +XdgToplevelWindow::XdgToplevelWindow(XdgToplevelInterface *shellSurface) + : XdgSurfaceWindow(shellSurface->xdgSurface()) , m_shellSurface(shellSurface) { setDesktops({VirtualDesktopManager::self()->currentDesktop()}); @@ -550,86 +550,86 @@ XdgToplevelClient::XdgToplevelClient(XdgToplevelInterface *shellSurface) move(workspace()->activeOutput()->geometry().center()); connect(shellSurface, &XdgToplevelInterface::windowTitleChanged, - this, &XdgToplevelClient::handleWindowTitleChanged); + this, &XdgToplevelWindow::handleWindowTitleChanged); connect(shellSurface, &XdgToplevelInterface::windowClassChanged, - this, &XdgToplevelClient::handleWindowClassChanged); + this, &XdgToplevelWindow::handleWindowClassChanged); connect(shellSurface, &XdgToplevelInterface::windowMenuRequested, - this, &XdgToplevelClient::handleWindowMenuRequested); + this, &XdgToplevelWindow::handleWindowMenuRequested); connect(shellSurface, &XdgToplevelInterface::moveRequested, - this, &XdgToplevelClient::handleMoveRequested); + this, &XdgToplevelWindow::handleMoveRequested); connect(shellSurface, &XdgToplevelInterface::resizeRequested, - this, &XdgToplevelClient::handleResizeRequested); + this, &XdgToplevelWindow::handleResizeRequested); connect(shellSurface, &XdgToplevelInterface::maximizeRequested, - this, &XdgToplevelClient::handleMaximizeRequested); + this, &XdgToplevelWindow::handleMaximizeRequested); connect(shellSurface, &XdgToplevelInterface::unmaximizeRequested, - this, &XdgToplevelClient::handleUnmaximizeRequested); + this, &XdgToplevelWindow::handleUnmaximizeRequested); connect(shellSurface, &XdgToplevelInterface::fullscreenRequested, - this, &XdgToplevelClient::handleFullscreenRequested); + this, &XdgToplevelWindow::handleFullscreenRequested); connect(shellSurface, &XdgToplevelInterface::unfullscreenRequested, - this, &XdgToplevelClient::handleUnfullscreenRequested); + this, &XdgToplevelWindow::handleUnfullscreenRequested); connect(shellSurface, &XdgToplevelInterface::minimizeRequested, - this, &XdgToplevelClient::handleMinimizeRequested); + this, &XdgToplevelWindow::handleMinimizeRequested); connect(shellSurface, &XdgToplevelInterface::parentXdgToplevelChanged, - this, &XdgToplevelClient::handleTransientForChanged); + this, &XdgToplevelWindow::handleTransientForChanged); connect(shellSurface, &XdgToplevelInterface::initializeRequested, - this, &XdgToplevelClient::initialize); + this, &XdgToplevelWindow::initialize); connect(shellSurface, &XdgToplevelInterface::aboutToBeDestroyed, - this, &XdgToplevelClient::destroyClient); + this, &XdgToplevelWindow::destroyClient); connect(shellSurface, &XdgToplevelInterface::maximumSizeChanged, - this, &XdgToplevelClient::handleMaximumSizeChanged); + this, &XdgToplevelWindow::handleMaximumSizeChanged); connect(shellSurface, &XdgToplevelInterface::minimumSizeChanged, - this, &XdgToplevelClient::handleMinimumSizeChanged); + this, &XdgToplevelWindow::handleMinimumSizeChanged); connect(shellSurface->shell(), &XdgShellInterface::pingTimeout, - this, &XdgToplevelClient::handlePingTimeout); + this, &XdgToplevelWindow::handlePingTimeout); connect(shellSurface->shell(), &XdgShellInterface::pingDelayed, - this, &XdgToplevelClient::handlePingDelayed); + this, &XdgToplevelWindow::handlePingDelayed); connect(shellSurface->shell(), &XdgShellInterface::pongReceived, - this, &XdgToplevelClient::handlePongReceived); + this, &XdgToplevelWindow::handlePongReceived); connect(waylandServer(), &WaylandServer::foreignTransientChanged, - this, &XdgToplevelClient::handleForeignTransientForChanged); + this, &XdgToplevelWindow::handleForeignTransientForChanged); } -XdgToplevelClient::~XdgToplevelClient() +XdgToplevelWindow::~XdgToplevelWindow() { } -XdgToplevelInterface *XdgToplevelClient::shellSurface() const +XdgToplevelInterface *XdgToplevelWindow::shellSurface() const { return m_shellSurface; } -MaximizeMode XdgToplevelClient::maximizeMode() const +MaximizeMode XdgToplevelWindow::maximizeMode() const { return m_maximizeMode; } -MaximizeMode XdgToplevelClient::requestedMaximizeMode() const +MaximizeMode XdgToplevelWindow::requestedMaximizeMode() const { return m_requestedMaximizeMode; } -QSize XdgToplevelClient::minSize() const +QSize XdgToplevelWindow::minSize() const { return rules()->checkMinSize(m_shellSurface->minimumSize()); } -QSize XdgToplevelClient::maxSize() const +QSize XdgToplevelWindow::maxSize() const { return rules()->checkMaxSize(m_shellSurface->maximumSize()); } -bool XdgToplevelClient::isFullScreen() const +bool XdgToplevelWindow::isFullScreen() const { return m_isFullScreen; } -bool XdgToplevelClient::isRequestedFullScreen() const +bool XdgToplevelWindow::isRequestedFullScreen() const { return m_isRequestedFullScreen; } -bool XdgToplevelClient::isMovable() const +bool XdgToplevelWindow::isMovable() const { if (isRequestedFullScreen()) { return false; @@ -643,7 +643,7 @@ bool XdgToplevelClient::isMovable() const return true; } -bool XdgToplevelClient::isMovableAcrossScreens() const +bool XdgToplevelWindow::isMovableAcrossScreens() const { if (isSpecialWindow() && !isSplash() && !isToolbar()) { return false; @@ -654,7 +654,7 @@ bool XdgToplevelClient::isMovableAcrossScreens() const return true; } -bool XdgToplevelClient::isResizable() const +bool XdgToplevelWindow::isResizable() const { if (isRequestedFullScreen()) { return false; @@ -670,12 +670,12 @@ bool XdgToplevelClient::isResizable() const return min.width() < max.width() || min.height() < max.height(); } -bool XdgToplevelClient::isCloseable() const +bool XdgToplevelWindow::isCloseable() const { return !isDesktop() && !isDock(); } -bool XdgToplevelClient::isFullScreenable() const +bool XdgToplevelWindow::isFullScreenable() const { if (!rules()->checkFullScreen(true)) { return false; @@ -683,7 +683,7 @@ bool XdgToplevelClient::isFullScreenable() const return !isSpecialWindow(); } -bool XdgToplevelClient::isMaximizable() const +bool XdgToplevelWindow::isMaximizable() const { if (!isResizable()) { return false; @@ -694,7 +694,7 @@ bool XdgToplevelClient::isMaximizable() const return true; } -bool XdgToplevelClient::isMinimizable() const +bool XdgToplevelWindow::isMinimizable() const { if (isSpecialWindow() && !isTransient()) { return false; @@ -705,32 +705,32 @@ bool XdgToplevelClient::isMinimizable() const return true; } -bool XdgToplevelClient::isPlaceable() const +bool XdgToplevelWindow::isPlaceable() const { return !m_plasmaShellSurface || !m_plasmaShellSurface->isPositionSet(); } -bool XdgToplevelClient::isTransient() const +bool XdgToplevelWindow::isTransient() const { return m_isTransient; } -bool XdgToplevelClient::userCanSetFullScreen() const +bool XdgToplevelWindow::userCanSetFullScreen() const { return true; } -bool XdgToplevelClient::userCanSetNoBorder() const +bool XdgToplevelWindow::userCanSetNoBorder() const { return (m_serverDecoration || m_xdgDecoration) && !isFullScreen() && !isShade(); } -bool XdgToplevelClient::noBorder() const +bool XdgToplevelWindow::noBorder() const { return m_userNoBorder; } -void XdgToplevelClient::setNoBorder(bool set) +void XdgToplevelWindow::setNoBorder(bool set) { set = rules()->checkNoBorder(set); if (m_userNoBorder == set) { @@ -741,18 +741,18 @@ void XdgToplevelClient::setNoBorder(bool set) updateWindowRules(Rules::NoBorder); } -void XdgToplevelClient::invalidateDecoration() +void XdgToplevelWindow::invalidateDecoration() { clearDecoration(); configureDecoration(); } -bool XdgToplevelClient::supportsWindowRules() const +bool XdgToplevelWindow::supportsWindowRules() const { return true; } -StrutRect XdgToplevelClient::strutRect(StrutArea area) const +StrutRect XdgToplevelWindow::strutRect(StrutArea area) const { if (!hasStrut()) { return StrutRect(); @@ -793,7 +793,7 @@ StrutRect XdgToplevelClient::strutRect(StrutArea area) const } } -bool XdgToplevelClient::hasStrut() const +bool XdgToplevelWindow::hasStrut() const { if (!isShown()) { return false; @@ -807,7 +807,7 @@ bool XdgToplevelClient::hasStrut() const return m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible; } -void XdgToplevelClient::showOnScreenEdge() +void XdgToplevelWindow::showOnScreenEdge() { // ShowOnScreenEdge can be called by an Edge, and hideClient could destroy the Edge // Use the singleshot to avoid use-after-free @@ -820,7 +820,7 @@ void XdgToplevelClient::showOnScreenEdge() }); } -void XdgToplevelClient::closeWindow() +void XdgToplevelWindow::closeWindow() { if (isCloseable()) { sendPing(PingReason::CloseWindow); @@ -828,7 +828,7 @@ void XdgToplevelClient::closeWindow() } } -XdgSurfaceConfigure *XdgToplevelClient::sendRoleConfigure() const +XdgSurfaceConfigure *XdgToplevelWindow::sendRoleConfigure() const { QSize framePadding(0, 0); if (m_nextDecoration) { @@ -860,7 +860,7 @@ XdgSurfaceConfigure *XdgToplevelClient::sendRoleConfigure() const return configureEvent; } -void XdgToplevelClient::handleRolePrecommit() +void XdgToplevelWindow::handleRolePrecommit() { auto configureEvent = static_cast(lastAcknowledgedConfigure()); if (configureEvent && decoration() != configureEvent->decoration) { @@ -869,7 +869,7 @@ void XdgToplevelClient::handleRolePrecommit() } } -void XdgToplevelClient::handleRoleCommit() +void XdgToplevelWindow::handleRoleCommit() { auto configureEvent = static_cast(lastAcknowledgedConfigure()); if (configureEvent) { @@ -877,7 +877,7 @@ void XdgToplevelClient::handleRoleCommit() } } -void XdgToplevelClient::doMinimize() +void XdgToplevelWindow::doMinimize() { if (isMinimized()) { workspace()->clientHidden(this); @@ -887,12 +887,12 @@ void XdgToplevelClient::doMinimize() workspace()->updateMinimizedOfTransients(this); } -void XdgToplevelClient::doInteractiveResizeSync() +void XdgToplevelWindow::doInteractiveResizeSync() { moveResizeInternal(moveResizeGeometry(), MoveResizeMode::Resize); } -void XdgToplevelClient::doSetActive() +void XdgToplevelWindow::doSetActive() { WaylandWindow::doSetActive(); @@ -905,7 +905,7 @@ void XdgToplevelClient::doSetActive() scheduleConfigure(); } -void XdgToplevelClient::doSetFullScreen() +void XdgToplevelWindow::doSetFullScreen() { if (isRequestedFullScreen()) { m_nextStates |= XdgToplevelInterface::State::FullScreen; @@ -916,7 +916,7 @@ void XdgToplevelClient::doSetFullScreen() scheduleConfigure(); } -void XdgToplevelClient::doSetMaximized() +void XdgToplevelWindow::doSetMaximized() { if (requestedMaximizeMode() & MaximizeHorizontal) { m_nextStates |= XdgToplevelInterface::State::MaximizedHorizontal; @@ -958,7 +958,7 @@ static Qt::Edges anchorsForQuickTileMode(QuickTileMode mode) return anchors; } -void XdgToplevelClient::doSetQuickTileMode() +void XdgToplevelWindow::doSetQuickTileMode() { const Qt::Edges anchors = anchorsForQuickTileMode(quickTileMode()); @@ -989,7 +989,7 @@ void XdgToplevelClient::doSetQuickTileMode() scheduleConfigure(); } -bool XdgToplevelClient::doStartInteractiveMoveResize() +bool XdgToplevelWindow::doStartInteractiveMoveResize() { if (interactiveMoveResizeGravity() != Gravity::None) { m_nextGravity = interactiveMoveResizeGravity(); @@ -999,7 +999,7 @@ bool XdgToplevelClient::doStartInteractiveMoveResize() return true; } -void XdgToplevelClient::doFinishInteractiveMoveResize() +void XdgToplevelWindow::doFinishInteractiveMoveResize() { if (m_nextStates & XdgToplevelInterface::State::Resizing) { m_nextStates &= ~XdgToplevelInterface::State::Resizing; @@ -1007,7 +1007,7 @@ void XdgToplevelClient::doFinishInteractiveMoveResize() } } -bool XdgToplevelClient::takeFocus() +bool XdgToplevelWindow::takeFocus() { if (wantsInput()) { sendPing(PingReason::FocusWindow); @@ -1019,12 +1019,12 @@ bool XdgToplevelClient::takeFocus() return true; } -bool XdgToplevelClient::wantsInput() const +bool XdgToplevelWindow::wantsInput() const { return rules()->checkAcceptFocus(acceptsFocus()); } -bool XdgToplevelClient::dockWantsInput() const +bool XdgToplevelWindow::dockWantsInput() const { if (m_plasmaShellSurface) { if (m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Panel) { @@ -1034,7 +1034,7 @@ bool XdgToplevelClient::dockWantsInput() const return false; } -bool XdgToplevelClient::acceptsFocus() const +bool XdgToplevelWindow::acceptsFocus() const { if (m_plasmaShellSurface) { if (m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::OnScreenDisplay || m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::ToolTip) { @@ -1047,7 +1047,7 @@ bool XdgToplevelClient::acceptsFocus() const return !isZombie() && readyForPainting(); } -Layer XdgToplevelClient::layerForDock() const +Layer XdgToplevelWindow::layerForDock() const { if (m_plasmaShellSurface) { switch (m_plasmaShellSurface->panelBehavior()) { @@ -1066,12 +1066,12 @@ Layer XdgToplevelClient::layerForDock() const return Window::layerForDock(); } -void XdgToplevelClient::handleWindowTitleChanged() +void XdgToplevelWindow::handleWindowTitleChanged() { setCaption(m_shellSurface->windowTitle()); } -void XdgToplevelClient::handleWindowClassChanged() +void XdgToplevelWindow::handleWindowClassChanged() { const QByteArray applicationId = m_shellSurface->windowClass().toUtf8(); setResourceClass(resourceName(), applicationId); @@ -1081,7 +1081,7 @@ void XdgToplevelClient::handleWindowClassChanged() setDesktopFileName(applicationId); } -void XdgToplevelClient::handleWindowMenuRequested(SeatInterface *seat, const QPoint &surfacePos, +void XdgToplevelWindow::handleWindowMenuRequested(SeatInterface *seat, const QPoint &surfacePos, quint32 serial) { Q_UNUSED(seat) @@ -1089,7 +1089,7 @@ void XdgToplevelClient::handleWindowMenuRequested(SeatInterface *seat, const QPo performMouseCommand(Options::MouseOperationsMenu, pos() + surfacePos); } -void XdgToplevelClient::handleMoveRequested(SeatInterface *seat, quint32 serial) +void XdgToplevelWindow::handleMoveRequested(SeatInterface *seat, quint32 serial) { if (!seat->hasImplicitPointerGrab(serial) && !seat->hasImplicitTouchGrab(serial)) { return; @@ -1107,7 +1107,7 @@ void XdgToplevelClient::handleMoveRequested(SeatInterface *seat, quint32 serial) } } -void XdgToplevelClient::handleResizeRequested(SeatInterface *seat, XdgToplevelInterface::ResizeAnchor anchor, quint32 serial) +void XdgToplevelWindow::handleResizeRequested(SeatInterface *seat, XdgToplevelInterface::ResizeAnchor anchor, quint32 serial) { if (!seat->hasImplicitPointerGrab(serial) && !seat->hasImplicitTouchGrab(serial)) { return; @@ -1165,7 +1165,7 @@ void XdgToplevelClient::handleResizeRequested(SeatInterface *seat, XdgToplevelIn updateCursor(); } -void XdgToplevelClient::handleStatesAcknowledged(const XdgToplevelInterface::States &states) +void XdgToplevelWindow::handleStatesAcknowledged(const XdgToplevelInterface::States &states) { const XdgToplevelInterface::States delta = m_acknowledgedStates ^ states; @@ -1186,7 +1186,7 @@ void XdgToplevelClient::handleStatesAcknowledged(const XdgToplevelInterface::Sta m_acknowledgedStates = states; } -void XdgToplevelClient::handleMaximizeRequested() +void XdgToplevelWindow::handleMaximizeRequested() { if (m_isInitialized) { maximize(MaximizeFull); @@ -1196,7 +1196,7 @@ void XdgToplevelClient::handleMaximizeRequested() } } -void XdgToplevelClient::handleUnmaximizeRequested() +void XdgToplevelWindow::handleUnmaximizeRequested() { if (m_isInitialized) { maximize(MaximizeRestore); @@ -1206,7 +1206,7 @@ void XdgToplevelClient::handleUnmaximizeRequested() } } -void XdgToplevelClient::handleFullscreenRequested(OutputInterface *output) +void XdgToplevelWindow::handleFullscreenRequested(OutputInterface *output) { m_fullScreenRequestedOutput = waylandServer()->findOutput(output); @@ -1218,7 +1218,7 @@ void XdgToplevelClient::handleFullscreenRequested(OutputInterface *output) } } -void XdgToplevelClient::handleUnfullscreenRequested() +void XdgToplevelWindow::handleUnfullscreenRequested() { m_fullScreenRequestedOutput.clear(); if (m_isInitialized) { @@ -1229,12 +1229,12 @@ void XdgToplevelClient::handleUnfullscreenRequested() } } -void XdgToplevelClient::handleMinimizeRequested() +void XdgToplevelWindow::handleMinimizeRequested() { performMouseCommand(Options::MouseMinimize, Cursors::self()->mouse()->pos()); } -void XdgToplevelClient::handleTransientForChanged() +void XdgToplevelWindow::handleTransientForChanged() { SurfaceInterface *transientForSurface = nullptr; if (XdgToplevelInterface *parentToplevel = m_shellSurface->parentXdgToplevel()) { @@ -1256,14 +1256,14 @@ void XdgToplevelClient::handleTransientForChanged() m_isTransient = transientForClient; } -void XdgToplevelClient::handleForeignTransientForChanged(SurfaceInterface *child) +void XdgToplevelWindow::handleForeignTransientForChanged(SurfaceInterface *child) { if (surface() == child) { handleTransientForChanged(); } } -void XdgToplevelClient::handlePingTimeout(quint32 serial) +void XdgToplevelWindow::handlePingTimeout(quint32 serial) { auto pingIt = m_pings.find(serial); if (pingIt == m_pings.end()) { @@ -1282,7 +1282,7 @@ void XdgToplevelClient::handlePingTimeout(quint32 serial) m_pings.erase(pingIt); } -void XdgToplevelClient::handlePingDelayed(quint32 serial) +void XdgToplevelWindow::handlePingDelayed(quint32 serial) { auto it = m_pings.find(serial); if (it != m_pings.end()) { @@ -1291,23 +1291,23 @@ void XdgToplevelClient::handlePingDelayed(quint32 serial) } } -void XdgToplevelClient::handlePongReceived(quint32 serial) +void XdgToplevelWindow::handlePongReceived(quint32 serial) { m_pings.remove(serial); setUnresponsive(false); } -void XdgToplevelClient::handleMaximumSizeChanged() +void XdgToplevelWindow::handleMaximumSizeChanged() { Q_EMIT maximizeableChanged(isMaximizable()); } -void XdgToplevelClient::handleMinimumSizeChanged() +void XdgToplevelWindow::handleMinimumSizeChanged() { Q_EMIT maximizeableChanged(isMaximizable()); } -void XdgToplevelClient::sendPing(PingReason reason) +void XdgToplevelWindow::sendPing(PingReason reason) { XdgShellInterface *shell = m_shellSurface->shell(); XdgSurfaceInterface *surface = m_shellSurface->xdgSurface(); @@ -1316,7 +1316,7 @@ void XdgToplevelClient::sendPing(PingReason reason) m_pings.insert(serial, reason); } -MaximizeMode XdgToplevelClient::initialMaximizeMode() const +MaximizeMode XdgToplevelWindow::initialMaximizeMode() const { MaximizeMode maximizeMode = MaximizeRestore; if (m_initialStates & XdgToplevelInterface::State::MaximizedHorizontal) { @@ -1328,12 +1328,12 @@ MaximizeMode XdgToplevelClient::initialMaximizeMode() const return maximizeMode; } -bool XdgToplevelClient::initialFullScreenMode() const +bool XdgToplevelWindow::initialFullScreenMode() const { return m_initialStates & XdgToplevelInterface::State::FullScreen; } -void XdgToplevelClient::initialize() +void XdgToplevelWindow::initialize() { bool needsPlacement = isPlaceable(); setupWindowRules(false); @@ -1394,7 +1394,7 @@ void XdgToplevelClient::initialize() m_isInitialized = true; } -void XdgToplevelClient::updateMaximizeMode(MaximizeMode maximizeMode) +void XdgToplevelWindow::updateMaximizeMode(MaximizeMode maximizeMode) { if (m_maximizeMode == maximizeMode) { return; @@ -1405,7 +1405,7 @@ void XdgToplevelClient::updateMaximizeMode(MaximizeMode maximizeMode) Q_EMIT clientMaximizedStateChanged(this, maximizeMode & MaximizeHorizontal, maximizeMode & MaximizeVertical); } -void XdgToplevelClient::updateFullScreenMode(bool set) +void XdgToplevelWindow::updateFullScreenMode(bool set) { if (m_isFullScreen == set) { return; @@ -1417,7 +1417,7 @@ void XdgToplevelClient::updateFullScreenMode(bool set) Q_EMIT fullScreenChanged(); } -QString XdgToplevelClient::preferredColorScheme() const +QString XdgToplevelWindow::preferredColorScheme() const { if (m_paletteInterface) { return rules()->checkDecoColor(m_paletteInterface->palette()); @@ -1425,7 +1425,7 @@ QString XdgToplevelClient::preferredColorScheme() const return rules()->checkDecoColor(QString()); } -void XdgToplevelClient::installAppMenu(AppMenuInterface *appMenu) +void XdgToplevelWindow::installAppMenu(AppMenuInterface *appMenu) { m_appMenuInterface = appMenu; @@ -1437,7 +1437,7 @@ void XdgToplevelClient::installAppMenu(AppMenuInterface *appMenu) updateMenu(appMenu->address()); } -XdgToplevelClient::DecorationMode XdgToplevelClient::preferredDecorationMode() const +XdgToplevelWindow::DecorationMode XdgToplevelWindow::preferredDecorationMode() const { if (!Decoration::DecorationBridge::hasPlugin()) { return DecorationMode::Client; @@ -1472,12 +1472,12 @@ XdgToplevelClient::DecorationMode XdgToplevelClient::preferredDecorationMode() c return DecorationMode::Client; } -void XdgToplevelClient::clearDecoration() +void XdgToplevelWindow::clearDecoration() { m_nextDecoration = nullptr; } -void XdgToplevelClient::configureDecoration() +void XdgToplevelWindow::configureDecoration() { const DecorationMode decorationMode = preferredDecorationMode(); switch (decorationMode) { @@ -1500,7 +1500,7 @@ void XdgToplevelClient::configureDecoration() } } -void XdgToplevelClient::configureXdgDecoration(DecorationMode decorationMode) +void XdgToplevelWindow::configureXdgDecoration(DecorationMode decorationMode) { switch (decorationMode) { case DecorationMode::None: // Faked as server side mode under the hood. @@ -1516,7 +1516,7 @@ void XdgToplevelClient::configureXdgDecoration(DecorationMode decorationMode) scheduleConfigure(); } -void XdgToplevelClient::configureServerDecoration(DecorationMode decorationMode) +void XdgToplevelWindow::configureServerDecoration(DecorationMode decorationMode) { switch (decorationMode) { case DecorationMode::None: @@ -1532,12 +1532,12 @@ void XdgToplevelClient::configureServerDecoration(DecorationMode decorationMode) scheduleConfigure(); } -void XdgToplevelClient::installXdgDecoration(XdgToplevelDecorationV1Interface *decoration) +void XdgToplevelWindow::installXdgDecoration(XdgToplevelDecorationV1Interface *decoration) { m_xdgDecoration = decoration; connect(m_xdgDecoration, &XdgToplevelDecorationV1Interface::destroyed, - this, &XdgToplevelClient::clearDecoration); + this, &XdgToplevelWindow::clearDecoration); connect(m_xdgDecoration, &XdgToplevelDecorationV1Interface::preferredModeChanged, this, [this] { if (m_isInitialized) { configureDecoration(); @@ -1545,7 +1545,7 @@ void XdgToplevelClient::installXdgDecoration(XdgToplevelDecorationV1Interface *d }); } -void XdgToplevelClient::installServerDecoration(ServerSideDecorationInterface *decoration) +void XdgToplevelWindow::installServerDecoration(ServerSideDecorationInterface *decoration) { m_serverDecoration = decoration; if (m_isInitialized) { @@ -1553,7 +1553,7 @@ void XdgToplevelClient::installServerDecoration(ServerSideDecorationInterface *d } connect(m_serverDecoration, &ServerSideDecorationInterface::destroyed, - this, &XdgToplevelClient::clearDecoration); + this, &XdgToplevelWindow::clearDecoration); connect(m_serverDecoration, &ServerSideDecorationInterface::preferredModeChanged, this, [this]() { if (m_isInitialized) { configureDecoration(); @@ -1561,18 +1561,18 @@ void XdgToplevelClient::installServerDecoration(ServerSideDecorationInterface *d }); } -void XdgToplevelClient::installPalette(ServerSideDecorationPaletteInterface *palette) +void XdgToplevelWindow::installPalette(ServerSideDecorationPaletteInterface *palette) { m_paletteInterface = palette; connect(m_paletteInterface, &ServerSideDecorationPaletteInterface::paletteChanged, - this, &XdgToplevelClient::updateColorScheme); + this, &XdgToplevelWindow::updateColorScheme); connect(m_paletteInterface, &QObject::destroyed, - this, &XdgToplevelClient::updateColorScheme); + this, &XdgToplevelWindow::updateColorScheme); updateColorScheme(); } -void XdgToplevelClient::setFullScreen(bool set, bool user) +void XdgToplevelWindow::setFullScreen(bool set, bool user) { set = rules()->checkFullScreen(set); if (m_isRequestedFullScreen == set) { @@ -1615,7 +1615,7 @@ void XdgToplevelClient::setFullScreen(bool set, bool user) * \todo Move to Window. */ static bool changeMaximizeRecursion = false; -void XdgToplevelClient::changeMaximize(bool horizontal, bool vertical, bool adjust) +void XdgToplevelWindow::changeMaximize(bool horizontal, bool vertical, bool adjust) { if (changeMaximizeRecursion) { return; @@ -1738,8 +1738,8 @@ void XdgToplevelClient::changeMaximize(bool horizontal, bool vertical, bool adju doSetMaximized(); } -XdgPopupClient::XdgPopupClient(XdgPopupInterface *shellSurface) - : XdgSurfaceClient(shellSurface->xdgSurface()) +XdgPopupWindow::XdgPopupWindow(XdgPopupInterface *shellSurface) + : XdgSurfaceWindow(shellSurface->xdgSurface()) , m_shellSurface(shellSurface) { m_windowType = NET::Unknown; @@ -1751,84 +1751,84 @@ XdgPopupClient::XdgPopupClient(XdgPopupInterface *shellSurface) #endif connect(shellSurface, &XdgPopupInterface::grabRequested, - this, &XdgPopupClient::handleGrabRequested); + this, &XdgPopupWindow::handleGrabRequested); connect(shellSurface, &XdgPopupInterface::initializeRequested, - this, &XdgPopupClient::initialize); + this, &XdgPopupWindow::initialize); connect(shellSurface, &XdgPopupInterface::repositionRequested, - this, &XdgPopupClient::handleRepositionRequested); + this, &XdgPopupWindow::handleRepositionRequested); connect(shellSurface, &XdgPopupInterface::aboutToBeDestroyed, - this, &XdgPopupClient::destroyClient); + this, &XdgPopupWindow::destroyClient); } -void XdgPopupClient::updateReactive() +void XdgPopupWindow::updateReactive() { if (m_shellSurface->positioner().isReactive()) { connect(transientFor(), &Window::frameGeometryChanged, - this, &XdgPopupClient::relayout, Qt::UniqueConnection); + this, &XdgPopupWindow::relayout, Qt::UniqueConnection); } else { disconnect(transientFor(), &Window::frameGeometryChanged, - this, &XdgPopupClient::relayout); + this, &XdgPopupWindow::relayout); } } -void XdgPopupClient::handleRepositionRequested(quint32 token) +void XdgPopupWindow::handleRepositionRequested(quint32 token) { updateReactive(); m_shellSurface->sendRepositioned(token); relayout(); } -void XdgPopupClient::relayout() +void XdgPopupWindow::relayout() { Placement::self()->place(this, QRect()); scheduleConfigure(); } -XdgPopupClient::~XdgPopupClient() +XdgPopupWindow::~XdgPopupWindow() { } -bool XdgPopupClient::hasPopupGrab() const +bool XdgPopupWindow::hasPopupGrab() const { return m_haveExplicitGrab; } -void XdgPopupClient::popupDone() +void XdgPopupWindow::popupDone() { m_shellSurface->sendPopupDone(); } -bool XdgPopupClient::isPopupWindow() const +bool XdgPopupWindow::isPopupWindow() const { return true; } -bool XdgPopupClient::isTransient() const +bool XdgPopupWindow::isTransient() const { return true; } -bool XdgPopupClient::isResizable() const +bool XdgPopupWindow::isResizable() const { return false; } -bool XdgPopupClient::isMovable() const +bool XdgPopupWindow::isMovable() const { return false; } -bool XdgPopupClient::isMovableAcrossScreens() const +bool XdgPopupWindow::isMovableAcrossScreens() const { return false; } -bool XdgPopupClient::hasTransientPlacementHint() const +bool XdgPopupWindow::hasTransientPlacementHint() const { return true; } -QRect XdgPopupClient::transientPlacement(const QRect &bounds) const +QRect XdgPopupWindow::transientPlacement(const QRect &bounds) const { const XdgPositioner positioner = m_shellSurface->positioner(); @@ -1949,31 +1949,31 @@ QRect XdgPopupClient::transientPlacement(const QRect &bounds) const return popupRect; } -bool XdgPopupClient::isCloseable() const +bool XdgPopupWindow::isCloseable() const { return false; } -void XdgPopupClient::closeWindow() +void XdgPopupWindow::closeWindow() { } -bool XdgPopupClient::wantsInput() const +bool XdgPopupWindow::wantsInput() const { return false; } -bool XdgPopupClient::takeFocus() +bool XdgPopupWindow::takeFocus() { return false; } -bool XdgPopupClient::acceptsFocus() const +bool XdgPopupWindow::acceptsFocus() const { return false; } -XdgSurfaceConfigure *XdgPopupClient::sendRoleConfigure() const +XdgSurfaceConfigure *XdgPopupWindow::sendRoleConfigure() const { const QPoint parentPosition = transientFor()->framePosToClientPos(transientFor()->pos()); const QPoint popupPosition = moveResizeGeometry().topLeft() - parentPosition; @@ -1987,14 +1987,14 @@ XdgSurfaceConfigure *XdgPopupClient::sendRoleConfigure() const return configureEvent; } -void XdgPopupClient::handleGrabRequested(SeatInterface *seat, quint32 serial) +void XdgPopupWindow::handleGrabRequested(SeatInterface *seat, quint32 serial) { Q_UNUSED(seat) Q_UNUSED(serial) m_haveExplicitGrab = true; } -void XdgPopupClient::initialize() +void XdgPopupWindow::initialize() { Window *parentClient = waylandServer()->findClient(m_shellSurface->parentSurface()); parentClient->addTransient(this); diff --git a/src/xdgshellclient.h b/src/xdgshellwindow.h similarity index 95% rename from src/xdgshellclient.h rename to src/xdgshellwindow.h index 94f194baa9..ecd1a85498 100644 --- a/src/xdgshellclient.h +++ b/src/xdgshellwindow.h @@ -50,13 +50,13 @@ public: ConfigureFlags flags; }; -class XdgSurfaceClient : public WaylandWindow +class XdgSurfaceWindow : public WaylandWindow { Q_OBJECT public: - explicit XdgSurfaceClient(KWaylandServer::XdgSurfaceInterface *shellSurface); - ~XdgSurfaceClient() override; + explicit XdgSurfaceWindow(KWaylandServer::XdgSurfaceInterface *shellSurface); + ~XdgSurfaceWindow() override; NET::WindowType windowType(bool direct = false, int supported_types = 0) const override; QRect frameRectToBufferRect(const QRect &rect) const override; @@ -111,7 +111,7 @@ public: KWaylandServer::XdgToplevelInterface::States states; }; -class XdgToplevelClient final : public XdgSurfaceClient +class XdgToplevelWindow final : public XdgSurfaceWindow { Q_OBJECT @@ -127,8 +127,8 @@ class XdgToplevelClient final : public XdgSurfaceClient }; public: - explicit XdgToplevelClient(KWaylandServer::XdgToplevelInterface *shellSurface); - ~XdgToplevelClient() override; + explicit XdgToplevelWindow(KWaylandServer::XdgToplevelInterface *shellSurface); + ~XdgToplevelWindow() override; KWaylandServer::XdgToplevelInterface *shellSurface() const; @@ -236,13 +236,13 @@ private: QSharedPointer m_nextDecoration; }; -class XdgPopupClient final : public XdgSurfaceClient +class XdgPopupWindow final : public XdgSurfaceWindow { Q_OBJECT public: - explicit XdgPopupClient(KWaylandServer::XdgPopupInterface *shellSurface); - ~XdgPopupClient() override; + explicit XdgPopupWindow(KWaylandServer::XdgPopupInterface *shellSurface); + ~XdgPopupWindow() override; bool hasPopupGrab() const override; void popupDone() override;