Initialize input manager dynamically
To simulate multitouch, we will need more fields in input_manager, which will be initialized dynamically.
This commit is contained in:
parent
6220456def
commit
9448eae8a4
@ -7,6 +7,16 @@
|
||||
#include "lock_util.h"
|
||||
#include "log.h"
|
||||
|
||||
void
|
||||
input_manager_init(struct input_manager *input_manager,
|
||||
struct controller *controller,
|
||||
struct video_buffer *video_buffer,
|
||||
struct screen *screen) {
|
||||
input_manager->controller = controller;
|
||||
input_manager->video_buffer = video_buffer;
|
||||
input_manager->screen = screen;
|
||||
}
|
||||
|
||||
// Convert window coordinates (as provided by SDL_GetMouseState() to renderer
|
||||
// coordinates (as provided in SDL mouse events)
|
||||
//
|
||||
|
@ -16,6 +16,12 @@ struct input_manager {
|
||||
struct screen *screen;
|
||||
};
|
||||
|
||||
void
|
||||
input_manager_init(struct input_manager *input_manager,
|
||||
struct controller *controller,
|
||||
struct video_buffer *video_buffer,
|
||||
struct screen *screen);
|
||||
|
||||
void
|
||||
input_manager_process_text_input(struct input_manager *input_manager,
|
||||
const SDL_TextInputEvent *event);
|
||||
|
@ -37,12 +37,7 @@ static struct decoder decoder;
|
||||
static struct recorder recorder;
|
||||
static struct controller controller;
|
||||
static struct file_handler file_handler;
|
||||
|
||||
static struct input_manager input_manager = {
|
||||
.controller = &controller,
|
||||
.video_buffer = &video_buffer,
|
||||
.screen = &screen,
|
||||
};
|
||||
static struct input_manager input_manager;
|
||||
|
||||
// init SDL and set appropriate hints
|
||||
static bool
|
||||
@ -311,6 +306,8 @@ scrcpy(const struct scrcpy_options *options) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
input_manager_init(&input_manager, &controller, &video_buffer, &screen);
|
||||
|
||||
if (!server_connect_to(&server)) {
|
||||
goto end;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user