handle window focus (dont run fade and read while not focused)
Some checks are pending
ContinuousDelivery / linux-ubuntu (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousDelivery / windows (push) Waiting to run
ContinuousDelivery / windows-asan (push) Waiting to run
ContinuousDelivery / release (push) Blocked by required conditions
ContinuousIntegration / linux (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousIntegration / macos (push) Waiting to run
ContinuousIntegration / windows (push) Waiting to run

This commit is contained in:
Green Sky
2025-01-19 19:33:01 +01:00
parent bd6368a8f9
commit d416d3d595
6 changed files with 38 additions and 26 deletions

View File

@@ -328,6 +328,14 @@ bool MainScreen::handleEvent(SDL_Event& e) {
return true; // forward?
}
if (e.type == SDL_EVENT_WINDOW_FOCUS_GAINED) {
_window_focused = true;
}
if (e.type == SDL_EVENT_WINDOW_FOCUS_LOST) {
_window_focused = false;
}
if (
_fps_perf_mode <= 1 && (
// those are all the events imgui polls
@@ -391,7 +399,11 @@ Screen* MainScreen::render(float time_delta, bool&) {
si.render(time_delta);
const float cg_interval = cg.render(time_delta, _window_hidden); // render
if (_window_hidden && _window_focused) {
_window_focused = false;
}
const float cg_interval = cg.render(time_delta, _window_hidden, _window_focused); // render
sw.render(); // render
osui.render();
tuiu.render(); // render