mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2025-12-20 16:10:06 +01:00
eis: Expose eis_event_ref()
This makes handling prolonged synchronization sequences easier, as one doesn't have to work around only being allowed to hold one reference. Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/340>
This commit is contained in:
parent
8d86ada12d
commit
42b9a89371
3 changed files with 18 additions and 11 deletions
|
|
@ -118,9 +118,8 @@ eis_event_new_for_device(struct eis_device *device)
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this one is not public */
|
_public_
|
||||||
OBJECT_IMPLEMENT_REF(eis_event);
|
OBJECT_IMPLEMENT_REF(eis_event);
|
||||||
|
|
||||||
_public_
|
_public_
|
||||||
OBJECT_IMPLEMENT_UNREF_CLEANUP(eis_event);
|
OBJECT_IMPLEMENT_UNREF_CLEANUP(eis_event);
|
||||||
_public_
|
_public_
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,3 @@ eis_event_new_for_device(struct eis_device *device);
|
||||||
|
|
||||||
struct eis *
|
struct eis *
|
||||||
eis_event_get_context(struct eis_event *event);
|
eis_event_get_context(struct eis_event *event);
|
||||||
|
|
||||||
struct eis_event*
|
|
||||||
eis_event_ref(struct eis_event *event);
|
|
||||||
|
|
|
||||||
23
src/libeis.h
23
src/libeis.h
|
|
@ -674,13 +674,24 @@ struct eis_event *
|
||||||
eis_peek_event(struct eis *eis);
|
eis_peek_event(struct eis *eis);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release resources associated with this event. This function always
|
* Increase the refcount of this struct by one. Use eis_event_unref() to decrease
|
||||||
* returns NULL.
|
* the refcount. This function always returns the same event that the reference
|
||||||
|
* was added to.
|
||||||
*
|
*
|
||||||
* The caller cannot increase the refcount of an event. Events should be
|
* Events should be considered transient data and not be held longer than
|
||||||
* considered transient data and not be held longer than required.
|
* required.
|
||||||
* eis_event_unref() is provided for consistency (as opposed to, say,
|
*/
|
||||||
* eis_event_free()).
|
struct eis_event *
|
||||||
|
eis_event_ref(struct eis_event *event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrease the refcount of this struct by one. When the refcount reaches
|
||||||
|
* zero, all allocated resources for this struct are released.
|
||||||
|
*
|
||||||
|
* Events should be considered transient data and not be held longer than
|
||||||
|
* required.
|
||||||
|
*
|
||||||
|
* @return always NULL
|
||||||
*/
|
*/
|
||||||
struct eis_event *
|
struct eis_event *
|
||||||
eis_event_unref(struct eis_event *event);
|
eis_event_unref(struct eis_event *event);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue