-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Add Key::CTRL_OR_CMD
and use it to fix shortcut for tilemap painting tools on macOS
#64021
Add Key::CTRL_OR_CMD
and use it to fix shortcut for tilemap painting tools on macOS
#64021
Conversation
d1a3ef5
to
6b124e2
Compare
Bump @groud :) |
cc @bruvzg as they did some recent working on keyboard/input stuff. Not sure if there is a better way of doing this. On the |
|
What would be the difference from PR seems fine, but I would rename |
Ah I forgot that we don't distinguish between left/right modifier keys. I also thought it might be helpful as a way to check if |
6b124e2
to
d994f77
Compare
Just made the changed based on what was discussed here without changing what was done on the bottom. Changed the name of the |
d994f77
to
7383f36
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! There might be more areas in the engine using Input::get_singleton()->is_key_pressed(Key::CTRL)
which may benefit from this change.
I'll look into it. Do you think i should create a new pull request or should i add to this one and rename it ? |
I have already found at least (still going through all occurences of calling I think after i am done with the |
7383f36
to
44af893
Compare
…RL prevented the use of the functionality on mac on Mac CTRL + Left click = Right click therefore when a functionality needs CTRL + Left click it is not possible on mac. It then forcibly needs to be CMD on mac
44af893
to
fa528b8
Compare
@@ -1897,7 +1897,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) { | |||
Transform2D simple_xform = (viewport->get_transform() * unscaled_transform).affine_inverse() * transform; | |||
|
|||
bool uniform = m->is_shift_pressed(); | |||
bool is_ctrl = Input::get_singleton()->is_key_pressed(Key::CTRL); | |||
bool is_ctrl = m->is_ctrl_pressed(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be CTRL or CMD_OR_CTRL here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctrl works fine here as you are already dragging when pushing the control button. I just changed it to the event key modifier as it was more in sync with the other declaration just above and there was no reason to call the Input Singleton.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works, but is it what makes sense semantically? Usually Ctrl being used as modifier on Windows/Linux is intended to be Command on macOS, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the time tes but not always more over something have been Cyril for a long time on Godot so people might have already learned it is Godot so I think for now if it is not causing a bug we should not address it right and open an issue to discuss we want to get rid and of all of them / most of them but keep some edge case.
I think also we might want to discuss wether we would like to add a warning when is_ctrl_pressed
is used for people not on a mac to understand it is most likely not what they want to use (if there is a way to disable warning for a line)
I think I will be opening an issue that details everything that I found when I'm done looking through all the is_ctrl_pressed
. There are around 50 of them so it might take me a week or so. As I can see it most use cases can be summarised in a few groups. I think those groups should be moved out from ctrl to command but some edge case might better to keep on ctrl.
Key::CTRL_OR_CMD
and use it to fix shortcut for tilemap painting tools on macOS
Thanks! |
Fixes #64017
first add CMD as a Key the same way CMD as been added to KeyModifiersMask
Then replace all KEY::CTRL by KEY::CMD