Skip to content

[rcore][GLFW] Fix borderless-windowed mode being always on top#5868

Open
auwsmit wants to merge 1 commit into
raysan5:masterfrom
auwsmit:patch-2
Open

[rcore][GLFW] Fix borderless-windowed mode being always on top#5868
auwsmit wants to merge 1 commit into
raysan5:masterfrom
auwsmit:patch-2

Conversation

@auwsmit
Copy link
Copy Markdown

@auwsmit auwsmit commented May 14, 2026

Don't pass a monitor to glfwSetWindowMonitor(). This avoids setting the flag internal to glfw which keeps the window always on top.

BorderlessWindowed still works fine, and is properly detected on my two monitors at different resolutions.

Addresses this issue: #5854, but only for borderless FS.

A workaround for regular aka "exclusive" Fullscreen is mentioned in that thread, just add this to raylib's loop:

if (!IsWindowFocused() && IsWindowFullscreen())
{
    MinimizeWindow();
}

Don't pass a monitor to glfwSetWindowMonitor(). This avoids setting the flag which keeps the window always on top.
@auwsmit auwsmit changed the title Fix borderless fullscreen being always on top Fix borderless-windowed mode being always on top May 15, 2026
@raysan5
Copy link
Copy Markdown
Owner

raysan5 commented May 18, 2026

@auwsmit This is a sensible change, have you tested it on Windows, Linux, macOS and with multiple monitors and multiple DPIs?

@raysan5 raysan5 changed the title Fix borderless-windowed mode being always on top [rcore][GLFW] Fix borderless-windowed mode being always on top May 18, 2026
@auwsmit
Copy link
Copy Markdown
Author

auwsmit commented May 18, 2026

@raysan5 Testing on Linux, it does create a problem where the taskbar stays on top of the borderless window (at least for my laptop with wayland and KDE).

So is the best approach to do an #if windows so this change only affects Windows? Is something like this code snippet the proper way to do it?:

                // Set screen position and size
            #if defined(_WIN32)
                // NOTE: To prevent the window from always staying on top, don't pass a monitor at this point.
                glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.position.x, CORE.Window.position.y,
                    CORE.Window.screen.width, CORE.Window.screen.height, mode->refreshRate);
            #else
                glfwSetWindowMonitor(platform.handle, monitors[monitor], CORE.Window.position.x, CORE.Window.position.y,
                    CORE.Window.screen.width, CORE.Window.screen.height, mode->refreshRate);
            #endif

Also sorry about closing the other issue and making this one. I realize in retrospect I probably should've just modified the old PR with a new commit and didnt have to close it and make this new one, but now I know not to that in the future.

@raysan5
Copy link
Copy Markdown
Owner

raysan5 commented May 24, 2026

As I commented, this is a sensible change, it should be tested on a multi-monitor configuration and with different DPI monitors, I think the change can impact current behaviour, for example have you tried opening the window from a different working monitor instead of primary monitor? because I think that NULL always uses primary instead of current...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants