Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Ctrl in editor shortcuts with Cmd or Ctrl depending on platform #71905

Merged

Conversation

ajreckof
Copy link
Member

@ajreckof ajreckof commented Jan 23, 2023

following #64021
related issue #64456 (Fix the issue but the issue is for 3.5 so not really a fix to this issue)

After a thorough check of all instances where CTRL is used(is_ctrl_pressed(),Key::CTRL and KeyModifierMask::CTRL) i have sorted the uses in multiple categories here in this PR are three categories where i think modifications should be done :

  • the first commit consist on modification that aims for better readibility and a clearer code. This is mostly replacing places where CMD_OR_CTRL was reimplemented on the fly and remove him from places where he was checked in conjonction with both CTRL and META
  • the second commit consist on modification that are needed because the use of CTRL is either preventing MacOS user from using the functionality or makes it inconsistent with either what is said or what is already done else where.
  • the last commit is about modified actions for dropping when CTRL is pressed. This functionality is used consistently with ctrl but on mac. it seems CMD would be more appropriate especially since you might start pressing the modifier button when starting to drag.

There are a few other places where CTRL is used and i think it should stay like this but i'm not entirely sure see here for all places:

  • snapping : it is pretty clear when you press control it activates a snap. I think it should stay as CTRL but this is the one i'm the least sure of.
  • zoom with CTRL+ SCROLL: when scrolling pressing CTRL will enables you to zoom. This is better as CTRL as this is fundamentally not a MacOS way to do it. Therefore even on mac if i think of doing it i would use CTRL as if i was on a windows.
  • one case where pressing control would switch between scroll and pan movements. I was not sure about this one but it seemed similar to zooming as i would look for CTRL instead of CMD

The problem here is that i currently have only my experience and what feels right to me. So i would really like the opinion of other MacOS users on the subject.

Left to do (maybe another PR):

  • check all documentation linked to CMD_OR_CTRL to add it is CMD if it is not already done (edit : did everything in the editor part might do the documentation part later)
  • rename is_command_or_control_pressed() to is_cmd_or_ctrl_pressed()to be more in line with other similar functions (is_ctrl_pressed())

@@ -282,7 +282,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
if (mode == MODE_EDIT || (_is_line() && mode == MODE_CREATE)) {
if (mb->get_button_index() == MouseButton::LEFT) {
if (mb->is_pressed()) {
if (mb->is_ctrl_pressed() || mb->is_shift_pressed() || mb->is_alt_pressed()) {
if (mb->is_command_or_control_pressed() || mb->is_shift_pressed() || mb->is_alt_pressed()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, the check seems t be no modifiers, so it's probably should be ctrl || meta || shift || alt.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are totally right went a bit too quick on this one because you can't access it without click left mouse button. Gonna modify it.

@@ -215,7 +210,7 @@ void EditorSpinSlider::_value_input_gui_input(const Ref<InputEvent> &p_event) {
}
}

if (k->is_ctrl_pressed()) {
if (k->is_command_or_control_pressed()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While checking all of the modifications. I realized that this case is totally a case of snaping. I had put it on CMD_OR_CTRL as tooltip already said you should use command even though you had to press ctrl in fact. I'm wondering if i should remove it and move it back to CTRL or if it is a sign cmd should be used for snapping.

@ajreckof ajreckof force-pushed the change_CTRL_for_command_or_control branch from 139a02c to 3b8a29e Compare January 27, 2023 04:13
@akien-mga akien-mga modified the milestones: 4.0, 4.x Feb 10, 2023
@ajreckof ajreckof force-pushed the change_CTRL_for_command_or_control branch 4 times, most recently from 81596e5 to bf31c21 Compare February 15, 2023 15:26
@ajreckof ajreckof requested a review from a team as a code owner February 15, 2023 15:26
@ajreckof ajreckof force-pushed the change_CTRL_for_command_or_control branch from bf31c21 to d05cbb7 Compare February 15, 2023 15:42
@ajreckof ajreckof force-pushed the change_CTRL_for_command_or_control branch 3 times, most recently from 0022592 to 2c84ebb Compare March 3, 2023 19:29
@ajreckof ajreckof force-pushed the change_CTRL_for_command_or_control branch 2 times, most recently from 116eb5d to 805a914 Compare March 4, 2023 03:27
@ajreckof ajreckof force-pushed the change_CTRL_for_command_or_control branch 2 times, most recently from 07e70d6 to da3d1dc Compare June 8, 2023 22:54
@ajreckof
Copy link
Member Author

ajreckof commented Jun 8, 2023

Finally took the time to update this PR so it is up to date. This fix a loot of places where you had to press ctrl instead of command in MAcOS which was inintuitive and in more than half the case just impossible. Most of those bug are not reported or reported for 3.x as most of them were already present in 3.x

@akien-mga akien-mga requested a review from bruvzg June 9, 2023 06:58
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on Linux (rebased on top of master 6758a7f), it works as expected. This needs to be rebased though.

The list of keys changed seems logical to me.

Also, please amend the commit message to follow existing style:

Replace Ctrl in editor shortcuts with Cmd or Ctrl depending on platform

@ajreckof ajreckof force-pushed the change_CTRL_for_command_or_control branch 2 times, most recently from 23945c2 to c1013cc Compare September 7, 2023 12:30
@akien-mga akien-mga changed the title Change ctrl for command or control Replace Ctrl in editor shortcuts with Cmd or Ctrl depending on platform Sep 7, 2023
@akien-mga akien-mga modified the milestones: 4.x, 4.2 Sep 7, 2023
@akien-mga
Copy link
Member

CC @bruvzg

@ajreckof ajreckof force-pushed the change_CTRL_for_command_or_control branch from c1013cc to 6afadba Compare September 19, 2023 08:29
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me overall.

@akien-mga akien-mga merged commit bfcfa10 into godotengine:master Sep 20, 2023
16 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants