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:
Romain Vimont
2025-11-02 15:09:21 +01:00
parent ac26cac4f7
commit 50d79e758a
2 changed files with 24 additions and 9 deletions

View File

@@ -465,6 +465,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:
@@ -545,13 +558,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

View File

@@ -287,6 +287,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:
@@ -353,9 +362,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
} }