[Scummvm-tracker] [ScummVM] #9617: Alt+Enter and other hotkeys are too sensitive
Ori Avtalion
trac at scummvm.org
Mon Oct 17 20:14:43 CEST 2016
#9617: Alt+Enter and other hotkeys are too sensitive
------------------------+-----------------------
Reporter: salty-horse | Owner:
Type: defect | Status: new
Priority: normal | Component: --Unset--
Keywords: | Game:
------------------------+-----------------------
This is on Linux. Bug #9563 seems to describe totally different behavior
on Windows/OSX.
When I use either the SDL or OpenGL backends, pressing alt+enter will
toggle the fullscreen setting several times, instead of just once. As long
as alt+enter is held, it will keep toggling it. Even when I release ENTER
very quickly, it still manages to toggle it a few times.
This is bad. I would expect that if alt+enter is held, nothing will
happen. It should only allow the next toggle after ENTER is released and
then pressed again (assuming ALT is held).
While investigating this I noticed that when we change resolutions, SDL
sends a KEYUP event for keys that are currently held down.
This means that pressing and holding ALT+ENTER for a moment will override
any key delay code we have (where?) and call it several times. It also
happens with CTRL+ALT+a which toggles aspect ratio.
It does not happen with CTRL+ALT+f which toggles filtering. If you press
that combination for a long time it will only toggle it a single time
until you let go of 'F' and press it again.
Why is this happening?
This errant KEYUP event prevents any hacks around this problem. For
example, I tried writing a hack to the SDL backend's handling of the
fullscreen toggle to only allow it again once the enter key is released
and pressed a second time. (See attachment). It works fine when I comment
out `toggleFullScreen`, but the toggle actually happens, SDL (in
`SdlEventSource::handleKeyUp`) sends a KEYUP event for ENTER without me
having released it.
Besides alt+enter, this behavior should also be implemented to the
alt+ctrl+PLUS/MINUS that cycle between the scalers, and arguably for Alt+S
which takes a screenshot. I wouldn't want to hold alt+s for a moment too
long and take many screenshots. Any other relevant hotkeys I'm missing?
Besides the SDL graphics backend, this should be implemented in the OpenGL
backend. Their input-handling code has some similarities. Could they be
merged?
A related topic that I hope someone clarifies:
ScummVM's keyboard events implement a 'repeat' flag, called 'synthetic',
but it isn't set if I hold alt+enter. I couldn't quite figure out how it
works. It seems to trigger only when the event queue is empty - but what
prevents SDL from sending repeated KEYDOWN events if a key is continuously
pressed?
--
Ticket URL: <https://bugs.scummvm.org/ticket/9617>
ScummVM <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list