From 56c4a1c751832c23bba0d9aef3932d59a3dcdd9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 25 Dec 2021 21:11:11 +0100 Subject: [PATCH] bar/wayland: add support for new events in wl-output v4 * name() * description() --- bar/wayland.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/bar/wayland.c b/bar/wayland.c index 89e5183..7894d00 100644 --- a/bar/wayland.c +++ b/bar/wayland.c @@ -495,12 +495,35 @@ output_scale(void *data, struct wl_output *wl_output, int32_t factor) } } +#if defined(WL_OUTPUT_NAME_SINCE_VERSION) +static void +output_name(void *data, struct wl_output *wl_output, const char *name) +{ + struct monitor *mon = data; + free(mon->name); + mon->name = name != NULL ? strdup(name) : NULL; +} +#endif + +#if defined(WL_OUTPUT_DESCRIPTION_SINCE_VERSION) +static void +output_description(void *data, struct wl_output *wl_output, + const char *description) +{ +} +#endif static const struct wl_output_listener output_listener = { .geometry = &output_geometry, .mode = &output_mode, .done = &output_done, .scale = &output_scale, +#if defined(WL_OUTPUT_NAME_SINCE_VERSION) + .name = &output_name, +#endif +#if defined(WL_OUTPUT_DESCRIPTION_SINCE_VERSION) + .description = &output_description, +#endif }; static void @@ -1431,7 +1454,7 @@ set_cursor(struct bar *_bar, const char *cursor) } static const char * -output_name(const struct bar *_bar) +bar_output_name(const struct bar *_bar) { const struct private *bar = _bar->private; const struct wayland_backend *backend = bar->backend.data; @@ -1446,5 +1469,5 @@ const struct backend wayland_backend_iface = { .commit = &commit, .refresh = &refresh, .set_cursor = &set_cursor, - .output_name = &output_name, + .output_name = &bar_output_name, };