mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-02 22:29:25 +00:00
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
3 changed files with 19 additions and 6 deletions
|
@ -7,6 +7,16 @@
|
||||||
#include "lock_util.h"
|
#include "lock_util.h"
|
||||||
#include "log.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
|
// Convert window coordinates (as provided by SDL_GetMouseState() to renderer
|
||||||
// coordinates (as provided in SDL mouse events)
|
// coordinates (as provided in SDL mouse events)
|
||||||
//
|
//
|
||||||
|
|
|
@ -16,6 +16,12 @@ struct input_manager {
|
||||||
struct screen *screen;
|
struct screen *screen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
input_manager_init(struct input_manager *input_manager,
|
||||||
|
struct controller *controller,
|
||||||
|
struct video_buffer *video_buffer,
|
||||||
|
struct screen *screen);
|
||||||
|
|
||||||
void
|
void
|
||||||
input_manager_process_text_input(struct input_manager *input_manager,
|
input_manager_process_text_input(struct input_manager *input_manager,
|
||||||
const SDL_TextInputEvent *event);
|
const SDL_TextInputEvent *event);
|
||||||
|
|
|
@ -37,12 +37,7 @@ static struct decoder decoder;
|
||||||
static struct recorder recorder;
|
static struct recorder recorder;
|
||||||
static struct controller controller;
|
static struct controller controller;
|
||||||
static struct file_handler file_handler;
|
static struct file_handler file_handler;
|
||||||
|
static struct input_manager input_manager;
|
||||||
static struct input_manager input_manager = {
|
|
||||||
.controller = &controller,
|
|
||||||
.video_buffer = &video_buffer,
|
|
||||||
.screen = &screen,
|
|
||||||
};
|
|
||||||
|
|
||||||
// init SDL and set appropriate hints
|
// init SDL and set appropriate hints
|
||||||
static bool
|
static bool
|
||||||
|
@ -311,6 +306,8 @@ scrcpy(const struct scrcpy_options *options) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input_manager_init(&input_manager, &controller, &video_buffer, &screen);
|
||||||
|
|
||||||
if (!server_connect_to(&server)) {
|
if (!server_connect_to(&server)) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue