mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-30 12:58:19 +02:00
libweston: add API to find weston output by head serial
Add new API weston_compositor_find_output_by_head_serial for touch binding. Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
This commit is contained in:
parent
edce1fea4b
commit
3427788c40
2 changed files with 30 additions and 0 deletions
|
|
@ -2936,6 +2936,10 @@ weston_compositor_get_touch_devices(struct weston_compositor *compositor);
|
|||
void
|
||||
weston_touch_device_list_release(struct weston_touch_device_list *list);
|
||||
|
||||
struct weston_output *
|
||||
weston_compositor_find_output_by_head_serial(struct weston_compositor *compositor,
|
||||
const char *serial);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -11324,3 +11324,29 @@ weston_touch_device_list_release(struct weston_touch_device_list *list)
|
|||
list->len = 0;
|
||||
list->array = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find an output by its head serial number
|
||||
* \param compositor Weston compositor object
|
||||
* \param serial Serial number of the head
|
||||
* \return Output; NULL if not found
|
||||
*
|
||||
* \ingroup compositor
|
||||
*/
|
||||
WL_EXPORT struct weston_output *
|
||||
weston_compositor_find_output_by_head_serial(struct weston_compositor *compositor,
|
||||
const char *serial)
|
||||
{
|
||||
struct weston_output *output;
|
||||
struct weston_head *head;
|
||||
|
||||
/* Check active outputs */
|
||||
wl_list_for_each(output, &compositor->output_list, link) {
|
||||
wl_list_for_each(head, &output->head_list, output_link) {
|
||||
if (head->serial_number && strcmp(head->serial_number, serial) == 0)
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue