Skip to content

Display and control your Android device

Enable "reset video" shortcut for camera

Romain Vimont1b13d0a22df7
diff --git a/app/src/input_manager.c b/app/src/input_manager.c
index c5fc2b8c..67540454 100644
--- a/app/src/input_manager.c
+++ b/app/src/input_manager.c
@@ -474,6 +474,19 @@ sc_input_manager_process_key(struct sc_input_manager *im,
}
return;
}
+
+ // Flatten conditions to avoid additional indentation levels
+ if (control) {
+ // Controls for all sources
+ switch (sdl_keycode) {
+ case SDLK_R:
+ if (!repeat && shift && down && !paused) {
+ reset_video(im);
+ }
+ return;
+ }
+ }
+
if (control && !im->camera) {
switch (sdl_keycode) {
case SDLK_H:
@@ -554,12 +567,8 @@ sc_input_manager_process_key(struct sc_input_manager *im,
}
return;
case SDLK_R:
- if (!repeat && down && !paused) {
- if (shift) {
- reset_video(im);
- } else {
- rotate_device(im);
- }
+ if (!repeat && !shift && down && !paused) {
+ rotate_device(im);
}
return;
case SDLK_K:
diff --git a/server/src/main/java/com/genymobile/scrcpy/control/Controller.java b/server/src/main/java/com/genymobile/scrcpy/control/Controller.java
index d9b4b197..9ef13d09 100644
--- a/server/src/main/java/com/genymobile/scrcpy/control/Controller.java
+++ b/server/src/main/java/com/genymobile/scrcpy/control/Controller.java
@@ -290,6 +290,15 @@ public class Controller implements AsyncProcessor, VirtualDisplayListener {
int type = msg.getType();
+ // Events for all sources (display or camera)
+ switch (type) {
+ case ControlMessage.TYPE_RESET_VIDEO:
+ resetVideo();
+ return true;
+ default:
+ // fall through
+ }
+
if (!camera) {
switch (type) {
case ControlMessage.TYPE_INJECT_KEYCODE:
@@ -356,9 +365,6 @@ public class Controller implements AsyncProcessor, VirtualDisplayListener {
case ControlMessage.TYPE_START_APP:
startAppAsync(msg.getText());
return true;
- case ControlMessage.TYPE_RESET_VIDEO:
- resetVideo();
- return true;
default:
// fall through
}