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