mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-12-20 06:54:19 +01:00
torch-wip
There is no input manager in camera mode (so the control msg is never sent), so it does not work. We need a specific access to the controller in camera mode.
This commit is contained in:
@@ -330,6 +330,19 @@ open_hard_keyboard_settings(struct sc_input_manager *im) {
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_camera_torch(struct sc_input_manager *im, bool enabled) {
|
||||
assert(im->controller);
|
||||
|
||||
struct sc_control_msg msg;
|
||||
msg.type = SC_CONTROL_MSG_TYPE_SET_CAMERA_TORCH;
|
||||
msg.set_camera_torch.enabled = enabled;
|
||||
|
||||
if (!sc_controller_push_msg(im->controller, &msg)) {
|
||||
LOGW("Could not request setting camera torch");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
apply_orientation_transform(struct sc_input_manager *im,
|
||||
enum sc_orientation transform) {
|
||||
@@ -569,6 +582,11 @@ sc_input_manager_process_key(struct sc_input_manager *im,
|
||||
open_hard_keyboard_settings(im);
|
||||
}
|
||||
return;
|
||||
case SDLK_l:
|
||||
if (control && !repeat && down) {
|
||||
set_camera_torch(im, !shift);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user