Skip to content
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

Fix high DPI issue on macOS #1648

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tiennou
Copy link

@tiennou tiennou commented Mar 3, 2024

The bug is described in #1621, and is about the game using only the bottom-left corner of the window to draw, and the mouse cursor bounding box not being correct (so you can't access Settings > Graphics, as it gets clamped by the bottom of the screen).

The first commit fixes the rendering to be full-screen again, but the mouse cursor is still "locked" into the top-left corner (but the buttons work).
The second make the mouse cursor move properly by scaling its position with the DPI, but that makes the buttons active area all wrong, and I can't see where the hit-testing is actually happening.

@Flamefire
Copy link
Member

The second make the mouse cursor move properly by scaling its position with the DPI, but that makes the buttons active area all wrong, and I can't see where the hit-testing is actually happening.

The problem here is that you are not correcting the mouse-move/click/drag operations. See e.g.

mouse_xy.pos = getGuiScale().screenToView(Position(ev.motion.x, ev.motion.y));
or search this file for mouse_xy.pos =

I suspect you don't need the 2nd commit here and just can remove the getGuiScale().screenToView from VideoSDL2, but haven't fully checked that. It just looks like you basically undo the scaling by screenToView with * dpiScale which sounds like the scaling is wrong in the first place.

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.

None yet

2 participants