From f474686a584a0f3049b3eddb8b148d3703a7148a Mon Sep 17 00:00:00 2001 From: Noah Davis Date: Wed, 6 May 2020 05:17:44 -0400 Subject: [PATCH] Change CommandAllKey to Meta Summary: Alt + Left Click to move windows has a tendency to conflict with creative workflow apps. While Alt can be changed to Meta in KWin's settings, Alt + Left Click shortcuts often cannot be customized in apps. Rather than making every user who runs into this problem change their settings, we should change our default settings to improve KWin's default usability. The fact that Alt + Left Click to move windows is older does not matter. We are trying to use Meta for global/shell shortcuts anyway. BUG: 399375 Test Plan: The relevant parts of the relevant tests pass. kwin-testInternalWindow fails, but for unrelated reasons that have something to do with XWayland. --- autotests/integration/internal_window.cpp | 14 ++++----- .../integration/pointer_constraints_test.cpp | 4 +-- autotests/integration/pointer_input.cpp | 30 +++++++++---------- doc/windowbehaviour/index.docbook | 2 +- kcmkwin/kwinoptions/actions.ui | 4 +-- kcmkwin/kwinoptions/kwinoptions_settings.kcfg | 4 +-- kwin.kcfg | 2 +- options.cpp | 4 +-- workspace.cpp | 2 +- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/autotests/integration/internal_window.cpp b/autotests/integration/internal_window.cpp index 23d039a9b..4dd9e3520 100644 --- a/autotests/integration/internal_window.cpp +++ b/autotests/integration/internal_window.cpp @@ -605,13 +605,13 @@ void InternalWindowTest::testModifierClickUnrestrictedMove() QVERIFY(internalClient->isDecorated()); KConfigGroup group = kwinApp()->config()->group("MouseBindings"); - group.writeEntry("CommandAllKey", "Alt"); + group.writeEntry("CommandAllKey", "Meta"); group.writeEntry("CommandAll1", "Move"); group.writeEntry("CommandAll2", "Move"); group.writeEntry("CommandAll3", "Move"); group.sync(); workspace()->slotReconfigure(); - QCOMPARE(options->commandAllModifier(), Qt::AltModifier); + QCOMPARE(options->commandAllModifier(), Qt::MetaModifier); QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); @@ -621,12 +621,12 @@ void InternalWindowTest::testModifierClickUnrestrictedMove() // simulate modifier+click quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); QVERIFY(!internalClient->isMove()); kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); QVERIFY(internalClient->isMove()); // release modifier should not change it - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); QVERIFY(internalClient->isMove()); // but releasing the key should end move/resize kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); @@ -647,7 +647,7 @@ void InternalWindowTest::testModifierScroll() QVERIFY(internalClient->isDecorated()); KConfigGroup group = kwinApp()->config()->group("MouseBindings"); - group.writeEntry("CommandAllKey", "Alt"); + group.writeEntry("CommandAllKey", "Meta"); group.writeEntry("CommandAllWheel", "change opacity"); group.sync(); workspace()->slotReconfigure(); @@ -659,12 +659,12 @@ void InternalWindowTest::testModifierScroll() internalClient->setOpacity(0.5); QCOMPARE(internalClient->opacity(), 0.5); quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); kwinApp()->platform()->pointerAxisVertical(-5, timestamp++); QCOMPARE(internalClient->opacity(), 0.6); kwinApp()->platform()->pointerAxisVertical(5, timestamp++); QCOMPARE(internalClient->opacity(), 0.5); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); } void InternalWindowTest::testPopup() diff --git a/autotests/integration/pointer_constraints_test.cpp b/autotests/integration/pointer_constraints_test.cpp index b2b997dbe..adbf351bc 100644 --- a/autotests/integration/pointer_constraints_test.cpp +++ b/autotests/integration/pointer_constraints_test.cpp @@ -179,14 +179,14 @@ void TestPointerConstraints::testConfinedPointer() // modifier + click should be ignored // first ensure the settings are ok KConfigGroup group = kwinApp()->config()->group("MouseBindings"); - group.writeEntry("CommandAllKey", QStringLiteral("Alt")); + group.writeEntry("CommandAllKey", QStringLiteral("Meta")); group.writeEntry("CommandAll1", "Move"); group.writeEntry("CommandAll2", "Move"); group.writeEntry("CommandAll3", "Move"); group.writeEntry("CommandAllWheel", "change opacity"); group.sync(); workspace()->slotReconfigure(); - QCOMPARE(options->commandAllModifier(), Qt::AltModifier); + QCOMPARE(options->commandAllModifier(), Qt::MetaModifier); QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); diff --git a/autotests/integration/pointer_input.cpp b/autotests/integration/pointer_input.cpp index db38d8c42..fe7fd27c9 100644 --- a/autotests/integration/pointer_input.cpp +++ b/autotests/integration/pointer_input.cpp @@ -485,13 +485,13 @@ void PointerInputTest::testModifierClickUnrestrictedMoveGlobalShortcutsDisabled( // first modify the config for this run KConfigGroup group = kwinApp()->config()->group("MouseBindings"); - group.writeEntry("CommandAllKey", "Alt"); + group.writeEntry("CommandAllKey", "Meta"); group.writeEntry("CommandAll1", "Move"); group.writeEntry("CommandAll2", "Move"); group.writeEntry("CommandAll3", "Move"); group.sync(); workspace()->slotReconfigure(); - QCOMPARE(options->commandAllModifier(), Qt::AltModifier); + QCOMPARE(options->commandAllModifier(), Qt::MetaModifier); QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); @@ -518,12 +518,12 @@ void PointerInputTest::testModifierClickUnrestrictedMoveGlobalShortcutsDisabled( // simulate modifier+click quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); QVERIFY(!window->isMove()); kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); QVERIFY(!window->isMove()); // release modifier should not change it - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); QVERIFY(!window->isMove()); kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); @@ -623,7 +623,7 @@ void PointerInputTest::testModifierScrollOpacityGlobalShortcutsDisabled() // first modify the config for this run KConfigGroup group = kwinApp()->config()->group("MouseBindings"); - group.writeEntry("CommandAllKey", "Alt"); + group.writeEntry("CommandAllKey", "Meta"); group.writeEntry("CommandAllWheel", "change opacity"); group.sync(); workspace()->slotReconfigure(); @@ -653,12 +653,12 @@ void PointerInputTest::testModifierScrollOpacityGlobalShortcutsDisabled() // simulate modifier+wheel quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); kwinApp()->platform()->pointerAxisVertical(-5, timestamp++); QCOMPARE(window->opacity(), 0.5); kwinApp()->platform()->pointerAxisVertical(5, timestamp++); QCOMPARE(window->opacity(), 0.5); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); workspace()->disableGlobalShortcutsForClient(false); } @@ -1487,11 +1487,11 @@ void PointerInputTest::testResizeCursor() // first modify the config for this run KConfigGroup group = kwinApp()->config()->group("MouseBindings"); - group.writeEntry("CommandAllKey", "Alt"); + group.writeEntry("CommandAllKey", "Meta"); group.writeEntry("CommandAll3", "Resize"); group.sync(); workspace()->slotReconfigure(); - QCOMPARE(options->commandAllModifier(), Qt::AltModifier); + QCOMPARE(options->commandAllModifier(), Qt::MetaModifier); QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedResize); // create a test client @@ -1532,7 +1532,7 @@ void PointerInputTest::testResizeCursor() // start resizing the client int timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); kwinApp()->platform()->pointerButtonPressed(BTN_RIGHT, timestamp++); QVERIFY(c->isResize()); @@ -1543,7 +1543,7 @@ void PointerInputTest::testResizeCursor() QCOMPARE(kwinApp()->platform()->cursorImage().hotSpot(), resizeCursor.hotSpot()); // finish resizing the client - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); kwinApp()->platform()->pointerButtonReleased(BTN_RIGHT, timestamp++); QVERIFY(!c->isResize()); @@ -1557,11 +1557,11 @@ void PointerInputTest::testMoveCursor() // first modify the config for this run KConfigGroup group = kwinApp()->config()->group("MouseBindings"); - group.writeEntry("CommandAllKey", "Alt"); + group.writeEntry("CommandAllKey", "Meta"); group.writeEntry("CommandAll1", "Move"); group.sync(); workspace()->slotReconfigure(); - QCOMPARE(options->commandAllModifier(), Qt::AltModifier); + QCOMPARE(options->commandAllModifier(), Qt::MetaModifier); QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); // create a test client @@ -1583,7 +1583,7 @@ void PointerInputTest::testMoveCursor() // start moving the client int timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); QVERIFY(c->isMove()); @@ -1593,7 +1593,7 @@ void PointerInputTest::testMoveCursor() QCOMPARE(kwinApp()->platform()->cursorImage().hotSpot(), sizeAllCursor.hotSpot()); // finish moving the client - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); QVERIFY(!c->isMove()); diff --git a/doc/windowbehaviour/index.docbook b/doc/windowbehaviour/index.docbook index 75060404f..75f030556 100644 --- a/doc/windowbehaviour/index.docbook +++ b/doc/windowbehaviour/index.docbook @@ -443,7 +443,7 @@ the window. This bottom section, allows you to configure additional actions, when -a modifier key (by default &Alt;) is pressed, and a mouse click is +a modifier key (by default &Meta;) is pressed, and a mouse click is made on a window. diff --git a/kcmkwin/kwinoptions/actions.ui b/kcmkwin/kwinoptions/actions.ui index a525bb7f7..7614c5128 100644 --- a/kcmkwin/kwinoptions/actions.ui +++ b/kcmkwin/kwinoptions/actions.ui @@ -206,12 +206,12 @@ - Alt + Meta - Meta + Alt diff --git a/kcmkwin/kwinoptions/kwinoptions_settings.kcfg b/kcmkwin/kwinoptions/kwinoptions_settings.kcfg index 3ee260af0..770b2805e 100644 --- a/kcmkwin/kwinoptions/kwinoptions_settings.kcfg +++ b/kcmkwin/kwinoptions/kwinoptions_settings.kcfg @@ -296,10 +296,10 @@ - Alt + Meta - + diff --git a/kwin.kcfg b/kwin.kcfg index 861b6c994..a9b11a6d2 100644 --- a/kwin.kcfg +++ b/kwin.kcfg @@ -9,7 +9,7 @@ Nothing - Alt + Meta Nothing diff --git a/options.cpp b/options.cpp index 63f922cf6..060a0cec2 100644 --- a/options.cpp +++ b/options.cpp @@ -765,7 +765,7 @@ void Options::loadConfig() config = KConfigGroup(m_settings->config(), "MouseBindings"); // TODO: add properties for missing options CmdTitlebarWheel = mouseWheelCommand(config.readEntry("CommandTitlebarWheel", "Nothing")); - CmdAllModKey = (config.readEntry("CommandAllKey", "Alt") == QStringLiteral("Meta")) ? Qt::Key_Meta : Qt::Key_Alt; + CmdAllModKey = (config.readEntry("CommandAllKey", "Meta") == QStringLiteral("Meta")) ? Qt::Key_Meta : Qt::Key_Alt; CmdAllWheel = mouseWheelCommand(config.readEntry("CommandAllWheel", "Nothing")); setCommandActiveTitlebar1(mouseCommand(config.readEntry("CommandActiveTitlebar1", "Raise"), true)); setCommandActiveTitlebar2(mouseCommand(config.readEntry("CommandActiveTitlebar2", "Nothing"), true)); @@ -963,7 +963,7 @@ void Options::reloadCompositingSettings(bool force) // restricted should be true for operations that the user may not be able to repeat // if the window is moved out of the workspace (e.g. if the user moves a window // by the titlebar, and moves it too high beneath Kicker at the top edge, they -// may not be able to move it back, unless they know about Alt+LMB) +// may not be able to move it back, unless they know about Meta+LMB) Options::WindowOperation Options::windowOperation(const QString &name, bool restricted) { if (name == QStringLiteral("Move")) diff --git a/workspace.cpp b/workspace.cpp index d2892ac7d..5b6524495 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1330,7 +1330,7 @@ void Workspace::disableGlobalShortcutsForClient(bool disable) QDBusConnection::sessionBus().asyncCall(message); global_shortcuts_disabled_for_client = disable; - // Update also Alt+LMB actions etc. + // Update also Meta+LMB actions etc. for (auto it = clients.constBegin(); it != clients.constEnd(); ++it)