summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meson.build8
-rw-r--r--src/main.c19
2 files changed, 25 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 8776e76..2bd56a6 100644
--- a/meson.build
+++ b/meson.build
@@ -122,6 +122,14 @@ xkbcommon = dependency('xkbcommon')
glib = dependency('glib-2.0')
gio_unix = dependency('gio-unix-2.0')
+if wayland_client.version().version_compare('<1.20.0')
+ add_project_arguments(
+ ['-DNO_WL_OUTPUT_NAME=1'],
+ language: 'c'
+ )
+endif
+
+
# Generate the necessary Wayland headers / sources with wayland-scanner
wayland_scanner = find_program(
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);
}
}