eis: add the functions to fetch a region back from the device

Same as ei_device_get_region() and friends.
This commit is contained in:
Peter Hutterer 2022-03-03 11:24:51 +10:00
parent c15fcdc140
commit d5bdcfc0da
3 changed files with 45 additions and 0 deletions

View file

@ -158,6 +158,12 @@ eis_device_get_seat(struct eis_device *device)
return eis_device_parent(device);
}
_public_ struct eis_region *
eis_device_get_region(struct eis_device *device, size_t index)
{
return list_nth_entry(struct eis_region, &device->regions, link, index);
}
_public_ void
eis_device_set_name(struct eis_device *device, const char *name)
{

View file

@ -42,6 +42,14 @@ _public_
OBJECT_IMPLEMENT_GETTER(eis_region, user_data, void *);
_public_
OBJECT_IMPLEMENT_SETTER(eis_region, user_data, void *);
_public_
OBJECT_IMPLEMENT_GETTER(eis_region, x, uint32_t);
_public_
OBJECT_IMPLEMENT_GETTER(eis_region, y, uint32_t);
_public_
OBJECT_IMPLEMENT_GETTER(eis_region, width, uint32_t);
_public_
OBJECT_IMPLEMENT_GETTER(eis_region, height, uint32_t);
static
OBJECT_IMPLEMENT_CREATE(eis_region);

View file

@ -604,6 +604,25 @@ eis_region_set_physical_scale(struct eis_region *region, double scale);
void
eis_region_add(struct eis_region *region);
/**
* Obtain a region from the device. This function only returns regions that
* have been added to the device with eis_region_add(). The number of regions
* is constant for a device once eis_device_add() has been called and the
* indices of any region remains the same for the lifetime of
* the device.
*
* Regions are shared between all capabilities. Where two capabilities need
* different region, the EIS implementation must create multiple devices with
* individual capabilities and regions.
*
* This function returns the given region or NULL if the index is larger than
* the number of regions available.
*
* This does not increase the refcount of the region. Use eis_region_ref() to
* keep a reference beyond the immediate scope.
*/
struct eis_region *
eis_device_get_region(struct eis_device *device, size_t index);
struct eis_region *
eis_region_ref(struct eis_region *region);
@ -617,6 +636,18 @@ eis_region_get_user_data(struct eis_region *region);
void
eis_region_set_user_data(struct eis_region *region, void *user_data);
uint32_t
eis_region_get_x(struct eis_region *region);
uint32_t
eis_region_get_y(struct eis_region *region);
uint32_t
eis_region_get_width(struct eis_region *region);
uint32_t
eis_region_get_height(struct eis_region *region);
/**
* Add this device to its seat and notify the client of the device's
* availability.