mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-21 05:53:12 -07:00
Device Events in Setsu
This commit is contained in:
parent
43dd40e466
commit
4a1ad05b5d
3 changed files with 155 additions and 38 deletions
|
@ -25,16 +25,43 @@ typedef struct setsu_device_t SetsuDevice;
|
|||
typedef int SetsuTrackingId;
|
||||
|
||||
typedef enum {
|
||||
/* New device available to connect.
|
||||
* Event will have path set to the new device. */
|
||||
SETSU_EVENT_DEVICE_ADDED,
|
||||
|
||||
/* Previously available device removed.
|
||||
* Event will have path set to the new 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. */
|
||||
SETSU_EVENT_DEVICE_REMOVED,
|
||||
|
||||
/* Touch down.
|
||||
* Event will have dev and tracking_id set. */
|
||||
SETSU_EVENT_DOWN,
|
||||
|
||||
/* Touch down.
|
||||
* Event will have dev and tracking_id set. */
|
||||
SETSU_EVENT_UP,
|
||||
|
||||
/* Touch position update.
|
||||
* Event will have dev, tracking_id, x and y set. */
|
||||
SETSU_EVENT_POSITION
|
||||
} SetsuEventType;
|
||||
|
||||
typedef struct setsu_event_t {
|
||||
SetsuDevice *dev;
|
||||
SetsuTrackingId tracking_id;
|
||||
typedef struct setsu_event_t
|
||||
{
|
||||
SetsuEventType type;
|
||||
uint32_t x, y;
|
||||
union
|
||||
{
|
||||
const char *path;
|
||||
struct
|
||||
{
|
||||
SetsuDevice *dev;
|
||||
SetsuTrackingId tracking_id;
|
||||
uint32_t x, y;
|
||||
};
|
||||
};
|
||||
} SetsuEvent;
|
||||
|
||||
typedef void (*SetsuEventCb)(SetsuEvent *event, void *user);
|
||||
|
@ -42,5 +69,7 @@ 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);
|
||||
void setsu_disconnect(Setsu *setsu, SetsuDevice *dev);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue