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

refactored sendkeys to properly handle dead keys #736

Merged
merged 2 commits into from
Sep 12, 2019
Merged

Conversation

umlaeute
Copy link
Contributor

attempt on fixing the issue with not being able to type ~ character on portuguese/brazil keyboard layouts.

this still requires testing!

Closes: #732

@umlaeute umlaeute added bug/fix either a bug (for issues) or a bugfix (for pull-requests) regression for problems that did not exist in previous releases subject:GUI things concerning the GUI side labels Aug 29, 2019
@HenriAugusto
Copy link
Contributor

Dead keys are working now. When you press them twice it appears two of them (which is what actually happen throghout windows so it seems correct)

It is a bit annoying though having to type ~~ and then BackSpace everytime you want to input a single ~. For that reason i would add an ad_hoc solution to the new code to only output a single ~. It's way more convenient since ~ plays a special role in PD.

In the case of not coding this ad_hoc solution for ~~ i would at least write in the release notes of the new version that you can output a single ~ by pressing ~+Space. Everyone i knew just used ~ twice. Almost nobody here know about the DeadKey+Space combo heh :)

@umlaeute
Copy link
Contributor Author

In the case of not coding this ad_hoc solution for ~~ I would at least write in the release notes of the new version that you can output a single ~ by pressing ~+Space.

but that's simply not true for the majority of users.
it's only true for users with keyboard layouts where the ~-key is used as diacritic and therefore set as a dead key.

we could add a release note telling people that dead-keys are finally fixed, and if they need to type them, they should type them as in any other application :-)

otoh, who ever reads release-notes?

@millerpuckette
Copy link
Contributor

I had already put on a band-aid here: 65d1dcb
(just now pushed to github) - it seems to manage the immediate problem at least. Maybe that will suffice for 0.50-1 and this nice complicated rewrite should wait for 0.51?

@HenriAugusto
Copy link
Contributor

it's only true for users with keyboard layouts where the ~-key is used as diacritic and therefore set as a dead key.

I may be missing something but can't we check if we received a ~~ and change it to ~ only in this special case? I can't imagine any case where someone would actually type two tildes but typing a single one is bread and butter. And if someone, with a US kbd for example, sent a single ~ it would pass untouched.

But it is just a Quality-of-life suggestion anyway.

otoh, who ever reads release-notes?

I do 🤓. Some people don't but it was an idea for a "courtesy" of letting at least the ones who read them know.

Btw do we have testers with spanish/french/etc keyboards? I figure their keyboard works in a similar fashion but i've never actually used them.

@Lucarda
Copy link
Contributor

Lucarda commented Sep 1, 2019

Btw do we have testers with spanish/french/etc keyboards?

Tilde "~" is a no-go for the Spanish layout (even the Latin American variant). I can’t get it in any app unless I do ALT+126 (on Windows).
On my translation of Kreidler’s tutorial I suggest people to switch to the US-layout when using Pd.

@Spacechild1
Copy link
Contributor

Spacechild1 commented Sep 1, 2019

I can’t get it in any app unless I do ALT+126 (on Windows).

ouch... maybe we can add a possibility for people to set their own shortcut for the tilde symbol? I know there are ways to do this system wide, but it's not straightforward (at least on Windows)

@millerpuckette
Copy link
Contributor

Can you try msp.ucsd.edu/tmp/pd-tmp.msw.zip ? It should work on Portuguese (and I think Spanish)
keyboards that you can hit the "~" modifier twice to type a tilde character into Pd.

@Lucarda
Copy link
Contributor

Lucarda commented Sep 1, 2019

Can you try msp.ucsd.edu/tmp/pd-tmp.msw.zip ? It should work on Portuguese (and I think Spanish)...

Didn't work for me with the "Spanish" layout (Alt Gr + 4 , space). With the "Spanish Latin American" variant is a no-go across all apps.

It only works for me with this PR by @umlaeute and the "Spanish" layout (Alt Gr + 4 + space).

@millerpuckette
Copy link
Contributor

OK, I just loaded up the Spanish (espana) layout and can confirm I can't type a tilde. #$&^%ing hell... will look at what tcl/tk is seeing and see if I can work around it

@millerpuckette
Copy link
Contributor

(I don't really think alt-gr-4 + space is intuitive :)

@danomatika danomatika removed their request for review September 1, 2019 23:26
@Lucarda
Copy link
Contributor

Lucarda commented Sep 1, 2019

(I don't really think alt-gr-4 + space is intuitive :)

Yes but it had always been like that (there is no regression for people with the Spanish layout).
It is really easy to add a keyboard layout in windows and switch to the US layout when using Pd.
This is what I had always suggested for readers of Kreidler’s tutorial. One of the very few out there in Spanish and it has considerable traffic. I know because the translation is hosted on my server. So people had always been aware of the "~" thing.

@umlaeute
Copy link
Contributor Author

umlaeute commented Sep 2, 2019

I did some Windows10 tests with Spanish keyboard layouts, running in a VM (which runs on a Debian machine, that has a German keyboard (and according keyboard layout) attached to it):

This is what i get in notepad++ (so i assume all "proper" applications behave like this):

  • Spanish (United States): AltGr++ (the + is located left of the , first row)
  • Spanish (Latin America): AltGr++ (as above)
  • Spanish (Spain): AltGr+4-Space
    I don't think this is "totally unintuitive", given that on a spanish keyboard, the 4-key is marked with a ~ as the third (AltGr-) option.

Testing with Pd I get:

  • AltGr++ (for Spanish (US) and Spanish (Latin America) works on Pd-0.49-0, Pd-0.50-0test1, and (Pd-0.50-0-test1) with this PR.
  • AltGr+4-Space (for Spanish (Spain)) works with Pd-0.49-0 and this PR. However, it does not work on Pd-0.50-0test1

I did not test 65d1dcb.

Note: I've also tested AltGr++ using the Spanish (US) layout on a real Windows10 machine (not VM). Nevertheless the keyboard hardware used was still a German keyboard, which has 105 keys.

dropping miller's hack to make Pd work on Portuguese keyboards (65d1dcb)
@Lucarda
Copy link
Contributor

Lucarda commented Sep 2, 2019

@umlaeute I can confirm all your test on a Win8.1 real machine. (my previous tests were wrong because I was using a Spanish variation instead of Latin American (this appear as an option once adding the spanish language.)

I can confirm 65d1dcb is not working (alt gr + 4 , space) in the Spanish layout (in this layout is a dead-key)

@umlaeute
Copy link
Contributor Author

umlaeute commented Sep 3, 2019

@Lucarda so does this mean that you have now found a way to type ~ without having to resort to ALT+126?

@umlaeute
Copy link
Contributor Author

umlaeute commented Sep 3, 2019

@millerpuckette since the problem affects portuguese, spanish and french (these i have confirmed) and probably others (which i have not confirmed), i don't think that the trivial hack in 65d1dcb suffices to fix the problem.

i'd suggest to either use "this nice complicated rewrite" or switch back to the ::pd_bindings::sendkey implementation as found in Pd-0.49-1.

switching back to the original implementation will of course revert to the old inconsistent behaviour between KeyPress and KeyRelease messages (which is what the new ::pd_bindings::sendkey implementation was trying to fix in the first place)

@Lucarda
Copy link
Contributor

Lucarda commented Sep 3, 2019

@Lucarda so does this mean that you have now found a way to type ~ without having to resort to ALT+126?

  • With "Spanish (Latin American)" is simply Alt Gr + +. This works on all Pd versions and was not affected because it is not a dead key.

  • With "Spanish (Spain)" the dead key Alt Gr + 4 , space was affected in Pd 0.50 but works with this PR.

@millerpuckette millerpuckette merged commit 052e7cf into master Sep 12, 2019
@millerpuckette
Copy link
Contributor

OK... I pulled my workaround and merged this. If it doesn't seem to be broken it will be time to put out 0.50-1 soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/fix either a bug (for issues) or a bugfix (for pull-requests) regression for problems that did not exist in previous releases subject:GUI things concerning the GUI side
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't input Tilde (~) character with pt-br keyboard
5 participants