2018-02-15 19:07:47 +08:00
|
|
|
#ifndef INPUTMANAGER_H
|
|
|
|
#define INPUTMANAGER_H
|
|
|
|
|
2019-03-03 06:52:22 +08:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2020-07-17 06:00:42 +08:00
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
|
2019-09-30 04:36:56 +08:00
|
|
|
#include "config.h"
|
2018-02-15 19:07:47 +08:00
|
|
|
#include "common.h"
|
|
|
|
#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"
|
2020-07-17 06:00:42 +08:00
|
|
|
#include "video_buffer.h"
|
2018-02-15 19:07:47 +08:00
|
|
|
|
|
|
|
struct input_manager {
|
|
|
|
struct controller *controller;
|
2019-03-02 22:16:55 +08:00
|
|
|
struct video_buffer *video_buffer;
|
2018-02-15 19:07:47 +08:00
|
|
|
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;
|
|
|
|
|
2019-11-08 02:01:35 +08:00
|
|
|
bool prefer_text;
|
2020-07-17 06:00:42 +08:00
|
|
|
|
|
|
|
struct {
|
|
|
|
unsigned data[SC_MAX_SHORTCUT_MODS];
|
|
|
|
unsigned count;
|
|
|
|
} sdl_shortcut_mods;
|
2018-02-15 19:07:47 +08:00
|
|
|
};
|
|
|
|
|
2020-07-17 06:00:42 +08:00
|
|
|
void
|
|
|
|
input_manager_init(struct input_manager *im, bool prefer_text,
|
|
|
|
const struct sc_shortcut_mods *shortcut_mods);
|
|
|
|
|
2019-03-03 03:09:56 +08:00
|
|
|
void
|
2019-10-20 17:51:54 +08:00
|
|
|
input_manager_process_text_input(struct input_manager *im,
|
2019-03-03 03:09:56 +08:00
|
|
|
const SDL_TextInputEvent *event);
|
|
|
|
|
|
|
|
void
|
2019-10-20 17:51:54 +08:00
|
|
|
input_manager_process_key(struct input_manager *im,
|
2019-03-03 18:05:26 +08:00
|
|
|
const SDL_KeyboardEvent *event,
|
|
|
|
bool control);
|
2019-03-03 03:09:56 +08:00
|
|
|
|
|
|
|
void
|
2019-10-20 17:51:54 +08:00
|
|
|
input_manager_process_mouse_motion(struct input_manager *im,
|
2019-03-03 03:09:56 +08:00
|
|
|
const SDL_MouseMotionEvent *event);
|
|
|
|
|
2019-09-23 03:30:05 +08:00
|
|
|
void
|
2019-10-20 17:51:54 +08:00
|
|
|
input_manager_process_touch(struct input_manager *im,
|
2019-09-23 03:30:05 +08:00
|
|
|
const SDL_TouchFingerEvent *event);
|
|
|
|
|
2019-03-03 03:09:56 +08:00
|
|
|
void
|
2019-10-20 17:51:54 +08:00
|
|
|
input_manager_process_mouse_button(struct input_manager *im,
|
2019-03-03 18:05:26 +08:00
|
|
|
const SDL_MouseButtonEvent *event,
|
|
|
|
bool control);
|
2019-03-03 03:09:56 +08:00
|
|
|
|
|
|
|
void
|
2019-10-20 17:51:54 +08:00
|
|
|
input_manager_process_mouse_wheel(struct input_manager *im,
|
2019-03-03 03:09:56 +08:00
|
|
|
const SDL_MouseWheelEvent *event);
|
2018-02-15 19:07:47 +08:00
|
|
|
|
|
|
|
#endif
|