Initialize input manager dynamically

The input manager was partially initialized statically, but a call to
input_manager_init() was needed anyway, so initialize all the fields
from the "constructor".

This is consistent with the initialization of the other structs.
This commit is contained in:
Romain Vimont
2021-05-17 08:46:38 +02:00
parent dcee7c0f7f
commit 6a2cd089a1
3 changed files with 11 additions and 19 deletions

View File

@@ -40,19 +40,7 @@ static struct sc_v4l2_sink v4l2_sink;
#endif
static struct controller controller;
static struct file_handler file_handler;
static struct input_manager input_manager = {
.controller = &controller,
.screen = &screen,
.repeat = 0,
// initialized later
.prefer_text = false,
.sdl_shortcut_mods = {
.data = {0},
.count = 0,
},
};
static struct input_manager input_manager;
#ifdef _WIN32
BOOL WINAPI windows_ctrl_handler(DWORD ctrl_type) {
@@ -422,7 +410,7 @@ scrcpy(const struct scrcpy_options *options) {
}
stream_started = true;
input_manager_init(&input_manager, options);
input_manager_init(&input_manager, &controller, &screen, options);
ret = event_loop(options);
LOGD("quit...");