mirror of https://github.com/Genymobile/scrcpy
Refactor screencontrol to inputmanager
The "screen control" handled user input, which happened to be only used to control the screen. The controller and screen were passed to every function. Instead, group them in a struct input_manager. The purpose is to add a new shortcut to enable/disable FPS counter. This feature is not related to "screen control", and will require access to the "frames" instance.hidpi
parent
fb0e467585
commit
000ced9ba8
@ -0,0 +1,24 @@
|
||||
#ifndef INPUTMANAGER_H
|
||||
#define INPUTMANAGER_H
|
||||
|
||||
#include "common.h"
|
||||
#include "controller.h"
|
||||
#include "screen.h"
|
||||
|
||||
struct input_manager {
|
||||
struct controller *controller;
|
||||
struct screen *screen;
|
||||
};
|
||||
|
||||
void input_manager_process_text_input(struct input_manager *input_manager,
|
||||
const SDL_TextInputEvent *event);
|
||||
void input_manager_process_key(struct input_manager *input_manager,
|
||||
const SDL_KeyboardEvent *event);
|
||||
void input_manager_process_mouse_motion(struct input_manager *input_manager,
|
||||
const SDL_MouseMotionEvent *event);
|
||||
void input_manager_process_mouse_button(struct input_manager *input_manager,
|
||||
const SDL_MouseButtonEvent *event);
|
||||
void input_manager_process_mouse_wheel(struct input_manager *input_manager,
|
||||
const SDL_MouseWheelEvent *event);
|
||||
|
||||
#endif
|
@ -1,25 +0,0 @@
|
||||
#ifndef SCREENCONTROL_H
|
||||
#define SCREENCONTROL_H
|
||||
|
||||
#include "common.h"
|
||||
#include "controller.h"
|
||||
#include "screen.h"
|
||||
|
||||
void screencontrol_handle_text_input(struct controller *controller,
|
||||
struct screen *screen,
|
||||
const SDL_TextInputEvent *event);
|
||||
void screencontrol_handle_key(struct controller *controller,
|
||||
struct screen *screen,
|
||||
const SDL_KeyboardEvent *event);
|
||||
void screencontrol_handle_mouse_motion(struct controller *controller,
|
||||
struct screen *screen,
|
||||
const SDL_MouseMotionEvent *event);
|
||||
void screencontrol_handle_mouse_button(struct controller *controller,
|
||||
struct screen *screen,
|
||||
const SDL_MouseButtonEvent *event);
|
||||
void screencontrol_handle_mouse_wheel(struct controller *controller,
|
||||
struct screen *screen,
|
||||
const SDL_MouseWheelEvent *event);
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue