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.
This commit is contained in:
Nate Graham 2021-10-04 10:20:10 -06:00
parent cc5b47ee30
commit c1fb405b8d
6 changed files with 92 additions and 54 deletions

View file

@ -323,10 +323,10 @@ void MoveResizeWindowTest::testPackTo_data()
QTest::addColumn<QString>("methodCall");
QTest::addColumn<QRect>("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<QString>("methodCall");
QTest::addColumn<QRect>("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<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
@ -428,8 +428,8 @@ void MoveResizeWindowTest::testGrowShrink_data()
QTest::addColumn<QString>("methodCall");
QTest::addColumn<QRect>("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<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());

View file

@ -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();

View file

@ -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)

View file

@ -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();

View file

@ -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));

View file

@ -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();