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

Fix plus keybind on Mac #2987

Merged
merged 1 commit into from
Dec 15, 2023
Merged

Fix plus keybind on Mac #2987

merged 1 commit into from
Dec 15, 2023

Conversation

NeeEoo
Copy link
Contributor

@NeeEoo NeeEoo commented Dec 15, 2023

This allows pressing + on Mac. Might only work for Swedish Mac keyboards since i don't have a english keyboard

@Geokureli
Copy link
Member

Geokureli commented Dec 15, 2023

Looks like swedish keyboards have a different layout, FlxKeys do not map to characters, they map to keyboard button locations which are labelled based on their location in the english keyboard layout, your PLUS key seems to be ` or '

Swedish:
image

English:
image

@Geokureli Geokureli closed this Dec 15, 2023
@NeeEoo
Copy link
Contributor Author

NeeEoo commented Dec 15, 2023

I don't see why it would be closed, the ascii code 43 means +

And i got 0_43 when i traced the values i got directly

@Geokureli
Copy link
Member

Geokureli commented Dec 15, 2023

FlxKeys do not map to characters, they map to keyboard button locations which are labelled based on their location in the english keyboard layout

Also, my + key works fine on mac targets as well as all other targets, I suspect the issue is that your keyboard moves keys around, meaning this change would break non-swedish keyboard layouts

@NeeEoo
Copy link
Contributor Author

NeeEoo commented Dec 15, 2023

What mac do you have?

@Geokureli
Copy link
Member

@NeeEoo
Copy link
Contributor Author

NeeEoo commented Dec 15, 2023

I mean mac model, because it worked when i had a 2017 model, but not my 2023 model

@Geokureli
Copy link
Member

I do have a 2017, but then would this change break plus on 2017s

@NeeEoo
Copy link
Contributor Author

NeeEoo commented Dec 15, 2023

It wouldnt break, pressing plus there would return a different keycode, which would return the key 61_187 which has no nativeCorrection mapping which then makes it point to FlxKey.PLUS (187) due to the code below

var code = _nativeCorrection.get(e.charCode + "_" + e.keyCode);
return (code == null) ? e.keyCode : code;

this pr is only if the key returns 0_43

@Geokureli
Copy link
Member

Geokureli commented Dec 15, 2023

aight let's test this, sorry for the misunderstanding

Edit: if I were to find someone with a 2023 mac with an English keyboard layout, how would I have them test this?

Edit2: Can you try this out using the virtual keyboard set to the English layout:
https://support.apple.com/guide/mac-help/use-the-keyboard-viewer-on-mac-mchlp1015/mac
https://support.apple.com/guide/mac-help/write-in-another-language-on-mac-mchlp1406/14.0/mac/14.0

@Geokureli Geokureli reopened this Dec 15, 2023
@NeeEoo
Copy link
Contributor Author

NeeEoo commented Dec 15, 2023

I just placed a trace here to get the value

Skärmavbild 2023-12-15 kl  18 08 44

trace(e.charCode + "_" + e.keyCode);

And it does work with setting the layout to US and pressing the ` key it returns the code 61_187

@Geokureli
Copy link
Member

And it does work with setting the layout to US and pressing the key it returns the code61_187`

what if you press +?

@NeeEoo
Copy link
Contributor Author

NeeEoo commented Dec 15, 2023

When i said i pressed the ` button, that is the key which is equal to + when im on us keyboard layout

@Geokureli
Copy link
Member

Geokureli commented Dec 15, 2023

When i said i pressed the ` button, that is the key which is equal to + when im on us keyboard layout

It is not, refer back to the pictures I sent, plus is typically on the = key. Also please verify that you can change the volume with the + (=) key in a flixel game using this branch

@NeeEoo
Copy link
Contributor Author

NeeEoo commented Dec 15, 2023

Pressing the + (=) key on us keyboard layout still works with this branch

@Geokureli Geokureli merged commit 24db046 into HaxeFlixel:dev Dec 15, 2023
30 checks passed
@Geokureli
Copy link
Member

thanks!

Geokureli added a commit that referenced this pull request Dec 15, 2023
@Geokureli Geokureli added this to the 5.6.0 milestone Jan 4, 2024
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.

2 participants