Use scrcpy input events for mouse processors

Pass scrcpy input events instead of SDL input events to mouse
processors.

These events represent exactly what mouse processors need, abstracted
from any visual orientation and scaling applied on the SDL window.

This makes the mouse processors independent of the "screen" instance,
and the implementation source code independent of the SDL API.
This commit is contained in:
Romain Vimont
2021-12-29 16:24:20 +01:00
parent b4b638e8fe
commit 9460bdd87b
5 changed files with 169 additions and 104 deletions

View File

@@ -6,7 +6,7 @@
#include <assert.h>
#include <stdbool.h>
#include <SDL2/SDL_events.h>
#include "input_events.h"
/**
* Mouse processor trait.
@@ -21,19 +21,19 @@ struct sc_mouse_processor {
struct sc_mouse_processor_ops {
void
(*process_mouse_motion)(struct sc_mouse_processor *mp,
const SDL_MouseMotionEvent *event);
const struct sc_mouse_motion_event *event);
void
(*process_touch)(struct sc_mouse_processor *mp,
const SDL_TouchFingerEvent *event);
const struct sc_touch_event *event);
void
(*process_mouse_button)(struct sc_mouse_processor *mp,
const SDL_MouseButtonEvent *event);
(*process_mouse_click)(struct sc_mouse_processor *mp,
const struct sc_mouse_click_event *event);
void
(*process_mouse_wheel)(struct sc_mouse_processor *mp,
const SDL_MouseWheelEvent *event);
(*process_mouse_scroll)(struct sc_mouse_processor *mp,
const struct sc_mouse_scroll_event *event);
};
#endif