mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-12-18 14:04:20 +01:00
Explicitly pass control flag to input manager
Replace the "global" control flag in the input_manager by a function parameter to make explicit that the behavior depends whether --no-control has been set.
This commit is contained in:
@@ -39,7 +39,6 @@ static struct input_manager input_manager = {
|
||||
.controller = &controller,
|
||||
.video_buffer = &video_buffer,
|
||||
.screen = &screen,
|
||||
.control = true,
|
||||
};
|
||||
|
||||
// init SDL and set appropriate hints
|
||||
@@ -146,7 +145,7 @@ handle_event(SDL_Event *event, bool control) {
|
||||
case SDL_KEYUP:
|
||||
// some key events do not interact with the device, so process the
|
||||
// event even if control is disabled
|
||||
input_manager_process_key(&input_manager, &event->key);
|
||||
input_manager_process_key(&input_manager, &event->key, control);
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
if (!control) {
|
||||
@@ -164,7 +163,8 @@ handle_event(SDL_Event *event, bool control) {
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
// some mouse events do not interact with the device, so process
|
||||
// the event even if control is disabled
|
||||
input_manager_process_mouse_button(&input_manager, &event->button);
|
||||
input_manager_process_mouse_button(&input_manager, &event->button,
|
||||
control);
|
||||
break;
|
||||
case SDL_DROPFILE: {
|
||||
if (!control) {
|
||||
@@ -301,8 +301,6 @@ scrcpy(const struct scrcpy_options *options) {
|
||||
goto finally_destroy_server;
|
||||
}
|
||||
|
||||
input_manager.control = control;
|
||||
|
||||
struct decoder *dec = NULL;
|
||||
if (display) {
|
||||
if (!video_buffer_init(&video_buffer)) {
|
||||
|
||||
Reference in New Issue
Block a user