aboutsummaryrefslogtreecommitdiff
path: root/wayland.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-11-25 06:43:57 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-11-25 06:43:57 +0000
commitc2f043f9066bcfb2b4d22a42fb0badbd0d25680c (patch)
treec65119faab4835854cd447c483dcd42addd1e151 /wayland.c
parentMerge branch 'sixel-pgo' (diff)
parentwayland: Use wl_output_release with wl_output v3 (diff)
Merge branch 'wl_output'
Closes #219
Diffstat (limited to 'wayland.c')
-rw-r--r--wayland.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/wayland.c b/wayland.c
index b8cd9cd9..8007eeba 100644
--- a/wayland.c
+++ b/wayland.c
@@ -841,11 +841,12 @@ handle_global(void *data, struct wl_registry *registry,
return;
struct wl_output *output = wl_registry_bind(
- wayl->registry, name, &wl_output_interface, required);
+ wayl->registry, name, &wl_output_interface, min(version, 3));
tll_push_back(
wayl->monitors,
- ((struct monitor){.wayl = wayl, .output = output, .wl_name = name}));
+ ((struct monitor){.wayl = wayl, .output = output, .wl_name = name,
+ .use_output_release = version >= WL_OUTPUT_RELEASE_SINCE_VERSION}));
struct monitor *mon = &tll_back(wayl->monitors);
wl_output_add_listener(output, &output_listener, mon);
@@ -901,8 +902,12 @@ monitor_destroy(struct monitor *mon)
{
if (mon->xdg != NULL)
zxdg_output_v1_destroy(mon->xdg);
- if (mon->output != NULL)
- wl_output_release(mon->output);
+ if (mon->output != NULL) {
+ if (mon->use_output_release)
+ wl_output_release(mon->output);
+ else
+ wl_output_destroy(mon->output);
+ }
free(mon->make);
free(mon->model);
free(mon->name);