From 757bcbfc2e5e604c506dceca4bc41d6d88f7c510 Mon Sep 17 00:00:00 2001 From: asdqwe Date: Thu, 12 Dec 2024 17:53:03 -0300 Subject: [PATCH 1/4] Enable FLAG_WINDOW_ALWAYS_RUN by default on PLATFORM_DESKTOP_GLFW --- src/platforms/rcore_desktop_glfw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platforms/rcore_desktop_glfw.c b/src/platforms/rcore_desktop_glfw.c index 0d95cdd7..78a64b98 100644 --- a/src/platforms/rcore_desktop_glfw.c +++ b/src/platforms/rcore_desktop_glfw.c @@ -1341,6 +1341,9 @@ int InitPlatform(void) if ((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) glfwWindowHint(GLFW_FLOATING, GLFW_TRUE); else glfwWindowHint(GLFW_FLOATING, GLFW_FALSE); + // Enable FLAG_WINDOW_ALWAYS_RUN by default + if ((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) == 0) CORE.Window.flags |= FLAG_WINDOW_ALWAYS_RUN; + // NOTE: Some GLFW flags are not supported on HTML5 if ((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); // Transparent framebuffer else glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE); // Opaque framebuffer From 2da0f2ae4fb578072cce4b6eff64f941939142a6 Mon Sep 17 00:00:00 2001 From: asdqwe Date: Mon, 16 Dec 2024 22:46:06 -0300 Subject: [PATCH 2/4] Revert enabling FLAG_WINDOW_ALWAYS_RUN by default on PLATFORM_DESKTOP_GLFW --- src/platforms/rcore_desktop_glfw.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/platforms/rcore_desktop_glfw.c b/src/platforms/rcore_desktop_glfw.c index 78a64b98..0d95cdd7 100644 --- a/src/platforms/rcore_desktop_glfw.c +++ b/src/platforms/rcore_desktop_glfw.c @@ -1341,9 +1341,6 @@ int InitPlatform(void) if ((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) glfwWindowHint(GLFW_FLOATING, GLFW_TRUE); else glfwWindowHint(GLFW_FLOATING, GLFW_FALSE); - // Enable FLAG_WINDOW_ALWAYS_RUN by default - if ((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) == 0) CORE.Window.flags |= FLAG_WINDOW_ALWAYS_RUN; - // NOTE: Some GLFW flags are not supported on HTML5 if ((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); // Transparent framebuffer else glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE); // Opaque framebuffer From 7bfa8786fc9ddce24a461f6a5cb97eb79c93b428 Mon Sep 17 00:00:00 2001 From: asdqwe Date: Mon, 16 Dec 2024 22:48:47 -0300 Subject: [PATCH 3/4] Add implementation for FLAG_WINDOW_ALWAYS_RUN on PLATFORM_DESKTOP_SDL --- src/platforms/rcore_desktop_sdl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index b7f00bc7..493f315d 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -571,7 +571,7 @@ void SetWindowState(unsigned int flags) } if (flags & FLAG_WINDOW_ALWAYS_RUN) { - TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_ALWAYS_RUN is not supported on PLATFORM_DESKTOP_SDL"); + CORE.Window.flags |= FLAG_WINDOW_ALWAYS_RUN; } if (flags & FLAG_WINDOW_TRANSPARENT) { @@ -658,7 +658,7 @@ void ClearWindowState(unsigned int flags) } if (flags & FLAG_WINDOW_ALWAYS_RUN) { - TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_ALWAYS_RUN is not supported on PLATFORM_DESKTOP_SDL"); + CORE.Window.flags &= ~FLAG_WINDOW_ALWAYS_RUN; } if (flags & FLAG_WINDOW_TRANSPARENT) { @@ -1378,6 +1378,8 @@ void PollInputEvents(void) CORE.Window.resizedLastFrame = false; + if (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) && ((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) == 0)) SDL_WaitEvent(NULL); + SDL_Event event = { 0 }; while (SDL_PollEvent(&event) != 0) { From c8f0f7c47dff4bda402f71298fb5fa101b485ec9 Mon Sep 17 00:00:00 2001 From: asdqwe Date: Wed, 18 Dec 2024 23:24:07 -0300 Subject: [PATCH 4/4] Add reset for GetFrameTime() --- src/platforms/rcore_desktop_glfw.c | 7 ++++++- src/platforms/rcore_desktop_sdl.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/platforms/rcore_desktop_glfw.c b/src/platforms/rcore_desktop_glfw.c index 0d95cdd7..aee12b04 100644 --- a/src/platforms/rcore_desktop_glfw.c +++ b/src/platforms/rcore_desktop_glfw.c @@ -1739,7 +1739,12 @@ static void WindowContentScaleCallback(GLFWwindow *window, float scalex, float s static void WindowIconifyCallback(GLFWwindow *window, int iconified) { if (iconified) CORE.Window.flags |= FLAG_WINDOW_MINIMIZED; // The window was iconified - else CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // The window was restored + else + { + CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // The window was restored + + if ((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) == 0) CORE.Time.previous = GetTime(); + } } // GLFW3 WindowMaximize Callback, runs when window is maximized/restored diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index 493f315d..dd98a729 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -1499,6 +1499,8 @@ void PollInputEvents(void) if ((CORE.Window.flags & SDL_WINDOW_MAXIMIZED) > 0) CORE.Window.flags &= ~SDL_WINDOW_MAXIMIZED; } #endif + + if ((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) == 0) CORE.Time.previous = GetTime(); } break; case SDL_WINDOWEVENT_HIDDEN: