placement: remove cascaded placement policy

becomes redundant with cascade-if-covering for zero-cornered placement
This commit is contained in:
Natalie Clarius 2022-11-30 15:49:05 +01:00
parent b08ef54727
commit b6412454c2
10 changed files with 6 additions and 47 deletions

View file

@ -43,12 +43,11 @@ private Q_SLOTS:
void initTestCase(); void initTestCase();
void testPlaceSmart(); void testPlaceSmart();
void testPlaceZeroCornered();
void testPlaceMaximized(); void testPlaceMaximized();
void testPlaceMaximizedLeavesFullscreen(); void testPlaceMaximizedLeavesFullscreen();
void testPlaceCentered(); void testPlaceCentered();
void testPlaceUnderMouse(); void testPlaceUnderMouse();
void testPlaceCascaded(); void testPlaceZeroCornered();
void testPlaceRandom(); void testPlaceRandom();
void testFullscreen(); void testFullscreen();
@ -151,23 +150,6 @@ void TestPlacement::testPlaceSmart()
} }
} }
void TestPlacement::testPlaceZeroCornered()
{
setPlacementPolicy(PlacementZeroCornered);
std::vector<std::unique_ptr<KWayland::Client::Surface>> 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() void TestPlacement::testPlaceMaximized()
{ {
setPlacementPolicy(PlacementMaximizing); setPlacementPolicy(PlacementMaximizing);
@ -271,12 +253,12 @@ void TestPlacement::testPlaceUnderMouse()
QVERIFY(Test::waitForWindowDestroyed(window)); 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"); KConfigGroup group = kwinApp()->config()->group("Windows");
group.writeEntry("Placement", Placement::policyToString(PlacementCascade)); group.writeEntry("Placement", Placement::policyToString(PlacementZeroCornered));
group.sync(); group.sync();
workspace()->slotReconfigure(); workspace()->slotReconfigure();

View file

@ -1083,15 +1083,6 @@ Will try to maximize all new windows to fill the whole screen.
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><guilabel>Cascaded</guilabel></term>
<listitem>
<para>
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.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><guilabel>Random</guilabel></term> <term><guilabel>Random</guilabel></term>
<listitem> <listitem>

View file

@ -340,7 +340,6 @@ and <guibutton>Move Down</guibutton> buttons effects on how they are applied.</p
<listitem><para><guilabel>No Placement</guilabel> - top-left corner.</para></listitem> <listitem><para><guilabel>No Placement</guilabel> - top-left corner.</para></listitem>
<listitem><para><guilabel>Minimal Overlapping</guilabel> - place where no other window exists.</para></listitem> <listitem><para><guilabel>Minimal Overlapping</guilabel> - place where no other window exists.</para></listitem>
<listitem><para><guilabel>Maximized</guilabel> - start the window maximized.</para></listitem> <listitem><para><guilabel>Maximized</guilabel> - start the window maximized.</para></listitem>
<listitem><para><guilabel>Cascaded</guilabel> - staircase-by-title.</para></listitem>
<listitem><para><guilabel>Centered</guilabel> - center of the desktop.</para></listitem> <listitem><para><guilabel>Centered</guilabel> - center of the desktop.</para></listitem>
<listitem><para><guilabel>Random</guilabel></para></listitem> <listitem><para><guilabel>Random</guilabel></para></listitem>
<listitem><para><guilabel>In Top-Left Corner</guilabel></para></listitem> <listitem><para><guilabel>In Top-Left Corner</guilabel></para></listitem>

View file

@ -73,7 +73,7 @@
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="kcfg_Placement"> <widget class="QComboBox" name="kcfg_Placement">
<property name="whatsThis"> <property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The placement policy determines where a new window will appear on the desktop.&lt;/p&gt;&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Smart&lt;/span&gt; will try to achieve a minimum overlap of windows&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Maximizing&lt;/span&gt; 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.&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Cascade&lt;/span&gt; will cascade the windows&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Random&lt;/span&gt; will use a random position&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Centered&lt;/span&gt; will place the window centered&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Zero-cornered&lt;/span&gt; will place the window in the top-left corner&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Under mouse&lt;/span&gt; will place the window under the pointer&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The placement policy determines where a new window will appear on the desktop.&lt;/p&gt;&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Smart&lt;/span&gt; will try to achieve a minimum overlap of windows&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Maximizing&lt;/span&gt; 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.&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Random&lt;/span&gt; will use a random position&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Centered&lt;/span&gt; will place the window centered&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Zero-cornered&lt;/span&gt; will place the window in the top-left corner&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Under mouse&lt;/span&gt; will place the window under the pointer&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<item> <item>
<property name="text"> <property name="text">
@ -85,11 +85,6 @@
<string>Maximized</string> <string>Maximized</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Cascaded</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>Random</string> <string>Random</string>

View file

@ -41,7 +41,6 @@
<choices name="PlacementChoices"> <choices name="PlacementChoices">
<choice name="Smart"></choice> <choice name="Smart"></choice>
<choice name="Maximizing"></choice> <choice name="Maximizing"></choice>
<choice name="Cascade"></choice>
<choice name="Random"></choice> <choice name="Random"></choice>
<choice name="Centered"></choice> <choice name="Centered"></choice>
<choice name="ZeroCornered"></choice> <choice name="ZeroCornered"></choice>

View file

@ -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::Smart, "Smart");
m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Maximizing, "Maximizing"); 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::Random, "Random");
m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Centered, "Centered"); m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Centered, "Centered");
m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::ZeroCornered, "ZeroCornered"); m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::ZeroCornered, "ZeroCornered");

View file

@ -793,7 +793,6 @@ QList<OptionsModel::Data> RulesModel::placementModelData() const
{PlacementNone, i18n("No Placement")}, {PlacementNone, i18n("No Placement")},
{PlacementSmart, i18n("Minimal Overlapping")}, {PlacementSmart, i18n("Minimal Overlapping")},
{PlacementMaximizing, i18n("Maximized")}, {PlacementMaximizing, i18n("Maximized")},
{PlacementCascade, i18n("Cascaded")},
{PlacementCentered, i18n("Centered")}, {PlacementCentered, i18n("Centered")},
{PlacementRandom, i18n("Random")}, {PlacementRandom, i18n("Random")},
{PlacementZeroCornered, i18n("In Top-Left Corner")}, {PlacementZeroCornered, i18n("In Top-Left Corner")},

View file

@ -118,7 +118,6 @@
<choice name="PlacementUnknown" value="Unknown"/> <choice name="PlacementUnknown" value="Unknown"/>
<choice name="PlacementRandom" value="Random"/> <choice name="PlacementRandom" value="Random"/>
<choice name="PlacementSmart" value="Smart"/> <choice name="PlacementSmart" value="Smart"/>
<choice name="PlacementCascade" value="Cascade"/>
<choice name="PlacementCentered" value="Centered"/> <choice name="PlacementCentered" value="Centered"/>
<choice name="PlacementZeroCornered" value="ZeroCornered"/> <choice name="PlacementZeroCornered" value="ZeroCornered"/>
<choice name="PlacementUnderMouse" value="UnderMouse"/> <choice name="PlacementUnderMouse" value="UnderMouse"/>

View file

@ -73,7 +73,6 @@ enum PlacementPolicy {
PlacementUnknown, // special, means the function should use its default PlacementUnknown, // special, means the function should use its default
PlacementRandom, PlacementRandom,
PlacementSmart, PlacementSmart,
PlacementCascade,
PlacementCentered, PlacementCentered,
PlacementZeroCornered, PlacementZeroCornered,
PlacementUnderMouse, // special PlacementUnderMouse, // special

View file

@ -74,9 +74,6 @@ void Placement::place(Window *c, const QRectF &area, PlacementPolicy policy, Pla
case PlacementRandom: case PlacementRandom:
placeAtRandom(c, area.toRect(), nextPlacement); placeAtRandom(c, area.toRect(), nextPlacement);
break; break;
case PlacementCascade:
placeCascaded(c, area.toRect(), nextPlacement);
break;
case PlacementCentered: case PlacementCentered:
placeCentered(c, area, nextPlacement); placeCentered(c, area, nextPlacement);
break; break;
@ -661,7 +658,7 @@ void Placement::unclutterDesktop()
const char *Placement::policyToString(PlacementPolicy policy) const char *Placement::policyToString(PlacementPolicy policy)
{ {
const char *const policies[] = { 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"}; "ZeroCornered", "UnderMouse", "OnMainWindow", "Maximizing"};
Q_ASSERT(policy < int(sizeof(policies) / sizeof(policies[0]))); Q_ASSERT(policy < int(sizeof(policies) / sizeof(policies[0])));
return policies[policy]; return policies[policy];