-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Made serialization of Command toggleable when saving InputEvents. #43662
Made serialization of Command toggleable when saving InputEvents. #43662
Conversation
Could you add documentation in |
The code changes are fine, and if @reduz agreed with them we could merge already, but I'd like to take the opportunity to discuss the IMO confusing unions that we use on Apple/non-Apple in this class: godot/core/input/input_event.h Lines 208 to 226 in 2ca1c17
First the comments are buggy - we shouldn't allow @reduz to write trailing comments as he always just copy pastes lines without ever editing comments :P So what we have currently is:
Then we use Command as "main" modifiers for the typical Ctrl+C / Cmd+C types of shortcuts. I understand why we do it this way but IMO it's pretty confusing, and I wonder if there couldn't be a better solution. One option could be to introduce an intermediate representation for what "Ctrl on PC and Cmd on Mac" should be (let's say The rest would stay exposed as what they are:
|
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.
This PR should do the job, but I do not think it's in intuitive for the users. At least adding some not to the description of the InputEvent docs would be nice.
37ecab2
to
e71b094
Compare
So I added some doco... surprisingly difficult to write since this 'feature' needs to be added because of of something that is hidden from the user (the unions in InputEventWithModifiers). So you are kind of saying "this is here as a workaround of something you dont know about." |
I am ok with the feature for now, but yeah, I agree the situation is not ideal. :/ My only concern for now is the function naming, I think it's not explicit enough on what it does. |
Yeah that's why I'm suggesting reworking all this. Writing documentation forced you to expose this hack of a hacky interface as what it is ;) For anyone interested, we discussed this further on IRC at length: https://freenode.logbot.info/godotengine-devel/20201119#c5881618-c5882583 If there's interest I may formalize all this in a proper proposal. (This shouldn't prevent merging this PR in the meantime to workaround the current limitation.) |
It would be ideal to revisit this asap while it is fresh in our minds. |
Made serialization of Command optional. If command is serialized, Control (On Win/Linux) or Meta (on Mac) are not. Example use case: You are on Windows and you set a shortcut to be Control + E. This would serialize as Command=true and Control=true. If you then run this project on Mac, you would need to press Command AND Control to activate the shortcut - which is not what is intended. Now, you can set store_command to true, and it will only serialize to Command = true (no Control serialized). On Windows, this means Control. On Mac, it means only command.
c5caddf
to
c92f83d
Compare
Yeah I agree the name is not the clearest. Aside from that I think the PR is good to go. |
Further discussion on naming: https://freenode.logbot.info/godotengine-devel/20201119#c5883844-c5883935 Let's go with this. |
Thanks! |
Made serialization of Command optional. If command is serialized, Control (On Win/Linux) or Meta (on Mac) are not.
Example use case: You are on Windows and you set a shortcut to be Control + E. Currently, this would serialize as Command=true and Control=true. If you then run this project on Mac, you would need to press Command AND Control to activate the shortcut - which is not what is intended. Now, you can set store_command to true, and it will only serialize to Command = true (no Control serialized). On Windows, this means Control. On Mac, it means only command.
This was discussed at length with Reduz on IRC, and he seemed happy with this solution. Closes #42351 in some ways... but doesn't fully close it until a UI is created to actually change this option in the editor.
This is the third PR of a larger series based on #42600. In this PR, there is no UI to allow users to edit this setting. This comes in a later PR. This is the InputEvent implementation only.