2018-02-15 19:07:47 +08:00
|
|
|
#ifndef INPUTMANAGER_H
|
|
|
|
#define INPUTMANAGER_H
|
|
|
|
|
2021-01-09 02:24:51 +08:00
|
|
|
#include "common.h"
|
|
|
|
|
2019-03-03 06:52:22 +08:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2020-07-17 06:00:42 +08:00
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
|
2018-02-15 19:07:47 +08:00
|
|
|
#include "controller.h"
|
2018-08-15 23:01:54 +08:00
|
|
|
#include "fps_counter.h"
|
2020-07-17 06:00:42 +08:00
|
|
|
#include "scrcpy.h"
|
2018-02-15 19:07:47 +08:00
|
|
|
#include "screen.h"
|
|
|
|
|
|
|
|
struct input_manager {
|
|
|
|
struct controller *controller;
|
|
|
|
struct screen *screen;
|
2020-06-11 16:40:52 +08:00
|
|
|
|
|
|
|
// SDL reports repeated events as a boolean, but Android expects the actual
|
|
|
|
// number of repetitions. This variable keeps track of the count.
|
|
|
|
unsigned repeat;
|
|
|
|
|
2020-08-02 21:45:31 +08:00
|
|
|
bool control;
|
2020-07-27 14:26:25 +08:00
|
|
|
bool forward_key_repeat;
|
2019-11-08 02:01:35 +08:00
|
|
|
bool prefer_text;
|
2020-10-06 02:45:53 +08:00
|
|
|
bool forward_all_clicks;
|
2020-10-07 03:30:10 +08:00
|
|
|
bool legacy_paste;
|
2020-07-17 06:00:42 +08:00
|
|
|
|
|
|
|
struct {
|
|
|
|
unsigned data[SC_MAX_SHORTCUT_MODS];
|
|
|
|
unsigned count;
|
|
|
|
} sdl_shortcut_mods;
|
2020-08-09 22:04:02 +08:00
|
|
|
|
|
|
|
bool vfinger_down;
|
2021-04-17 20:15:31 +08:00
|
|
|
|
|
|
|
// Tracks the number of identical consecutive shortcut key down events.
|
|
|
|
// Not to be confused with event->repeat, which counts the number of
|
|
|
|
// system-generated repeated key presses.
|
|
|
|
unsigned key_repeat;
|
|
|
|
SDL_Keycode last_keycode;
|
|
|
|
uint16_t last_mod;
|
2018-02-15 19:07:47 +08:00
|
|
|
};
|
|
|
|
|
2020-07-17 06:00:42 +08:00
|
|
|
void
|
2021-05-17 14:46:38 +08:00
|
|
|
input_manager_init(struct input_manager *im, struct controller *controller,
|
|
|
|
struct screen *screen, const struct scrcpy_options *options);
|
2020-07-17 06:00:42 +08:00
|
|
|
|
2021-02-16 01:53:23 +08:00
|
|
|
bool
|
|
|
|
input_manager_handle_event(struct input_manager *im, SDL_Event *event);
|
2018-02-15 19:07:47 +08:00
|
|
|
|
|
|
|
#endif
|