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

[keyname] reports some key events inconsistently (differently on different platforms) #773

Open
reduzent opened this issue Oct 8, 2019 · 10 comments

Comments

@reduzent
Copy link
Contributor

commented Oct 8, 2019

Trying to implement patches with keyboard control revealed some issues with [keyname]. Some modifier key events are reported inconsistently:

Problems found on LInux (tested on Ubuntu 18.04 with Pd 0.50.1):

  • RIght Alt key reports name 'ISO_Level3_Shift' when pressed, but '??' when released
  • Pressing and releasing left Alt key reports the name 'Alt_L', but 'Meta_L' while any Shift key is pressed. This leads to hanging a 'Alt_L' key when this sequence is pressed:
    1. Press 'Alt_L'
    2. Press any Shift
    3. Release 'Alt_L'
    4. Release 'Shift'
  • While 'Alt_L' is pressed, key down events of other modifier keys such as Shift_L, Shift_R, Control_L, Control_R are suppressed while key up events of those keys are still reported.

Problems found on WIndows (tested with Pd 0.50.1 under Wine [and WIndows 10]):

  • 'Alt_L' is not reported at all (probably caught by GUI)
  • Pressing 'Shift_R' correctly reports the name 'Shift_R', but when releasing the name 'Shift_L' is reported, leading to a hanging 'Shift_R' key.
  • As in Linux, keeping 'Alt_L' pressed suppresses key down events of other modifier keys. Only key up events are reported then.

I haven't had access to Macs, so I don't have any reports from macOS.

@reduzent

This comment has been minimized.

Copy link
Contributor Author

commented Oct 8, 2019

Attached patch makes testing a bit easier.
keyname-test.zip

@umlaeute

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2019

oh noes.
more consistent keyreporting was the main motivation for the new implementation, that as a side effect triggered the 0.50-1 and 0.50-2 bugfix releases.

however, i think most of the issues you are seeing are really problems of tcl/tk resp its interaction with the underlying windowing system.

@umlaeute

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2019

also: is this a regression to previous Pd releases or do you notice an improvement?

@reduzent

This comment has been minimized.

Copy link
Contributor Author

commented Oct 9, 2019

I don't know. I only started to get interested in this very recently. I can test previous Pd versions to know whether there are any regressions compared to earlier versions. What versions would make sense to compare to?

It could well be that Tk is wrongly reporting the key events. If that's the case and the issue is not easily fixable, another approach might be to just skip the problematic keys. I don't know what is more important: getting the correct platform specific behavior, or: consistent behavior across platforms.

My goal is to write patches that implement key commands, also by using modifier keys. Currently, only Shift_L and Control_L seem reliable to use. It's not that big of an issue, it's more that when you use other keys, it screws up your commands and depending on platform, the behavior is different.

@umlaeute

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2019

@umlaeute

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2019

for comparing older versions: the relevant changes happened between 0.49 and 0.50

@HenriAugusto

This comment has been minimized.

Copy link

commented Oct 10, 2019

  • Pressing 'Shift_R' correctly reports the name 'Shift_R', but when releasing the name 'Shift_L' is reported, leading to a hanging 'Shift_R' key.

Just for the sake of information: this also happens for me on Windows 7 and it seems it's a tk/tcl problem

image

@reduzent

This comment has been minimized.

Copy link
Contributor Author

commented Oct 11, 2019

Regarding regressions, I wasn't able to detect any since 0.49-0 with the Shift, Control and Alt keys. On Linux, 0.49-0 behaves the same as 0.50-2. On Windows, the situation even improved at Control_R being reported correctly in both, up and down events. On Windows with 0.49-0, the key down event of the Control_R key is reported as Control_L.

@reduzent

This comment has been minimized.

Copy link
Contributor Author

commented Oct 11, 2019

Where is the related code in Pd? Would it make sense to just disable keys that can't be reported correctly? I interpret HenriAugusto's findings so as things can't easily be fixed on the Pd side, as long as Tk is reporting events wrongly.

Has someone tested the test patch on macOS?

@umlaeute

This comment has been minimized.

Copy link
Contributor

commented Oct 14, 2019

all the related Pd-code is in https://github.com/pure-data/pure-data/blob/d8d637b6c53833c49c47c60ff78e3fbfd0d596c7/tcl/pd_bindings.tcl

i don't think we should disable those keys (they might still be useful, although probably not as useful as they could be)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.