Avoid double-rendering on resize

On Windows and macOS, resizing the window with the mouse blocks the
event loop until the click is released. To keep rendering during
resizing, an event watcher is registered to handle resize events.

Avoid handling resize events twice by ensuring
`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED` is processed only once.

PR #6758 <https://github.com/Genymobile/scrcpy/pull/6758>
This commit is contained in:
Romain Vimont 2026-04-07 19:54:20 +02:00
parent 8983023457
commit 523c820bfa

View File

@ -935,9 +935,12 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) {
case SDL_EVENT_WINDOW_EXPOSED:
sc_screen_render(screen, true);
return;
// If defined, then the actions are already performed by the event watcher
#ifndef CONTINUOUS_RESIZING_WORKAROUND
case SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED:
sc_screen_on_resize(screen);
return;
#endif
case SDL_EVENT_WINDOW_RESTORED:
if (screen->video && is_windowed(screen)) {
apply_pending_resize(screen);