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 <https://github.com/Genymobile/scrcpy/issues/15>
@@ -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;
