From f5aeecbc621289fdd92f935858ed2abc4347f2b3 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 18 May 2020 17:56:22 +0200 Subject: [PATCH] Reset window size on initialization On macOS with renderer "metal", HiDPI scaling may be incorrect on initialization when several displays are connected. Resetting the window size fixes the problem. Refs #15 --- app/src/screen.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/screen.c b/app/src/screen.c index 967cf5d7..b92c1119 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -325,6 +325,11 @@ screen_init_rendering(struct screen *screen, const char *window_title, return false; } + // Reset the window size to trigger a SIZE_CHANGED event, to workaround + // HiDPI issues with some SDL renderers when several displays having + // different HiDPI scaling are connected + SDL_SetWindowSize(screen->window, window_size.width, window_size.height); + screen_update_content_rect(screen); return true;