From c1fb405b8d8715543e61d590b8f099407f9ae597 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Mon, 4 Oct 2021 10:20:10 -0600 Subject: [PATCH] Rename "pack" actions for clarity The English word "pack" is not really the correct word for these actions, and does not succeed in communicating what they will do. Since the actions simply move the active window as far as it will go in the specified direction, the actions can be renamed to say that instead. Also rename the action names in the code to match their new UI text for clarity. --- .../integration/move_resize_window_test.cpp | 32 ++++++------ src/placement.cpp | 12 ++--- src/scripting/workspace_wrapper.cpp | 12 ++--- src/scripting/workspace_wrapper.h | 50 ++++++++++++++++--- src/useractions.cpp | 28 +++++------ src/workspace.h | 12 ++--- 6 files changed, 92 insertions(+), 54 deletions(-) diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp index 562ac967a2..56dcc5fbc3 100644 --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -323,10 +323,10 @@ void MoveResizeWindowTest::testPackTo_data() QTest::addColumn("methodCall"); QTest::addColumn("expectedGeometry"); - QTest::newRow("left") << QStringLiteral("slotWindowPackLeft") << QRect(0, 487, 100, 50); - QTest::newRow("up") << QStringLiteral("slotWindowPackUp") << QRect(590, 0, 100, 50); - QTest::newRow("right") << QStringLiteral("slotWindowPackRight") << QRect(1180, 487, 100, 50); - QTest::newRow("down") << QStringLiteral("slotWindowPackDown") << QRect(590, 974, 100, 50); + QTest::newRow("left") << QStringLiteral("slotWindowMoveLeft") << QRect(0, 487, 100, 50); + QTest::newRow("up") << QStringLiteral("slotWindowMoveUp") << QRect(590, 0, 100, 50); + QTest::newRow("right") << QStringLiteral("slotWindowMoveRight") << QRect(1180, 487, 100, 50); + QTest::newRow("down") << QStringLiteral("slotWindowMoveDown") << QRect(590, 974, 100, 50); } void MoveResizeWindowTest::testPackTo() @@ -361,10 +361,10 @@ void MoveResizeWindowTest::testPackAgainstClient_data() QTest::addColumn("methodCall"); QTest::addColumn("expectedGeometry"); - QTest::newRow("left") << QStringLiteral("slotWindowPackLeft") << QRect(10, 487, 100, 50); - QTest::newRow("up") << QStringLiteral("slotWindowPackUp") << QRect(590, 10, 100, 50); - QTest::newRow("right") << QStringLiteral("slotWindowPackRight") << QRect(1170, 487, 100, 50); - QTest::newRow("down") << QStringLiteral("slotWindowPackDown") << QRect(590, 964, 100, 50); + QTest::newRow("left") << QStringLiteral("slotWindowMoveLeft") << QRect(10, 487, 100, 50); + QTest::newRow("up") << QStringLiteral("slotWindowMoveUp") << QRect(590, 10, 100, 50); + QTest::newRow("right") << QStringLiteral("slotWindowMoveRight") << QRect(1170, 487, 100, 50); + QTest::newRow("down") << QStringLiteral("slotWindowMoveDown") << QRect(590, 964, 100, 50); } void MoveResizeWindowTest::testPackAgainstClient() @@ -401,10 +401,10 @@ void MoveResizeWindowTest::testPackAgainstClient() QMetaObject::invokeMethod(workspace(), methodCall.toLocal8Bit().constData()); QCOMPARE(c->frameGeometry(), expectedGeometry); }; - renderWindow(surface1.data(), QStringLiteral("slotWindowPackLeft"), QRect(0, 507, 10, 10)); - renderWindow(surface2.data(), QStringLiteral("slotWindowPackUp"), QRect(635, 0, 10, 10)); - renderWindow(surface3.data(), QStringLiteral("slotWindowPackRight"), QRect(1270, 507, 10, 10)); - renderWindow(surface4.data(), QStringLiteral("slotWindowPackDown"), QRect(635, 1014, 10, 10)); + renderWindow(surface1.data(), QStringLiteral("slotWindowMoveLeft"), QRect(0, 507, 10, 10)); + renderWindow(surface2.data(), QStringLiteral("slotWindowMoveUp"), QRect(635, 0, 10, 10)); + renderWindow(surface3.data(), QStringLiteral("slotWindowMoveRight"), QRect(1270, 507, 10, 10)); + renderWindow(surface4.data(), QStringLiteral("slotWindowMoveDown"), QRect(635, 1014, 10, 10)); QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); @@ -428,8 +428,8 @@ void MoveResizeWindowTest::testGrowShrink_data() QTest::addColumn("methodCall"); QTest::addColumn("expectedGeometry"); - QTest::newRow("grow vertical") << QStringLiteral("slotWindowGrowVertical") << QRect(590, 487, 100, 537); - QTest::newRow("grow horizontal") << QStringLiteral("slotWindowGrowHorizontal") << QRect(590, 487, 690, 50); + QTest::newRow("grow vertical") << QStringLiteral("slotWindowExpandVertical") << QRect(590, 487, 100, 537); + QTest::newRow("grow horizontal") << QStringLiteral("slotWindowExpandHorizontal") << QRect(590, 487, 690, 50); QTest::newRow("shrink vertical") << QStringLiteral("slotWindowShrinkVertical") << QRect(590, 487, 100, 23); QTest::newRow("shrink horizontal") << QStringLiteral("slotWindowShrinkHorizontal") << QRect(590, 487, 40, 50); } @@ -445,8 +445,8 @@ void MoveResizeWindowTest::testGrowShrink() QVERIFY(!shellSurface1.isNull()); Test::render(surface1.data(), QSize(650, 514), Qt::blue); QVERIFY(Test::waitForWaylandWindowShown()); - workspace()->slotWindowPackRight(); - workspace()->slotWindowPackDown(); + workspace()->slotWindowMoveRight(); + workspace()->slotWindowMoveDown(); QScopedPointer surface(Test::createSurface()); QVERIFY(!surface.isNull()); diff --git a/src/placement.cpp b/src/placement.cpp index 0e40238bcd..55536cbf87 100644 --- a/src/placement.cpp +++ b/src/placement.cpp @@ -683,7 +683,7 @@ void AbstractClient::packTo(int left, int top) /** * Moves active window left until in bumps into another window or workarea edge. */ -void Workspace::slotWindowPackLeft() +void Workspace::slotWindowMoveLeft() { if (active_client && active_client->isMovable()) { const QRect geometry = active_client->moveResizeGeometry(); @@ -692,7 +692,7 @@ void Workspace::slotWindowPackLeft() } } -void Workspace::slotWindowPackRight() +void Workspace::slotWindowMoveRight() { if (active_client && active_client->isMovable()) { const QRect geometry = active_client->moveResizeGeometry(); @@ -701,7 +701,7 @@ void Workspace::slotWindowPackRight() } } -void Workspace::slotWindowPackUp() +void Workspace::slotWindowMoveUp() { if (active_client && active_client->isMovable()) { const QRect geometry = active_client->moveResizeGeometry(); @@ -710,7 +710,7 @@ void Workspace::slotWindowPackUp() } } -void Workspace::slotWindowPackDown() +void Workspace::slotWindowMoveDown() { if (active_client && active_client->isMovable()) { const QRect geometry = active_client->moveResizeGeometry(); @@ -730,7 +730,7 @@ void Workspace::slotWindowCenter() } } -void Workspace::slotWindowGrowHorizontal() +void Workspace::slotWindowExpandHorizontal() { if (active_client) active_client->growHorizontal(); @@ -779,7 +779,7 @@ void AbstractClient::shrinkHorizontal() } } -void Workspace::slotWindowGrowVertical() +void Workspace::slotWindowExpandVertical() { if (active_client) active_client->growVertical(); diff --git a/src/scripting/workspace_wrapper.cpp b/src/scripting/workspace_wrapper.cpp index def111863b..a6630e6389 100644 --- a/src/scripting/workspace_wrapper.cpp +++ b/src/scripting/workspace_wrapper.cpp @@ -152,12 +152,12 @@ SLOTWRAPPER(slotWindowRaise) SLOTWRAPPER(slotWindowLower) SLOTWRAPPER(slotWindowRaiseOrLower) SLOTWRAPPER(slotActivateAttentionWindow) -SLOTWRAPPER(slotWindowPackLeft) -SLOTWRAPPER(slotWindowPackRight) -SLOTWRAPPER(slotWindowPackUp) -SLOTWRAPPER(slotWindowPackDown) -SLOTWRAPPER(slotWindowGrowHorizontal) -SLOTWRAPPER(slotWindowGrowVertical) +SLOTWRAPPER(slotWindowMoveLeft) +SLOTWRAPPER(slotWindowMoveRight) +SLOTWRAPPER(slotWindowMoveUp) +SLOTWRAPPER(slotWindowMoveDown) +SLOTWRAPPER(slotWindowExpandHorizontal) +SLOTWRAPPER(slotWindowExpandVertical) SLOTWRAPPER(slotWindowShrinkHorizontal) SLOTWRAPPER(slotWindowShrinkVertical) diff --git a/src/scripting/workspace_wrapper.h b/src/scripting/workspace_wrapper.h index 067c65daf3..f85eeffb4f 100644 --- a/src/scripting/workspace_wrapper.h +++ b/src/scripting/workspace_wrapper.h @@ -306,12 +306,50 @@ public Q_SLOTS: void slotWindowLower(); void slotWindowRaiseOrLower(); void slotActivateAttentionWindow(); - void slotWindowPackLeft(); - void slotWindowPackRight(); - void slotWindowPackUp(); - void slotWindowPackDown(); - void slotWindowGrowHorizontal(); - void slotWindowGrowVertical(); + + /** + * @deprecated since 5.24 use slotWindowMoveLeft() + */ + void slotWindowPackLeft() { + slotWindowMoveLeft(); + } + /** + * @deprecated since 5.24 use slotWindowMoveRight() + */ + void slotWindowPackRight() { + slotWindowMoveRight(); + } + /** + * @deprecated since 5.24 use slotWindowMoveUp() + */ + void slotWindowPackUp() { + slotWindowMoveUp(); + } + /** + * @deprecated since 5.24 use slotWindowMoveDown() + */ + void slotWindowPackDown() { + slotWindowMoveDown(); + } + /** + * @deprecated since 5.24 use slotWindowExpandHorizontal() + */ + void slotWindowGrowHorizontal() { + slotWindowExpandHorizontal(); + } + /** + * @deprecated since 5.24 use slotWindowExpandVertical() + */ + void slotWindowGrowVertical() { + slotWindowExpandVertical(); + } + + void slotWindowMoveLeft(); + void slotWindowMoveRight(); + void slotWindowMoveUp(); + void slotWindowMoveDown(); + void slotWindowExpandHorizontal(); + void slotWindowExpandVertical(); void slotWindowShrinkHorizontal(); void slotWindowShrinkVertical(); void slotWindowQuickTileLeft(); diff --git a/src/useractions.cpp b/src/useractions.cpp index 4e611738b4..5ee6f1d301 100644 --- a/src/useractions.cpp +++ b/src/useractions.cpp @@ -1009,21 +1009,21 @@ void Workspace::initShortcuts() 0, slotSetupWindowShortcut); DEF2("Window Move Center", I18N_NOOP("Move Window to the Center"), 0, slotWindowCenter); - DEF2("Window Pack Right", I18N_NOOP("Pack Window to the Right"), - 0, slotWindowPackRight); - DEF2("Window Pack Left", I18N_NOOP("Pack Window to the Left"), - 0, slotWindowPackLeft); - DEF2("Window Pack Up", I18N_NOOP("Pack Window Up"), - 0, slotWindowPackUp); - DEF2("Window Pack Down", I18N_NOOP("Pack Window Down"), - 0, slotWindowPackDown); - DEF2("Window Grow Horizontal", I18N_NOOP("Pack Grow Window Horizontally"), - 0, slotWindowGrowHorizontal); - DEF2("Window Grow Vertical", I18N_NOOP("Pack Grow Window Vertically"), - 0, slotWindowGrowVertical); - DEF2("Window Shrink Horizontal", I18N_NOOP("Pack Shrink Window Horizontally"), + DEF2("Window Pack Right", I18N_NOOP("Move Window Right"), + 0, slotWindowMoveRight); + DEF2("Window Pack Left", I18N_NOOP("Move Window Left"), + 0, slotWindowMoveLeft); + DEF2("Window Pack Up", I18N_NOOP("Move Window Up"), + 0, slotWindowMoveUp); + DEF2("Window Pack Down", I18N_NOOP("Move Window Down"), + 0, slotWindowMoveDown); + DEF2("Window Grow Horizontal", I18N_NOOP("Expand Window Horizontally"), + 0, slotWindowExpandHorizontal); + DEF2("Window Grow Vertical", I18N_NOOP("Expand Window Vertically"), + 0, slotWindowExpandVertical); + DEF2("Window Shrink Horizontal", I18N_NOOP("Shrink Window Horizontally"), 0, slotWindowShrinkHorizontal); - DEF2("Window Shrink Vertical", I18N_NOOP("Pack Shrink Window Vertically"), + DEF2("Window Shrink Vertical", I18N_NOOP("Shrink Window Vertically"), 0, slotWindowShrinkVertical); DEF4("Window Quick Tile Left", I18N_NOOP("Quick Tile Window to the Left"), Qt::META + Qt::Key_Left, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Left)); diff --git a/src/workspace.h b/src/workspace.h index 8e4bf6d6a2..1157ce6dbb 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -444,12 +444,12 @@ public Q_SLOTS: void slotWindowCenter(); - void slotWindowPackLeft(); - void slotWindowPackRight(); - void slotWindowPackUp(); - void slotWindowPackDown(); - void slotWindowGrowHorizontal(); - void slotWindowGrowVertical(); + void slotWindowMoveLeft(); + void slotWindowMoveRight(); + void slotWindowMoveUp(); + void slotWindowMoveDown(); + void slotWindowExpandHorizontal(); + void slotWindowExpandVertical(); void slotWindowShrinkHorizontal(); void slotWindowShrinkVertical();