Merge remote-tracking branch 'myk002/myk_alt_tab_modstate' into develop

develop
lethosor 2021-08-08 11:13:52 -04:00
commit 4d103dc546
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
2 changed files with 13 additions and 3 deletions

@ -36,6 +36,9 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## New Plugins ## New Plugins
- `dig-now`: instantly completes dig designations (including smoothing and carving tracks) - `dig-now`: instantly completes dig designations (including smoothing and carving tracks)
## Fixes
- Core: ``alt`` keydown state is now cleared when DF loses and regains focus, ensuring the ``alt`` modifier state is not stuck on for systems that don't send standard keyup events in response to ``alt-tab`` window manager events
## Misc Improvements ## Misc Improvements
- `tiletypes-here`, `tiletypes-here-point`: add --cursor and --quiet options to support non-interactive use cases - `tiletypes-here`, `tiletypes-here-point`: add --cursor and --quiet options to support non-interactive use cases

@ -2472,13 +2472,20 @@ int UnicodeAwareSym(const SDL::KeyboardEvent& ke)
//MEMO: return false if event is consumed //MEMO: return false if event is consumed
int Core::DFH_SDL_Event(SDL::Event* ev) int Core::DFH_SDL_Event(SDL::Event* ev)
{ {
//static bool alt = 0;
// do NOT process events before we are ready. // do NOT process events before we are ready.
if(!started) return true; if(!started) return true;
if(!ev) if(!ev)
return true; return true;
if(ev && (ev->type == SDL::ET_KEYDOWN || ev->type == SDL::ET_KEYUP))
if(ev->type == SDL::ET_ACTIVEEVENT && ev->active.gain)
{
// clear modstate when gaining focus in case alt-tab was used when
// losing focus and modstate is now incorrectly set
modstate = 0;
return true;
}
if(ev->type == SDL::ET_KEYDOWN || ev->type == SDL::ET_KEYUP)
{ {
auto ke = (SDL::KeyboardEvent *)ev; auto ke = (SDL::KeyboardEvent *)ev;