mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-12-17 21:44:20 +01:00
Restrict shortcut modifiers to be composed of only one item each. Before, it was possible to select a list of multiple combinations of modifier keys, like --shortcut-mod='lctrl+lalt,rctrl+rsuper', meaning that shortcuts would be triggered either by LCtrl+LAlt+key or RCtrl+RSuper+key. This was overly generic, probably not used very much, and it prevents to solve inconsistencies between UP and DOWN events of modifier keys sent to the device. Refs #4732 <https://github.com/Genymobile/scrcpy/issues/4732> PR #4741 <https://github.com/Genymobile/scrcpy/pull/4741>
67 lines
1.6 KiB
C
67 lines
1.6 KiB
C
#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"
|
|
|
|
struct sc_input_manager {
|
|
struct sc_controller *controller;
|
|
struct sc_file_pusher *fp;
|
|
struct sc_screen *screen;
|
|
|
|
struct sc_key_processor *kp;
|
|
struct sc_mouse_processor *mp;
|
|
|
|
bool forward_all_clicks;
|
|
bool legacy_paste;
|
|
bool clipboard_autosync;
|
|
|
|
uint16_t sdl_shortcut_mods;
|
|
|
|
bool vfinger_down;
|
|
bool vfinger_invert_x;
|
|
bool vfinger_invert_y;
|
|
|
|
// 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
|
|
};
|
|
|
|
struct sc_input_manager_params {
|
|
struct sc_controller *controller;
|
|
struct sc_file_pusher *fp;
|
|
struct sc_screen *screen;
|
|
struct sc_key_processor *kp;
|
|
struct sc_mouse_processor *mp;
|
|
|
|
bool forward_all_clicks;
|
|
bool legacy_paste;
|
|
bool clipboard_autosync;
|
|
uint8_t shortcut_mods; // OR of enum sc_shortcut_mod values
|
|
};
|
|
|
|
void
|
|
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
|