Open OilyFishMan opened 6 months ago
It seems that the actual resizing of the window contents is done in the WindowSizeCallback after the first call to EndDrawing() in the game loop. However, there is this line that prevents CORE.Window.screen.width and height to be updated in the callback: https://github.com/raysan5/raylib/blob/2e774432090db1be697d2e4e5f49ea91ca038cd3/src/platforms/rcore_desktop.c#L1625 Commenting this line solved the issue for me, but I presume is there for a reason.
That's really strange. To me this definitely doesn't seem like expected behavior.
Commenting this line solved the issue for me, but I presume is there for a reason.
There should probably be a comment there explaining that reason... I don't know at the moment...
I ran the sample code under msys2 and Fedora.
It worked well in msys2. GetScreenWidth()
and GetScreenHeight()
would return the correct full resolution at the first frame. However, the same situation like this issue occurred in Fedora.
I found the reason is when WindowSizeCallback()
is called.
In msys2, WindowSizeCallback()
will be called after calling SetWindowSize()
( just before ToggleFullScreen()
), but in Fedora, it will be called after EndDrawing()
.
Because of that, we can get the correct value after ToggleFullScreen()
in msys2 but can't in Fedora.
@archewashi Thanks for the further investigation and provided details! It seems a platform-dependant issue, that's usually difficult to address...
I guess the reason is the glfw commands to X11 are asynchronous (X11 handle commands asynchronously). XFlush
may solve this problem, but it should be a bit dangerous.
I'm running into the same issue (coincidentally with the same environment specs!), and I've found using GetRenderWidth/Height()
is a suitable workaround.
maybe it is ok to update the values of CORE.window.screen.width/height
directly into ToggleFullscreen()
and ToggleBorderlessWindowed()
like I proposed into this PR https://github.com/raysan5/raylib/pull/4151/files ?
@raysan5 I found this PR #4074 , and logically, this issue should have been resolved. I tested it on Fedora in a VM, and no problems occurred.
Issue description
Upon running the procedure
ToggleFullscreen()
, raylib reports "GetScreenWidth()" and "GetScreenHeight()" as values set beforeSetWindowSize(x, y)
. However, withoutToggleFullscreen()
, the original values are kept for one frame then immediately restored to correct full resolution.Environment
Platform backend: DESKTOP (GLFW) OS: Fedora 39 x86_64 Desktop: Gnome X11 OpenGL version: 4.6 GPU: Integrated
Issue Screenshot
Screencast from 2024-04-22 18-22-46.webm Screencast from 2024-04-22 18-26-19.webm
Code Example