Re: [hatari-devel] Keyup bug in SDL GUI |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Keyup bug in SDL GUI
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Wed, 2 Nov 2022 17:42:37 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1667410959; bh=qavFeHPC1HCpqoqDfHuq6rHDht6RqEGZpF5rdN0qxUE=; h=Date:From:To:Subject:From; b=oiG1d/FFbpgty3NCrNj3I84XsoHbMV3+NGs2mNPXVnFM4L2i5G+BNjwDLha92C/bW gvAAAlCBADCqTHCzVJm/N93dRZyuNHIJbuQ2uMqg1ArTzMJ/Gk2UJR0w7uqLfAv0BM zxGFLmHcByb1c/sU3jceSS1+M3oByBv3PxmXJia3xdf9kQFUSd1fOEZtg+9WnsTWKX h+ARpCrDTyKrsX4YK7mNOTnMrEDruhCp/LCZItRvZArsXe3TK2+Z8kgZ/FaKRxdQbY LQawqSIipusSHNeZRarpKBf9DDFV1mlCrrMLT7F0OtyGqY4aIY4AxwGoIGT/JBF5lC iyVkOQYpAjL5Q==
Am Wed, 2 Nov 2022 10:06:50 +0100
schrieb Andreas Grabher <andreas_g86@xxxxxxxxxx>:
> > Am 31.10.2022 um 19:48 schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:
> >
> > Hi,
> >
> >> On 31.10.2022 20.35, Andreas Grabher wrote:
> >> I might have found a bug in the SDL GUI. This scenario:
> >> In the guest operating system I confirm some action by pressing enter
> >> —> SDL_KEYDOWN with SDLK_RETURN
> >> Due to some bug in the OS I get a double fault, which then activates Dialog_HaltDlg() before I am able to release the key
> >> I then release the key
> >> —> SDL_KEYUP with SDLK_RETURN
> >> At this time we are already in the SDL_WaitEvent()-Loop in SDLGui_DoDialogExt() and the event is recognized as key up in the GUI. This leads to automatically pressing the default button which exits the dialog without me having a chance to select anything.
> >> Can you confirm this? This will be difficult to fix.
> >
> > You can wait until all keys are up, before starting accepting input in SDL GUI.
> >
> > No notify user about this wait, you can show a note about keys being down in statusbar.
> >
> > If SDL does not provide information about pressed keys, keymap.c keeps count of them.
> >
> >
> > - Eero
> >
> Maybe calling SDL_ResetKeyboard() before entering the SDL_WaitEvent()-loop would be the solution?
I don't think this would be the right fix - in case you still hold the key
when the SDL_ResetKeyboard() is done, you still get the KEYUP event
afterwards once the key is released. I think you have to something like
this (untested):
const Uint8 *keys = SDL_GetKeyboardState();
while (keys[SDLK_RETURN])
SDL_PumpEvents();
HTH,
Thomas