output: Add function to find display by name
parent
df936b9dac
commit
d0bee5c651
|
@ -46,4 +46,5 @@ void output_set_xdg_output(struct output* output,
|
|||
struct zxdg_output_v1* xdg_output);
|
||||
void output_list_destroy(struct wl_list* list);
|
||||
struct output* output_find_by_id(struct wl_list* list, uint32_t id);
|
||||
struct output* output_find_by_name(struct wl_list* list, const char* name);
|
||||
struct output* output_first(struct wl_list* list);
|
||||
|
|
12
src/output.c
12
src/output.c
|
@ -17,6 +17,7 @@
|
|||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include "output.h"
|
||||
|
@ -156,6 +157,17 @@ struct output* output_find_by_id(struct wl_list* list, uint32_t id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct output* output_find_by_name(struct wl_list* list, const char* name)
|
||||
{
|
||||
struct output* output;
|
||||
|
||||
wl_list_for_each(output, list, link)
|
||||
if (strcmp(output->name, name) == 0)
|
||||
return output;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct output* output_first(struct wl_list* list)
|
||||
{
|
||||
struct output* output;
|
||||
|
|
Loading…
Reference in New Issue