mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-12-17 05:24:19 +01:00
Enable "reset video" shortcut for camera
Make the existing "reset video" feature (MOD+Shift+R) also work for a camera video source.
This commit is contained in:
@@ -474,6 +474,19 @@ sc_input_manager_process_key(struct sc_input_manager *im,
|
|||||||
}
|
}
|
||||||
return;
|
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) {
|
if (control && !im->camera) {
|
||||||
switch (sdl_keycode) {
|
switch (sdl_keycode) {
|
||||||
case SDLK_H:
|
case SDLK_H:
|
||||||
@@ -554,13 +567,9 @@ sc_input_manager_process_key(struct sc_input_manager *im,
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case SDLK_R:
|
case SDLK_R:
|
||||||
if (!repeat && down && !paused) {
|
if (!repeat && !shift && down && !paused) {
|
||||||
if (shift) {
|
|
||||||
reset_video(im);
|
|
||||||
} else {
|
|
||||||
rotate_device(im);
|
rotate_device(im);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
case SDLK_K:
|
case SDLK_K:
|
||||||
if (!shift && !repeat && down && !paused
|
if (!shift && !repeat && down && !paused
|
||||||
|
|||||||
@@ -290,6 +290,15 @@ public class Controller implements AsyncProcessor, VirtualDisplayListener {
|
|||||||
|
|
||||||
int type = msg.getType();
|
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) {
|
if (!camera) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ControlMessage.TYPE_INJECT_KEYCODE:
|
case ControlMessage.TYPE_INJECT_KEYCODE:
|
||||||
@@ -356,9 +365,6 @@ public class Controller implements AsyncProcessor, VirtualDisplayListener {
|
|||||||
case ControlMessage.TYPE_START_APP:
|
case ControlMessage.TYPE_START_APP:
|
||||||
startAppAsync(msg.getText());
|
startAppAsync(msg.getText());
|
||||||
return true;
|
return true;
|
||||||
case ControlMessage.TYPE_RESET_VIDEO:
|
|
||||||
resetVideo();
|
|
||||||
return true;
|
|
||||||
default:
|
default:
|
||||||
// fall through
|
// fall through
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user