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 13e2e3d36b
commit dc628cc433
2 changed files with 24 additions and 9 deletions

View File

@@ -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:

View File

@@ -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
}