xwayland: Add a function to search for xwl_output by name

Add a convenient function to search for an xwl_output based on its
XRandR name.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
Olivier Fourdan 2023-12-04 16:26:14 +01:00 committed by Olivier Fourdan
parent 0fede76cc3
commit d99e98ad68
2 changed files with 23 additions and 0 deletions

View File

@ -838,6 +838,27 @@ xwl_output_from_wl_output(struct xwl_screen *xwl_screen,
return NULL;
}
struct xwl_output *
xwl_output_get_output_from_name(struct xwl_screen *xwl_screen, const char *name)
{
struct xwl_output *xwl_output;
if (name == NULL)
return NULL;
xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
if (xwl_output->randr_output == NULL)
continue;
if (strcmp(xwl_output->randr_output->name, name) == 0) {
return xwl_output;
}
}
return NULL;
}
struct xwl_output *
xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id,
Bool connected, uint32_t version)

View File

@ -86,6 +86,8 @@ void xwl_output_set_mode_fixed(struct xwl_output *xwl_output,
struct xwl_output *xwl_output_from_wl_output(struct xwl_screen *xwl_screen,
struct wl_output* wl_output);
struct xwl_output *xwl_output_get_output_from_name(struct xwl_screen *xwl_screen,
const char *name);
struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen,
uint32_t id, Bool connected,