From b6412454c24e1f3bb79b9d52f56d4b0f8417ac24 Mon Sep 17 00:00:00 2001 From: Natalie Clarius Date: Wed, 30 Nov 2022 15:49:05 +0100 Subject: [PATCH] placement: remove cascaded placement policy becomes redundant with cascade-if-covering for zero-cornered placement --- autotests/integration/placement_test.cpp | 26 +++---------------- doc/windowbehaviour/index.docbook | 9 ------- doc/windowspecific/index.docbook | 1 - src/kcmkwin/kwinoptions/advanced.ui | 7 +---- .../kwinoptions/kwinoptions_settings.kcfg | 1 - src/kcmkwin/kwinoptions/windows.cpp | 1 - src/kcmkwin/kwinrules/rulesmodel.cpp | 1 - src/kwin.kcfg | 1 - src/options.h | 1 - src/placement.cpp | 5 +--- 10 files changed, 6 insertions(+), 47 deletions(-) diff --git a/autotests/integration/placement_test.cpp b/autotests/integration/placement_test.cpp index b4fd2aa306..1b4f1cd757 100644 --- a/autotests/integration/placement_test.cpp +++ b/autotests/integration/placement_test.cpp @@ -43,12 +43,11 @@ private Q_SLOTS: void initTestCase(); void testPlaceSmart(); - void testPlaceZeroCornered(); void testPlaceMaximized(); void testPlaceMaximizedLeavesFullscreen(); void testPlaceCentered(); void testPlaceUnderMouse(); - void testPlaceCascaded(); + void testPlaceZeroCornered(); void testPlaceRandom(); void testFullscreen(); @@ -151,23 +150,6 @@ void TestPlacement::testPlaceSmart() } } -void TestPlacement::testPlaceZeroCornered() -{ - setPlacementPolicy(PlacementZeroCornered); - - std::vector> surfaces; - for (int i = 0; i < 4; i++) { - auto [windowPlacement, surface] = createAndPlaceWindow(QSize(600, 500)); - // smart placement shouldn't define a size on windows - QCOMPARE(windowPlacement.initiallyConfiguredSize, QSize(0, 0)); - // size should match our buffer - QCOMPARE(windowPlacement.finalGeometry.size(), QSize(600, 500)); - // and it should be in the corner - QCOMPARE(windowPlacement.finalGeometry.topLeft(), QPoint(0, 0)); - surfaces.push_back(std::move(surface)); - } -} - void TestPlacement::testPlaceMaximized() { setPlacementPolicy(PlacementMaximizing); @@ -271,12 +253,12 @@ void TestPlacement::testPlaceUnderMouse() QVERIFY(Test::waitForWindowDestroyed(window)); } -void TestPlacement::testPlaceCascaded() +void TestPlacement::testPlaceZeroCornered() { - // This test verifies that Cascaded placement policy works. + // This test verifies that the Zero-Cornered placement policy works. KConfigGroup group = kwinApp()->config()->group("Windows"); - group.writeEntry("Placement", Placement::policyToString(PlacementCascade)); + group.writeEntry("Placement", Placement::policyToString(PlacementZeroCornered)); group.sync(); workspace()->slotReconfigure(); diff --git a/doc/windowbehaviour/index.docbook b/doc/windowbehaviour/index.docbook index 5cd88bbcbf..18b5e8ce77 100644 --- a/doc/windowbehaviour/index.docbook +++ b/doc/windowbehaviour/index.docbook @@ -1083,15 +1083,6 @@ Will try to maximize all new windows to fill the whole screen. - -Cascaded - - -Will cascade all new windows, opening each one down and to the right of the active window, starting from the top left corner of the screen when no windows are already open. - - - - Random diff --git a/doc/windowspecific/index.docbook b/doc/windowspecific/index.docbook index 5b9698b6f2..b662744e2b 100644 --- a/doc/windowspecific/index.docbook +++ b/doc/windowspecific/index.docbook @@ -340,7 +340,6 @@ and Move Down buttons effects on how they are applied.

No Placement - top-left corner.
Minimal Overlapping - place where no other window exists. Maximized - start the window maximized. -Cascaded - staircase-by-title. Centered - center of the desktop. Random In Top-Left Corner diff --git a/src/kcmkwin/kwinoptions/advanced.ui b/src/kcmkwin/kwinoptions/advanced.ui index 98f3ecca34..ecf3afbcbc 100644 --- a/src/kcmkwin/kwinoptions/advanced.ui +++ b/src/kcmkwin/kwinoptions/advanced.ui @@ -73,7 +73,7 @@ - <html><head/><body><p>The placement policy determines where a new window will appear on the desktop.</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Smart</span> will try to achieve a minimum overlap of windows</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Maximizing</span> will try to maximize every window to fill the whole screen. It might be useful to selectively affect placement of some windows using the window-specific settings.</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Cascade</span> will cascade the windows</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Random</span> will use a random position</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Centered</span> will place the window centered</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Zero-cornered</span> will place the window in the top-left corner</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Under mouse</span> will place the window under the pointer</li></ul></body></html> + <html><head/><body><p>The placement policy determines where a new window will appear on the desktop.</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Smart</span> will try to achieve a minimum overlap of windows</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Maximizing</span> will try to maximize every window to fill the whole screen. It might be useful to selectively affect placement of some windows using the window-specific settings.</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Random</span> will use a random position</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Centered</span> will place the window centered</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Zero-cornered</span> will place the window in the top-left corner</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Under mouse</span> will place the window under the pointer</li></ul></body></html> @@ -85,11 +85,6 @@ Maximized - - - Cascaded - - Random diff --git a/src/kcmkwin/kwinoptions/kwinoptions_settings.kcfg b/src/kcmkwin/kwinoptions/kwinoptions_settings.kcfg index 2057f94299..bc54b52092 100644 --- a/src/kcmkwin/kwinoptions/kwinoptions_settings.kcfg +++ b/src/kcmkwin/kwinoptions/kwinoptions_settings.kcfg @@ -41,7 +41,6 @@ - diff --git a/src/kcmkwin/kwinoptions/windows.cpp b/src/kcmkwin/kwinoptions/windows.cpp index 2a95ebbc5a..bd03e93758 100644 --- a/src/kcmkwin/kwinoptions/windows.cpp +++ b/src/kcmkwin/kwinoptions/windows.cpp @@ -245,7 +245,6 @@ void KAdvancedConfig::initialize(KWinOptionsSettings *settings, KWinOptionsKDEGl m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Smart, "Smart"); m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Maximizing, "Maximizing"); - m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Cascade, "Cascade"); m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Random, "Random"); m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Centered, "Centered"); m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::ZeroCornered, "ZeroCornered"); diff --git a/src/kcmkwin/kwinrules/rulesmodel.cpp b/src/kcmkwin/kwinrules/rulesmodel.cpp index 96ee645bdc..d59f7c3858 100644 --- a/src/kcmkwin/kwinrules/rulesmodel.cpp +++ b/src/kcmkwin/kwinrules/rulesmodel.cpp @@ -793,7 +793,6 @@ QList RulesModel::placementModelData() const {PlacementNone, i18n("No Placement")}, {PlacementSmart, i18n("Minimal Overlapping")}, {PlacementMaximizing, i18n("Maximized")}, - {PlacementCascade, i18n("Cascaded")}, {PlacementCentered, i18n("Centered")}, {PlacementRandom, i18n("Random")}, {PlacementZeroCornered, i18n("In Top-Left Corner")}, diff --git a/src/kwin.kcfg b/src/kwin.kcfg index 79998996bd..d30ce1f9d5 100644 --- a/src/kwin.kcfg +++ b/src/kwin.kcfg @@ -118,7 +118,6 @@ - diff --git a/src/options.h b/src/options.h index 7040cec0f1..46922566e6 100644 --- a/src/options.h +++ b/src/options.h @@ -73,7 +73,6 @@ enum PlacementPolicy { PlacementUnknown, // special, means the function should use its default PlacementRandom, PlacementSmart, - PlacementCascade, PlacementCentered, PlacementZeroCornered, PlacementUnderMouse, // special diff --git a/src/placement.cpp b/src/placement.cpp index d6c2df1789..723ee558a8 100644 --- a/src/placement.cpp +++ b/src/placement.cpp @@ -74,9 +74,6 @@ void Placement::place(Window *c, const QRectF &area, PlacementPolicy policy, Pla case PlacementRandom: placeAtRandom(c, area.toRect(), nextPlacement); break; - case PlacementCascade: - placeCascaded(c, area.toRect(), nextPlacement); - break; case PlacementCentered: placeCentered(c, area, nextPlacement); break; @@ -661,7 +658,7 @@ void Placement::unclutterDesktop() const char *Placement::policyToString(PlacementPolicy policy) { const char *const policies[] = { - "NoPlacement", "Default", "XXX should never see", "Random", "Smart", "Cascade", "Centered", + "NoPlacement", "Default", "XXX should never see", "Random", "Smart", "Centered", "ZeroCornered", "UnderMouse", "OnMainWindow", "Maximizing"}; Q_ASSERT(policy < int(sizeof(policies) / sizeof(policies[0]))); return policies[policy];