Add macos flush specific fix

Taken from @mathewmariani lite-macos
This commit is contained in:
Francesco Abbate 2021-04-21 09:51:40 +02:00
parent 80192573da
commit 1f6680b492
1 changed files with 10 additions and 0 deletions

View File

@ -155,6 +155,16 @@ top:
return 2;
case SDL_KEYUP:
#ifdef __APPLE__
/* on macos command+w will close the current window
** we want to flush this event and let the keymapper
** handle this key combination.
** Thanks to mathewmariani, taken from his lite-macos github repository. */
if ((e.key.keysym.sym == SDLK_w) && (e.key.keysym.mod & KMOD_GUI))
{
SDL_FlushEvent(SDL_QUIT);
}
#endif
lua_pushstring(L, "keyreleased");
lua_pushstring(L, key_name(buf, e.key.keysym.sym));
return 2;