kxgames / glooey

An object-oriented GUI library for pyglet.
MIT License
91 stars 6 forks source link

Double key press events on MacOS #18

Closed jonwfreeman closed 6 years ago

jonwfreeman commented 6 years ago

On MacOS (High Sierra), pressing the Enter key inside an EditableLabel generates two key press events, one with RETURN and one with ENTER. As a result, cross-platform logic to determine whether to unfocus on enter, etc. has to look like "if symbol in {pyglet.window.key.RETURN, pyglet.window.key.ENTER}: ..." .

Apologies for the noise if this is actually expected behavior on MacOS.

I appreciate that this might be an issue with pyglet rather than glooey, in which case I am requesting a workaround in EditableLabel. If there is no sufficiently clean workaround then I suppose this issue should be raised with pyglet and closed here.

Regards, Jon

benmoran56 commented 6 years ago

Hi Jon,

Does MacOS High Sierra emit both a RETURN and ENTER event now, just in general? In pyglet, these are listed as the same event ID.

....
RETURN        = 0xff0d
ENTER         = 0xff0d      # synonym
....
jonwfreeman commented 6 years ago

Hi Ben, I upgraded pyglet to 1.3.2 (from 1.3.0), ensured I was on the very latest MacOS version (10.13.5, i.e. High Sierra), and then tried to reproduce this problem (in Python 3.6.3) but was unable to do so. I am therefore closing this issue. Regards, Jon