Properly setup wayland protocol versioning
1 files changed, 5 insertions(+), 3 deletions(-)

M src/wofi.c
M src/wofi.c +5 -3
@@ 40,6 40,8 @@ 
 #include <pango/pango.h>
 #include <gdk/gdkwayland.h>
 
+#define PROTO_VERSION(v1, v2) (v1 < v2 ? v1 : v2)
+
 static const char* terminals[] = {"kitty", "termite", "alacritty", "foot", "gnome-terminal", "weston-terminal"};
 
 enum matching_mode {

          
@@ 133,13 135,13 @@ static void nop() {}
 static void add_interface(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version) {
 	(void) data;
 	if(strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
-		shell = wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, version);
+		shell = wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, PROTO_VERSION(version, 4));
 	} else if(strcmp(interface, wl_output_interface.name) == 0) {
 		struct output_node* node = malloc(sizeof(struct output_node));
-		node->output = wl_registry_bind(registry, name, &wl_output_interface, version);
+		node->output = wl_registry_bind(registry, name, &wl_output_interface, PROTO_VERSION(version, 4));
 		wl_list_insert(&outputs, &node->link);
 	} else if(strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) {
-		output_manager = wl_registry_bind(registry, name, &zxdg_output_manager_v1_interface, version);
+		output_manager = wl_registry_bind(registry, name, &zxdg_output_manager_v1_interface, PROTO_VERSION(version, 3));
 	}
 }