Display and control your Android device
Make screen event handler return void
Romain Vimontd7f0e22067ac
diff --git a/app/src/scrcpy.c b/app/src/scrcpy.cindex cd6f9a16..68fdc226 100644--- a/app/src/scrcpy.c+++ b/app/src/scrcpy.c@@ -199,8 +199,8 @@ event_loop(struct scrcpy *s, bool has_screen) {break;}default:- if (has_screen && !sc_screen_handle_event(&s->screen, &event)) {- return SCRCPY_EXIT_FAILURE;+ if (has_screen) {+ sc_screen_handle_event(&s->screen, &event);}break;}diff --git a/app/src/screen.c b/app/src/screen.cindex 6a74e4ad..54949944 100644--- a/app/src/screen.c+++ b/app/src/screen.c@@ -854,7 +854,7 @@ sc_screen_resize_to_pixel_perfect(struct sc_screen *screen) {content_size.height);}-bool+voidsc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) {// !video implies !has_video_windowassert(screen->video || !screen->has_video_window);@@ -864,28 +864,28 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) {if (!ok) {LOGE("Frame update failed\n");}- return true;+ return;}case SDL_EVENT_WINDOW_EXPOSED:if (!screen->video || screen->has_video_window) {sc_screen_render(screen, true);}- return true;+ return;case SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED:if (screen->has_video_window) {sc_screen_render(screen, true);}- return true;+ return;case SDL_EVENT_WINDOW_RESTORED:if (screen->has_video_window && is_windowed(screen)) {apply_pending_resize(screen);sc_screen_render(screen, true);}- return true;+ return;case SDL_EVENT_WINDOW_ENTER_FULLSCREEN:LOGD("Switched to fullscreen mode");assert(screen->has_video_window);- return true;+ return;case SDL_EVENT_WINDOW_LEAVE_FULLSCREEN:LOGD("Switched to windowed mode");assert(screen->has_video_window);@@ -893,17 +893,16 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) {apply_pending_resize(screen);sc_screen_render(screen, true);}- return true;+ return;}if (sc_screen_is_relative_mode(screen)&& sc_mouse_capture_handle_event(&screen->mc, event)) {// The mouse capture handler consumed the event- return true;+ return;}sc_input_manager_handle_event(&screen->im, event);- return true;}struct sc_pointdiff --git a/app/src/screen.h b/app/src/screen.hindex 330e41a6..63f18019 100644--- a/app/src/screen.h+++ b/app/src/screen.h@@ -157,8 +157,7 @@ voidsc_screen_set_paused(struct sc_screen *screen, bool paused);// react to SDL events-// If this function returns false, scrcpy must exit with an error.-bool+voidsc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event);// convert point from window coordinates to frame coordinates