scrcpy/app/src/input_manager.h

68 lines
1.6 KiB
C
Raw Normal View History

#ifndef SC_INPUTMANAGER_H
#define SC_INPUTMANAGER_H
#include "common.h"
#include <stdbool.h>
#include <SDL2/SDL.h>
#include "controller.h"
#include "file_pusher.h"
#include "fps_counter.h"
#include "options.h"
#include "trait/key_processor.h"
#include "trait/mouse_processor.h"
2022-01-15 05:17:30 +08:00
struct sc_input_manager {
2022-01-15 05:17:30 +08:00
struct sc_controller *controller;
struct sc_file_pusher *fp;
2022-01-15 05:17:30 +08:00
struct sc_screen *screen;
struct sc_key_processor *kp;
struct sc_mouse_processor *mp;
bool forward_all_clicks;
bool legacy_paste;
bool clipboard_autosync;
struct {
unsigned data[SC_MAX_SHORTCUT_MODS];
unsigned count;
} sdl_shortcut_mods;
bool vfinger_down;
// 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;
uint64_t next_sequence; // used for request acknowledgements
};
2022-01-15 05:17:30 +08:00
struct sc_input_manager_params {
2022-01-15 05:17:30 +08:00
struct sc_controller *controller;
struct sc_file_pusher *fp;
2022-01-15 05:17:30 +08:00
struct sc_screen *screen;
struct sc_key_processor *kp;
struct sc_mouse_processor *mp;
bool forward_all_clicks;
bool legacy_paste;
bool clipboard_autosync;
const struct sc_shortcut_mods *shortcut_mods;
};
void
2022-01-15 05:17:30 +08:00
sc_input_manager_init(struct sc_input_manager *im,
const struct sc_input_manager_params *params);
void
sc_input_manager_handle_event(struct sc_input_manager *im,
const SDL_Event *event);
#endif