Fix window show/hide on desktop being incorrectly considered the same as app going into and out of the background/suspend on mobile

The app's Timers should still continue when a window is hidden. Especially since an app could have multiple windows, with some being shown and some being hidden. If only one were hidden, the other shown windows would clearly behave in a broken manner because the one hidden window would cause all app timers, even those associated with other windows, to be paused.

Introduces new WINDOW_SHOW AND WINDOW_HIDE events from C++ to Haxe, and new onShow and onHide events on Haxe Window.

Followup to 0918ee2381
This commit is contained in:
Josh Tynjala
2023-06-06 10:53:45 -07:00
parent f6e61b1bac
commit aebf139dc7
4 changed files with 14 additions and 16 deletions

View File

@@ -25,6 +25,8 @@ namespace lime {
WINDOW_MOVE,
WINDOW_RESIZE,
WINDOW_RESTORE,
WINDOW_SHOW,
WINDOW_HIDE
};

View File

@@ -764,14 +764,9 @@ namespace lime {
switch (event->window.event) {
case SDL_WINDOWEVENT_SHOWN: windowEvent.type = WINDOW_ACTIVATE; break;
case SDL_WINDOWEVENT_SHOWN: windowEvent.type = WINDOW_SHOW; break;
case SDL_WINDOWEVENT_CLOSE: windowEvent.type = WINDOW_CLOSE; break;
case SDL_WINDOWEVENT_HIDDEN:
inBackground = true;
windowEvent.type = WINDOW_DEACTIVATE;
break;
case SDL_WINDOWEVENT_HIDDEN: windowEvent.type = WINDOW_HIDE; break;
case SDL_WINDOWEVENT_ENTER: windowEvent.type = WINDOW_ENTER; break;
case SDL_WINDOWEVENT_FOCUS_GAINED: windowEvent.type = WINDOW_FOCUS_IN; break;
case SDL_WINDOWEVENT_FOCUS_LOST: windowEvent.type = WINDOW_FOCUS_OUT; break;
@@ -801,15 +796,6 @@ namespace lime {
windowEvent.windowID = event->window.windowID;
WindowEvent::Dispatch (&windowEvent);
switch (event->window.event) {
case SDL_WINDOWEVENT_SHOWN:
inBackground = false;
break;
}
}
}