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 <https://github.com/Genymobile/scrcpy/issues/15>
This commit is contained in:
Romain Vimont 2020-05-18 17:56:22 +02:00
parent e40532a376
commit f5aeecbc62

View file

@ -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;