Properly setup wayland protocol versioning

This commit is contained in:
Scoopta 2022-05-14 22:03:28 -07:00
parent 4ec3df5df5
commit a347a4cb10

View File

@ -40,6 +40,8 @@
#include <pango/pango.h> #include <pango/pango.h>
#include <gdk/gdkwayland.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"}; static const char* terminals[] = {"kitty", "termite", "alacritty", "foot", "gnome-terminal", "weston-terminal"};
enum matching_mode { 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) { static void add_interface(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version) {
(void) data; (void) data;
if(strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) { 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) { } else if(strcmp(interface, wl_output_interface.name) == 0) {
struct output_node* node = malloc(sizeof(struct output_node)); 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); wl_list_insert(&outputs, &node->link);
} else if(strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) { } 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));
} }
} }