-
Notifications
You must be signed in to change notification settings - Fork 2k
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
SDL_WINDOW_HIGH_PIXEL_DENSITY is ignored on Linux when using Wayland #12140
Comments
What exactly is the issue here? X11 doesn’t support high-DPI scaled desktops, while Wayland does, and using that property requires handling a back buffer with a different size from the logical window dimensions, same as on Mac. |
See also #12079. Note in particular that setting SDL_VIDEO_WAYLAND_SCALE_TO_DISPLAY=1 fixes the issue. I can confirm this also fixes what happens with Woof! as well under sdl2-compat. From the documentation for that hint:
I would also like to note that in Woof!'s source code here, the SDL2 equivalent of SDL_WINDOW_HIGH_PIXEL_DENSITY, which is called SDL_WINDOW_ALLOW_HIGHDPI, is passed into the CreateWindow call. This is also only an issue under Wayland, as setting SDL_VIDEO_DRIVER=x11 also fixes the issue. Hopefully this is enough that someone can triangulate the bug. |
OK, I apologize. I actually read up on high DPI. It seems that this is intentional. I might be being unreasonable. sdl2-compat's approach seems reasonable. Sorry for the annoyed tone of voice I had earlier. Leaving this issue open for others to comment on, but close at the maintainer's discretion. EDIT: That being said, this seems really inconvenient for gamedev, where you are expecting to get actual physical pixels back. |
Okay, let me see if I understand this correctly:
Is that right? If that's the case, then I think this is working as intended. |
Hello, I'm not 100% sure if this is the right issue to ask, but we're having an issue where our SDL2 game looks sharp and pixel-perfect via xWayland on a Wayland session set to 125% scaling, but when running it in native Wayland mode, the game is now blurry. DPI scaling works correctly on Windows too. We're wondering if we're missing a hint or something to make sure the window is DPI aware on Linux with native Wayland. Could you point me in the right direction? |
This has been a bug affecting SDL since SDL2, but it wasn't caught because SDL2 defaulted to X11, where this was implemented correctly. With the default now being Wayland on Linux, this has officially become a problem, especially since Arch Linux recently swapped out SDL2 with sdl2-compat, which resulted in fun times when I tried to use Woof! at 1917x1080 on a 2560x1600 display at 150% scaling.
The text was updated successfully, but these errors were encountered: