Add Motion Stub to Setsu

This commit is contained in:
Florian Märkl 2021-01-06 11:31:13 +01:00
commit abc9a27208
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
5 changed files with 196 additions and 130 deletions

View file

@ -13,13 +13,18 @@ typedef struct setsu_t Setsu;
typedef struct setsu_device_t SetsuDevice;
typedef int SetsuTrackingId;
typedef enum {
SETSU_DEVICE_TYPE_TOUCHPAD,
SETSU_DEVICE_TYPE_MOTION
} SetsuDeviceType;
typedef enum {
/* New device available to connect.
* Event will have path set to the new device. */
* Event will have path and type set to the new device. */
SETSU_EVENT_DEVICE_ADDED,
/* Previously available device removed.
* Event will have path set to the new device.
* Event will have path and type set to the removed device.
* Any SetsuDevice connected to this path will automatically
* be disconnected and their pointers will be invalid immediately
* after the callback for this event returns. */
@ -53,7 +58,11 @@ typedef struct setsu_event_t
SetsuEventType type;
union
{
const char *path;
struct
{
const char *path;
SetsuDeviceType dev_type;
};
struct
{
SetsuDevice *dev;
@ -75,11 +84,11 @@ typedef void (*SetsuEventCb)(SetsuEvent *event, void *user);
Setsu *setsu_new();
void setsu_free(Setsu *setsu);
void setsu_poll(Setsu *setsu, SetsuEventCb cb, void *user);
SetsuDevice *setsu_connect(Setsu *setsu, const char *path);
SetsuDevice *setsu_connect(Setsu *setsu, const char *path, SetsuDeviceType type);
void setsu_disconnect(Setsu *setsu, SetsuDevice *dev);
const char *setsu_device_get_path(SetsuDevice *dev);
uint32_t setsu_device_get_width(SetsuDevice *dev);
uint32_t setsu_device_get_height(SetsuDevice *dev);
uint32_t setsu_device_touchpad_get_width(SetsuDevice *dev);
uint32_t setsu_device_touchpad_get_height(SetsuDevice *dev);
#ifdef __cplusplus
}