2018-02-15 12:07:47 +01:00
|
|
|
#ifndef INPUTMANAGER_H
|
|
|
|
#define INPUTMANAGER_H
|
|
|
|
|
2021-01-08 19:24:51 +01:00
|
|
|
#include "common.h"
|
|
|
|
|
2019-03-02 23:52:22 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2020-07-17 00:00:42 +02:00
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
|
2018-02-15 12:07:47 +01:00
|
|
|
#include "controller.h"
|
2018-08-15 17:01:54 +02:00
|
|
|
#include "fps_counter.h"
|
2020-07-17 00:00:42 +02:00
|
|
|
#include "scrcpy.h"
|
2018-02-15 12:07:47 +01:00
|
|
|
#include "screen.h"
|
|
|
|
|
|
|
|
struct input_manager {
|
|
|
|
struct controller *controller;
|
|
|
|
struct screen *screen;
|
2020-06-11 04:40:52 -04: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 15:45:31 +02:00
|
|
|
bool control;
|
2020-07-27 02:26:25 -04:00
|
|
|
bool forward_key_repeat;
|
2019-11-07 19:01:35 +01:00
|
|
|
bool prefer_text;
|
2020-10-05 20:45:53 +02:00
|
|
|
bool forward_all_clicks;
|
2020-10-06 21:30:10 +02:00
|
|
|
bool legacy_paste;
|
2020-07-17 00:00:42 +02:00
|
|
|
|
|
|
|
struct {
|
|
|
|
unsigned data[SC_MAX_SHORTCUT_MODS];
|
|
|
|
unsigned count;
|
|
|
|
} sdl_shortcut_mods;
|
2020-08-09 16:04:02 +02:00
|
|
|
|
|
|
|
bool vfinger_down;
|
2021-04-17 13:15:31 +01: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 12:07:47 +01:00
|
|
|
};
|
|
|
|
|
2020-07-17 00:00:42 +02:00
|
|
|
void
|
2021-05-17 08:46:38 +02:00
|
|
|
input_manager_init(struct input_manager *im, struct controller *controller,
|
|
|
|
struct screen *screen, const struct scrcpy_options *options);
|
2020-07-17 00:00:42 +02:00
|
|
|
|
2021-02-15 18:53:23 +01:00
|
|
|
bool
|
|
|
|
input_manager_handle_event(struct input_manager *im, SDL_Event *event);
|
2018-02-15 12:07:47 +01:00
|
|
|
|
|
|
|
#endif
|