bar/wayland: add support for new events in wl-output v4

* name()
* description()
This commit is contained in:
Daniel Eklöf 2021-12-25 21:11:11 +01:00
parent 2a0a722c13
commit 56c4a1c751
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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,
};