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"
|
2021-10-03 23:11:20 +08:00
|
|
|
#include "trait/key_processor.h"
|
2021-10-03 23:44:14 +08:00
|
|
|
#include "trait/mouse_processor.h"
|
2018-02-15 19:07:47 +08:00
|
|
|
|
|
|
|
struct input_manager {
|
|
|
|
struct controller *controller;
|
|
|
|
struct screen *screen;
|
2020-06-11 16:40:52 +08:00
|
|
|
|
2021-10-03 23:11:20 +08:00
|
|
|
struct sc_key_processor *kp;
|
2021-10-03 23:44:14 +08:00
|
|
|
struct sc_mouse_processor *mp;
|
2020-06-11 16:40:52 +08:00
|
|
|
|
2020-08-02 21:45:31 +08:00
|
|
|
bool control;
|
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,
|
2021-10-03 23:11:20 +08:00
|
|
|
struct screen *screen, struct sc_key_processor *kp,
|
2021-10-03 23:44:14 +08:00
|
|
|
struct sc_mouse_processor *mp,
|
2021-10-03 23:11:20 +08:00
|
|
|
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
|