From 5e59ed31352251791679e5931d7e5abf0c2d18f6 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 11 Nov 2023 11:34:31 +0100 Subject: [PATCH] Always initialize SDL with the video subsystem Clipboard synchronization requires SDL_INIT_VIDEO, so always initialize the video subsystem, even if --no-video or --no-video-playback is passed. Refs caf594c90ef1b71ed844b2a9b42c3b3371215d6f Fixes #4418 --- app/src/scrcpy.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 1d0e90c1..ac2b8e33 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -417,10 +417,14 @@ scrcpy(struct scrcpy_options *options) { if (options->video_playback) { sdl_set_hints(options->render_driver); - if (SDL_Init(SDL_INIT_VIDEO)) { - LOGE("Could not initialize SDL video: %s", SDL_GetError()); - goto end; - } + } + + // Initialize the video subsystem even if --no-video or --no-video-playback + // is passed so that clipboard synchronization still works. + // + if (SDL_Init(SDL_INIT_VIDEO)) { + LOGE("Could not initialize SDL video: %s", SDL_GetError()); + goto end; } if (options->audio_playback) {