From a347a4cb10426459e0ed05d1fd174254b95eb15a Mon Sep 17 00:00:00 2001 From: Scoopta Date: Sat, 14 May 2022 22:03:28 -0700 Subject: [PATCH] Properly setup wayland protocol versioning --- src/wofi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wofi.c b/src/wofi.c index 1382b41..caff1a2 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -40,6 +40,8 @@ #include #include +#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)); } }