Skip to content
Snippets Groups Projects
Commit 8b7cbf12 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix window scaling on macOS with retina displays

SDL_SetWindowSize() takes dimensions in imaginary units it makes up
so it can call something "Retina™".  SyncTERM however lovingly
crafts everything pixel by pixel for an atisanal ode to BBSing.

This change converts pixel sizes to Retina™ sizes before resizing
the window.  Should fix ticket 164.
parent f9b7a4e2
No related branches found
No related tags found
No related merge requests found
Pipeline #7066 passed
......@@ -660,6 +660,17 @@ static void setup_surfaces(struct video_stats *vs)
sdl_bughack_minsize(idealmw, idealmh, false);
// Don't change window size when maximized...
if ((sdl.GetWindowFlags(win) & SDL_WINDOW_MAXIMIZED) == 0) {
int ABUw, ABUh;
int pixelw, pixelh;
uint64_t tmpw, tmph;
// Workaround for systems where setWindowSize() units aren't pixels (ie: macOS)
sdl.GetWindowSize(win, &ABUw, &ABUh);
sdl.GetWindowSizeInPixels(win, &pixelw, &pixelh);
tmpw = ((uint64_t)idealw) * ABUw / pixelw;
tmph = ((uint64_t)idealh) * ABUh / pixelh;
idealw = tmpw;
idealh = tmph;
sdl.SetWindowSize(win, idealw, idealh);
}
sdl.GetWindowSizeInPixels(win, &idealw, &idealh);
......
Version 1.2rc7
--------------
Allow clicking in the comment line to edit
Fix window resize on macOS with retina displays
Version 1.2rc6
--------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment