Open iongion opened 5 months ago
This looks the same as the issue in raylib-go https://github.com/gen2brain/raylib-go/issues/354. With different compositors, it works but with Gnome/Mutter, it is like that (although I cannot reproduce it in VM with Gnome/Wayland). You can just use an X11 session, or compile with SDL, or try a different compositor, but it looks like it is specific to something in Gnome.
Just to add, before that commit, you were using X11 compatibility mode in Wayland, now you are using native Wayland mode. In raylib-go I added a build tag x11
(i.e. I just don't define -D_GLFW_WAYLAND) for users who want to keep the old/compatibility behavior.
I can't test because i don't have access to a Wayland based system, but could it comes from here ?
According to GLFW documentation, Wayland is sensitive to the GLFW_SCALE_FRAMEBUFFER
hint instead of to the GLFW_SCALE_TO_MONITOR
one.
Note that GLFW_SCALE_FRAMEBUFFER
is an alias of GLFW_COCOA_RETINA_FRAMEBUFFER
.
And the doc also suggest that GLFW_SCALE_FRAMEBUFFER
only affects Macos and Wayland,
while GLFW_SCALE_TO_MONITOR
only affect X11 and Windows.
So there should be no interferences if they are both enabled at the same time.
I tested with both hints enabled at once on my Linux X11, and found no difference.
So maybe, removing the optional #if defined(_APPLE_)
or adding a and defined(__WAYLAND__)
might ~solve~ improve the issue ?
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
{
// Resize window content area based on the monitor content scale.
// NOTE: This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11.
// On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); // Scale content area based on the monitor content scale where window is placed on
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
}
else glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
edit note that there is an other pending issue related to fullscreen and FLAG_WINDOW_HIGHDPI
Could you please test this PR #4151 ?
Please, before submitting a new issue verify and check:
Issue description
Something happened in this branch merge https://github.com/raysan5/raylib/commit/190487383860c54d1746444f17b59c36decfca1e that broke the HiDPI behavior in Linux environment, if I switch to previous commit, before the merge, all is proper https://github.com/raysan5/raylib/commit/68b553cfc157a996e92da053d9e7b8beb92de0c0
Environment
export LIBGL_ALWAYS_SOFTWARE=1
to avoid trouble with the Nvidia WSL driversIssue Screenshot
This produces this image, when running the sample, which renders incorrectly, mouse events are also off
This produces this image, when running the sample, which render properly
Code Example