mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-02-15 02:44:39 +01:00
Use two separate callbacks for gamepad device added and gamepad device removed. It looks cleaner. PR #5623 <https://github.com/Genymobile/scrcpy/pull/5623>
60 lines
1.4 KiB
C
60 lines
1.4 KiB
C
#ifndef SC_GAMEPAD_PROCESSOR_H
|
|
#define SC_GAMEPAD_PROCESSOR_H
|
|
|
|
#include "common.h"
|
|
|
|
#include <assert.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "input_events.h"
|
|
|
|
/**
|
|
* Gamepad processor trait.
|
|
*
|
|
* Component able to handle gamepads devices and inject buttons and axis events.
|
|
*/
|
|
struct sc_gamepad_processor {
|
|
const struct sc_gamepad_processor_ops *ops;
|
|
};
|
|
|
|
struct sc_gamepad_processor_ops {
|
|
|
|
/**
|
|
* Process a gamepad device added event
|
|
*
|
|
* This function is mandatory.
|
|
*/
|
|
void
|
|
(*process_gamepad_added)(struct sc_gamepad_processor *gp,
|
|
const struct sc_gamepad_device_event *event);
|
|
|
|
/**
|
|
* Process a gamepad device removed event
|
|
*
|
|
* This function is mandatory.
|
|
*/
|
|
void
|
|
(*process_gamepad_removed)(struct sc_gamepad_processor *gp,
|
|
const struct sc_gamepad_device_event *event);
|
|
|
|
/**
|
|
* Process a gamepad axis event
|
|
*
|
|
* This function is mandatory.
|
|
*/
|
|
void
|
|
(*process_gamepad_axis)(struct sc_gamepad_processor *gp,
|
|
const struct sc_gamepad_axis_event *event);
|
|
|
|
/**
|
|
* Process a gamepad button event
|
|
*
|
|
* This function is mandatory.
|
|
*/
|
|
void
|
|
(*process_gamepad_button)(struct sc_gamepad_processor *gp,
|
|
const struct sc_gamepad_button_event *event);
|
|
};
|
|
|
|
#endif
|