Added in support for foreground and background events. (#1395)
This commit is contained in:
parent
449f7d66c3
commit
7ca0ec18ca
|
@ -1338,6 +1338,11 @@ function core.step()
|
|||
did_keymap = false
|
||||
elseif type == "mousemoved" then
|
||||
core.try(core.on_event, type, a, b, c, d)
|
||||
elseif type == "enteringforeground" then
|
||||
-- to break our frame refresh in two if we get entering/entered at the same time.
|
||||
-- required to avoid flashing and refresh issues on mobile
|
||||
core.redraw = true
|
||||
break
|
||||
else
|
||||
local _, res = core.try(core.on_event, type, a, b, c, d)
|
||||
did_keymap = res or did_keymap
|
||||
|
|
|
@ -358,6 +358,21 @@ top:
|
|||
lua_pushinteger(L, (lua_Integer)(e.tfinger.dy * h));
|
||||
lua_pushinteger(L, e.tfinger.fingerId);
|
||||
return 6;
|
||||
case SDL_APP_WILLENTERFOREGROUND:
|
||||
case SDL_APP_DIDENTERFOREGROUND:
|
||||
#ifdef LITE_USE_SDL_RENDERER
|
||||
rencache_invalidate();
|
||||
#else
|
||||
SDL_UpdateWindowSurface(window_renderer.window);
|
||||
#endif
|
||||
lua_pushstring(L, e.type == SDL_APP_WILLENTERFOREGROUND ? "enteringforeground" : "enteredforeground");
|
||||
return 1;
|
||||
case SDL_APP_WILLENTERBACKGROUND:
|
||||
lua_pushstring(L, "enteringbackground");
|
||||
return 1;
|
||||
case SDL_APP_DIDENTERBACKGROUND:
|
||||
lua_pushstring(L, "enteredbackground");
|
||||
return 1;
|
||||
|
||||
default:
|
||||
goto top;
|
||||
|
|
Loading…
Reference in New Issue