summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-07-31 13:29:03 +0100
committerPhil Jones <philj56@gmail.com>2022-07-31 13:29:03 +0100
commit9eafa5884fb8cad11732860c6de06ac13921c40e (patch)
treecd096d67176fa8cc2c706f1fa79298e8d548d330 /src
parent655bde52896b4d6995d0c1b349a7f34d0bb221b1 (diff)
Add checks for old wayland versions.
Diffstat (limited to 'src')
-rw-r--r--src/main.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 4c5f497..f7d65e4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -518,8 +518,10 @@ static const struct wl_output_listener wl_output_listener = {
.mode = output_mode,
.done = output_done,
.scale = output_scale,
+#ifndef NO_WL_OUTPUT_NAME
.name = output_name,
.description = output_description,
+#endif
};
static void registry_global(
@@ -551,11 +553,18 @@ static void registry_global(
log_debug("Bound to seat %u.\n", name);
} else if (!strcmp(interface, wl_output_interface.name)) {
struct output_list_element *el = xmalloc(sizeof(*el));
+ if (version < 4) {
+ el->name = xstrdup("");
+ log_warning("Using an outdated compositor, "
+ "output selection will not work.\n");
+ } else {
+ version = 4;
+ }
el->wl_output = wl_registry_bind(
wl_registry,
name,
&wl_output_interface,
- 4);
+ version);
wl_output_add_listener(
el->wl_output,
&wl_output_listener,
@@ -570,11 +579,17 @@ static void registry_global(
1);
log_debug("Bound to shm %u.\n", name);
} else if (!strcmp(interface, zwlr_layer_shell_v1_interface.name)) {
+ if (version < 4) {
+ log_warning("Using an outdated compositor, "
+ "screen anchoring may not work.\n");
+ } else {
+ version = 4;
+ }
tofi->zwlr_layer_shell = wl_registry_bind(
wl_registry,
name,
&zwlr_layer_shell_v1_interface,
- 4);
+ version);
log_debug("Bound to zwlr_layer_shell_v1 %u.\n", name);
}
}