Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rcore] [SDL2] Add implementation for FLAG_WINDOW_ALWAYS_RUN #4598

Merged
merged 4 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/platforms/rcore_desktop_glfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/platforms/rcore_desktop_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -1497,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:
Expand Down
Loading