-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
SDL2: Support highdpi #14703
SDL2: Support highdpi #14703
Conversation
tested on Mac: everything looks and behaves normal |
@superfloh247 in #14268 (comment), you wrote for
Does this PR fix that? |
you tell me |
Your old screenshots have a different resolution. With the old screenshots scaled down to 50% to be able to compare, it looks like the issue is fixed. Is it? |
looks like the font size increases a tiny bit with this patch |
The font size on both screenshots looks the same to me
I assume the "with patch" screenshot is with |
Ok, thank you for testing. The results don't make much sense for me, but at least nothing is broken. |
76b21e7
to
62ca274
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't work on my xfce/x11 hidpi system: window and everything else is too small (scale not detected)
Lots of additional informationI had only tested this PR on Windows so far. Now I also tested it on two Linux systems. Here are my results:
These are the changes I used: grorp@7f1438f There are basically two ways to get a scaling factor from SDL2:
This PR is based on the first approach, which is what the SDL2 docs recommend: https://wiki.libsdl.org/SDL2/SDL_GetDisplayDPI#remarks Takeaways:
I don't see a way I could improve this PR to make it work better on Linux/X11. It looks like SDL2 simply doesn't support highdpi on X11 (but SDL3 does): libsdl-org/SDL#4176 / libsdl-org/SDL#7718 |
@superfloh247 it would be great if you could test this PR again. After e0e2f3c, it might actually make a difference on macos (but only if you have a retina/hidpi display). |
Could you test grorp@efbe0d7 and tell me what it outputs to the console after EDIT: There was a new bug that caused a scale of 0.5 with
Ideally, you'd test this with the default settings, i.e. an empty minetest.conf file. Another question: Is there a resolution difference between screenshots taken with Minetest's F12 and screenshots taken with macOS' screenshot feature? |
That's disappointing and actually means a loss of features compares to the older "Linux" device. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code lgtm
and handle DPI changes at runtime
I see more and more stuff lacking on X11 (see #14542 I don't want to cut X11 users, but giving them grace period to migrate (even Xfce working on the transition) is the best thing.. |
I don't think that would make much sense as X11 will be with us for at least a few years in the Linux world and there's few signs of the BSD world moving. |
Irrlicht Device: SDL key binding broken |
Seems to work on macOS. Thank you. The default on macOS is still CIrrDeviceOSX, which doesn't support highdpi. It looks like To avoid unexpected behavior changes/regressions with CIrrDeviceOSX, I've reverted the |
Fixes #14549
Tested on Windows. This could work on Mac too, but I don't have a device to test it there.
I used CIrrDeviceSDL from https://github.com/MoNTE48/Irrlicht as a reference, but I believe my implementation is slightly more elegant.
To do
This PR is a Ready for Review.
How to test
Set the display/screen scaling settings on Windows, verify that Minetest respects them. Verify that mouse input works correctly. Also verify that the window size is saved and restored correctly.