2021-10-03 17:44:14 +02:00
|
|
|
#ifndef SC_MOUSE_PROCESSOR_H
|
|
|
|
|
#define SC_MOUSE_PROCESSOR_H
|
|
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
2021-12-29 16:24:20 +01:00
|
|
|
#include "input_events.h"
|
2021-10-03 17:44:14 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Mouse processor trait.
|
|
|
|
|
*
|
|
|
|
|
* Component able to process and inject mouse events should implement this
|
|
|
|
|
* trait.
|
|
|
|
|
*/
|
|
|
|
|
struct sc_mouse_processor {
|
|
|
|
|
const struct sc_mouse_processor_ops *ops;
|
2021-12-30 15:46:00 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* If set, the mouse processor works in relative mode (the absolute
|
|
|
|
|
* position is irrelevant). In particular, it indicates that the mouse
|
|
|
|
|
* pointer must be "captured" by the UI.
|
|
|
|
|
*/
|
|
|
|
|
bool relative_mode;
|
2021-10-03 17:44:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct sc_mouse_processor_ops {
|
2021-12-30 15:08:42 +01:00
|
|
|
/**
|
|
|
|
|
* Process a mouse motion event
|
|
|
|
|
*
|
|
|
|
|
* This function is mandatory.
|
|
|
|
|
*/
|
2021-10-03 17:44:14 +02:00
|
|
|
void
|
|
|
|
|
(*process_mouse_motion)(struct sc_mouse_processor *mp,
|
2021-12-29 16:24:20 +01:00
|
|
|
const struct sc_mouse_motion_event *event);
|
2021-10-03 17:44:14 +02:00
|
|
|
|
2021-12-30 15:08:42 +01:00
|
|
|
/**
|
|
|
|
|
* Process a mouse click event
|
|
|
|
|
*
|
|
|
|
|
* This function is mandatory.
|
|
|
|
|
*/
|
2021-10-03 17:44:14 +02:00
|
|
|
void
|
2021-12-29 16:24:20 +01:00
|
|
|
(*process_mouse_click)(struct sc_mouse_processor *mp,
|
|
|
|
|
const struct sc_mouse_click_event *event);
|
2021-10-03 17:44:14 +02:00
|
|
|
|
2021-12-30 15:08:42 +01:00
|
|
|
/**
|
|
|
|
|
* Process a mouse scroll event
|
|
|
|
|
*
|
|
|
|
|
* This function is optional.
|
|
|
|
|
*/
|
2021-10-03 17:44:14 +02:00
|
|
|
void
|
2021-12-29 16:24:20 +01:00
|
|
|
(*process_mouse_scroll)(struct sc_mouse_processor *mp,
|
|
|
|
|
const struct sc_mouse_scroll_event *event);
|
2021-12-29 23:20:35 +01:00
|
|
|
|
2021-12-30 15:08:42 +01:00
|
|
|
/**
|
|
|
|
|
* Process a touch event
|
|
|
|
|
*
|
|
|
|
|
* This function is optional.
|
|
|
|
|
*/
|
2021-12-29 23:20:35 +01:00
|
|
|
void
|
|
|
|
|
(*process_touch)(struct sc_mouse_processor *mp,
|
|
|
|
|
const struct sc_touch_event *event);
|
2021-10-03 17:44:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|