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.
This commit is contained in:
Noah Davis 2020-05-06 05:17:44 -04:00
parent 85b9aea5b4
commit f474686a58
9 changed files with 33 additions and 33 deletions

View file

@ -605,13 +605,13 @@ void InternalWindowTest::testModifierClickUnrestrictedMove()
QVERIFY(internalClient->isDecorated()); QVERIFY(internalClient->isDecorated());
KConfigGroup group = kwinApp()->config()->group("MouseBindings"); KConfigGroup group = kwinApp()->config()->group("MouseBindings");
group.writeEntry("CommandAllKey", "Alt"); group.writeEntry("CommandAllKey", "Meta");
group.writeEntry("CommandAll1", "Move"); group.writeEntry("CommandAll1", "Move");
group.writeEntry("CommandAll2", "Move"); group.writeEntry("CommandAll2", "Move");
group.writeEntry("CommandAll3", "Move"); group.writeEntry("CommandAll3", "Move");
group.sync(); group.sync();
workspace()->slotReconfigure(); workspace()->slotReconfigure();
QCOMPARE(options->commandAllModifier(), Qt::AltModifier); QCOMPARE(options->commandAllModifier(), Qt::MetaModifier);
QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove);
QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove);
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove);
@ -621,12 +621,12 @@ void InternalWindowTest::testModifierClickUnrestrictedMove()
// simulate modifier+click // simulate modifier+click
quint32 timestamp = 1; quint32 timestamp = 1;
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
QVERIFY(!internalClient->isMove()); QVERIFY(!internalClient->isMove());
kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++);
QVERIFY(internalClient->isMove()); QVERIFY(internalClient->isMove());
// release modifier should not change it // release modifier should not change it
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
QVERIFY(internalClient->isMove()); QVERIFY(internalClient->isMove());
// but releasing the key should end move/resize // but releasing the key should end move/resize
kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++);
@ -647,7 +647,7 @@ void InternalWindowTest::testModifierScroll()
QVERIFY(internalClient->isDecorated()); QVERIFY(internalClient->isDecorated());
KConfigGroup group = kwinApp()->config()->group("MouseBindings"); KConfigGroup group = kwinApp()->config()->group("MouseBindings");
group.writeEntry("CommandAllKey", "Alt"); group.writeEntry("CommandAllKey", "Meta");
group.writeEntry("CommandAllWheel", "change opacity"); group.writeEntry("CommandAllWheel", "change opacity");
group.sync(); group.sync();
workspace()->slotReconfigure(); workspace()->slotReconfigure();
@ -659,12 +659,12 @@ void InternalWindowTest::testModifierScroll()
internalClient->setOpacity(0.5); internalClient->setOpacity(0.5);
QCOMPARE(internalClient->opacity(), 0.5); QCOMPARE(internalClient->opacity(), 0.5);
quint32 timestamp = 1; quint32 timestamp = 1;
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
kwinApp()->platform()->pointerAxisVertical(-5, timestamp++); kwinApp()->platform()->pointerAxisVertical(-5, timestamp++);
QCOMPARE(internalClient->opacity(), 0.6); QCOMPARE(internalClient->opacity(), 0.6);
kwinApp()->platform()->pointerAxisVertical(5, timestamp++); kwinApp()->platform()->pointerAxisVertical(5, timestamp++);
QCOMPARE(internalClient->opacity(), 0.5); QCOMPARE(internalClient->opacity(), 0.5);
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
} }
void InternalWindowTest::testPopup() void InternalWindowTest::testPopup()

View file

@ -179,14 +179,14 @@ void TestPointerConstraints::testConfinedPointer()
// modifier + click should be ignored // modifier + click should be ignored
// first ensure the settings are ok // first ensure the settings are ok
KConfigGroup group = kwinApp()->config()->group("MouseBindings"); KConfigGroup group = kwinApp()->config()->group("MouseBindings");
group.writeEntry("CommandAllKey", QStringLiteral("Alt")); group.writeEntry("CommandAllKey", QStringLiteral("Meta"));
group.writeEntry("CommandAll1", "Move"); group.writeEntry("CommandAll1", "Move");
group.writeEntry("CommandAll2", "Move"); group.writeEntry("CommandAll2", "Move");
group.writeEntry("CommandAll3", "Move"); group.writeEntry("CommandAll3", "Move");
group.writeEntry("CommandAllWheel", "change opacity"); group.writeEntry("CommandAllWheel", "change opacity");
group.sync(); group.sync();
workspace()->slotReconfigure(); workspace()->slotReconfigure();
QCOMPARE(options->commandAllModifier(), Qt::AltModifier); QCOMPARE(options->commandAllModifier(), Qt::MetaModifier);
QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove);
QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove);
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove);

View file

@ -485,13 +485,13 @@ void PointerInputTest::testModifierClickUnrestrictedMoveGlobalShortcutsDisabled(
// first modify the config for this run // first modify the config for this run
KConfigGroup group = kwinApp()->config()->group("MouseBindings"); KConfigGroup group = kwinApp()->config()->group("MouseBindings");
group.writeEntry("CommandAllKey", "Alt"); group.writeEntry("CommandAllKey", "Meta");
group.writeEntry("CommandAll1", "Move"); group.writeEntry("CommandAll1", "Move");
group.writeEntry("CommandAll2", "Move"); group.writeEntry("CommandAll2", "Move");
group.writeEntry("CommandAll3", "Move"); group.writeEntry("CommandAll3", "Move");
group.sync(); group.sync();
workspace()->slotReconfigure(); workspace()->slotReconfigure();
QCOMPARE(options->commandAllModifier(), Qt::AltModifier); QCOMPARE(options->commandAllModifier(), Qt::MetaModifier);
QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove);
QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove);
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove);
@ -518,12 +518,12 @@ void PointerInputTest::testModifierClickUnrestrictedMoveGlobalShortcutsDisabled(
// simulate modifier+click // simulate modifier+click
quint32 timestamp = 1; quint32 timestamp = 1;
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
QVERIFY(!window->isMove()); QVERIFY(!window->isMove());
kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++);
QVERIFY(!window->isMove()); QVERIFY(!window->isMove());
// release modifier should not change it // release modifier should not change it
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
QVERIFY(!window->isMove()); QVERIFY(!window->isMove());
kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++);
@ -623,7 +623,7 @@ void PointerInputTest::testModifierScrollOpacityGlobalShortcutsDisabled()
// first modify the config for this run // first modify the config for this run
KConfigGroup group = kwinApp()->config()->group("MouseBindings"); KConfigGroup group = kwinApp()->config()->group("MouseBindings");
group.writeEntry("CommandAllKey", "Alt"); group.writeEntry("CommandAllKey", "Meta");
group.writeEntry("CommandAllWheel", "change opacity"); group.writeEntry("CommandAllWheel", "change opacity");
group.sync(); group.sync();
workspace()->slotReconfigure(); workspace()->slotReconfigure();
@ -653,12 +653,12 @@ void PointerInputTest::testModifierScrollOpacityGlobalShortcutsDisabled()
// simulate modifier+wheel // simulate modifier+wheel
quint32 timestamp = 1; quint32 timestamp = 1;
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
kwinApp()->platform()->pointerAxisVertical(-5, timestamp++); kwinApp()->platform()->pointerAxisVertical(-5, timestamp++);
QCOMPARE(window->opacity(), 0.5); QCOMPARE(window->opacity(), 0.5);
kwinApp()->platform()->pointerAxisVertical(5, timestamp++); kwinApp()->platform()->pointerAxisVertical(5, timestamp++);
QCOMPARE(window->opacity(), 0.5); QCOMPARE(window->opacity(), 0.5);
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
workspace()->disableGlobalShortcutsForClient(false); workspace()->disableGlobalShortcutsForClient(false);
} }
@ -1487,11 +1487,11 @@ void PointerInputTest::testResizeCursor()
// first modify the config for this run // first modify the config for this run
KConfigGroup group = kwinApp()->config()->group("MouseBindings"); KConfigGroup group = kwinApp()->config()->group("MouseBindings");
group.writeEntry("CommandAllKey", "Alt"); group.writeEntry("CommandAllKey", "Meta");
group.writeEntry("CommandAll3", "Resize"); group.writeEntry("CommandAll3", "Resize");
group.sync(); group.sync();
workspace()->slotReconfigure(); workspace()->slotReconfigure();
QCOMPARE(options->commandAllModifier(), Qt::AltModifier); QCOMPARE(options->commandAllModifier(), Qt::MetaModifier);
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedResize); QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedResize);
// create a test client // create a test client
@ -1532,7 +1532,7 @@ void PointerInputTest::testResizeCursor()
// start resizing the client // start resizing the client
int timestamp = 1; int timestamp = 1;
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
kwinApp()->platform()->pointerButtonPressed(BTN_RIGHT, timestamp++); kwinApp()->platform()->pointerButtonPressed(BTN_RIGHT, timestamp++);
QVERIFY(c->isResize()); QVERIFY(c->isResize());
@ -1543,7 +1543,7 @@ void PointerInputTest::testResizeCursor()
QCOMPARE(kwinApp()->platform()->cursorImage().hotSpot(), resizeCursor.hotSpot()); QCOMPARE(kwinApp()->platform()->cursorImage().hotSpot(), resizeCursor.hotSpot());
// finish resizing the client // finish resizing the client
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
kwinApp()->platform()->pointerButtonReleased(BTN_RIGHT, timestamp++); kwinApp()->platform()->pointerButtonReleased(BTN_RIGHT, timestamp++);
QVERIFY(!c->isResize()); QVERIFY(!c->isResize());
@ -1557,11 +1557,11 @@ void PointerInputTest::testMoveCursor()
// first modify the config for this run // first modify the config for this run
KConfigGroup group = kwinApp()->config()->group("MouseBindings"); KConfigGroup group = kwinApp()->config()->group("MouseBindings");
group.writeEntry("CommandAllKey", "Alt"); group.writeEntry("CommandAllKey", "Meta");
group.writeEntry("CommandAll1", "Move"); group.writeEntry("CommandAll1", "Move");
group.sync(); group.sync();
workspace()->slotReconfigure(); workspace()->slotReconfigure();
QCOMPARE(options->commandAllModifier(), Qt::AltModifier); QCOMPARE(options->commandAllModifier(), Qt::MetaModifier);
QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove);
// create a test client // create a test client
@ -1583,7 +1583,7 @@ void PointerInputTest::testMoveCursor()
// start moving the client // start moving the client
int timestamp = 1; int timestamp = 1;
kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++);
QVERIFY(c->isMove()); QVERIFY(c->isMove());
@ -1593,7 +1593,7 @@ void PointerInputTest::testMoveCursor()
QCOMPARE(kwinApp()->platform()->cursorImage().hotSpot(), sizeAllCursor.hotSpot()); QCOMPARE(kwinApp()->platform()->cursorImage().hotSpot(), sizeAllCursor.hotSpot());
// finish moving the client // finish moving the client
kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++);
QVERIFY(!c->isMove()); QVERIFY(!c->isMove());

View file

@ -443,7 +443,7 @@ the window.
<para> <para>
This bottom section, allows you to configure additional actions, when 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.</para> made on a window.</para>
<para> <para>

View file

@ -206,12 +206,12 @@
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>Alt</string> <string>Meta</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Meta</string> <string>Alt</string>
</property> </property>
</item> </item>
</widget> </widget>

View file

@ -296,10 +296,10 @@
</entry> </entry>
<entry key="CommandAllKey" type="Enum"> <entry key="CommandAllKey" type="Enum">
<default>Alt</default> <default>Meta</default>
<choices> <choices>
<choice name="Alt"></choice>
<choice name="Meta"></choice> <choice name="Meta"></choice>
<choice name="Alt"></choice>
</choices> </choices>
</entry> </entry>

View file

@ -9,7 +9,7 @@
<default>Nothing</default> <default>Nothing</default>
</entry> </entry>
<entry name="CommandAllKey" type="String"> <entry name="CommandAllKey" type="String">
<default>Alt</default> <default>Meta</default>
</entry> </entry>
<entry name="CommandAllWheel" type="String"> <entry name="CommandAllWheel" type="String">
<default>Nothing</default> <default>Nothing</default>

View file

@ -765,7 +765,7 @@ void Options::loadConfig()
config = KConfigGroup(m_settings->config(), "MouseBindings"); config = KConfigGroup(m_settings->config(), "MouseBindings");
// TODO: add properties for missing options // TODO: add properties for missing options
CmdTitlebarWheel = mouseWheelCommand(config.readEntry("CommandTitlebarWheel", "Nothing")); 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")); CmdAllWheel = mouseWheelCommand(config.readEntry("CommandAllWheel", "Nothing"));
setCommandActiveTitlebar1(mouseCommand(config.readEntry("CommandActiveTitlebar1", "Raise"), true)); setCommandActiveTitlebar1(mouseCommand(config.readEntry("CommandActiveTitlebar1", "Raise"), true));
setCommandActiveTitlebar2(mouseCommand(config.readEntry("CommandActiveTitlebar2", "Nothing"), 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 // 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 // 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 // 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) Options::WindowOperation Options::windowOperation(const QString &name, bool restricted)
{ {
if (name == QStringLiteral("Move")) if (name == QStringLiteral("Move"))

View file

@ -1330,7 +1330,7 @@ void Workspace::disableGlobalShortcutsForClient(bool disable)
QDBusConnection::sessionBus().asyncCall(message); QDBusConnection::sessionBus().asyncCall(message);
global_shortcuts_disabled_for_client = disable; global_shortcuts_disabled_for_client = disable;
// Update also Alt+LMB actions etc. // Update also Meta+LMB actions etc.
for (auto it = clients.constBegin(); for (auto it = clients.constBegin();
it != clients.constEnd(); it != clients.constEnd();
++it) ++it)