summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2022-09-04 00:51:07 +0200
committerRan Benita <ran@unusedvar.com>2022-09-24 10:02:24 +0300
commit320f56d2a4a31026e5c8d3b60303af98bf885e1b (patch)
tree6a1af90a49e2c377cdb4d3586d4a6a5907fd0d0a /tools
parent57af9cb71f19f37394399b549f7cb7b0d9fe3988 (diff)
downloadxorg-lib-libxkbcommon-320f56d2a4a31026e5c8d3b60303af98bf885e1b.tar.gz
interactive-wayland: Fix interface versioning
We need to request the lower version of the interface versions we support and the server supports, not the higher version. Using the higher version caused crashes due to unbound callbacks on GNOME, which supports a higher version of `xdg_wm_base`.
Diffstat (limited to 'tools')
-rw-r--r--tools/interactive-wayland.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/interactive-wayland.c b/tools/interactive-wayland.c
index d23432d..890680f 100644
--- a/tools/interactive-wayland.c
+++ b/tools/interactive-wayland.c
@@ -42,7 +42,7 @@
#include "xdg-shell-client-protocol.h"
#include <wayland-util.h>
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
struct interactive_dpy {
struct wl_display *dpy;
@@ -557,7 +557,7 @@ seat_create(struct interactive_dpy *inter, struct wl_registry *registry,
seat->global_name = name;
seat->inter = inter;
seat->wl_seat = wl_registry_bind(registry, name, &wl_seat_interface,
- MAX(version, 5));
+ MIN(version, 5));
wl_seat_add_listener(seat->wl_seat, &seat_listener, seat);
ret = asprintf(&seat->name_str, "seat:%d",
wl_proxy_get_id((struct wl_proxy *) seat->wl_seat));
@@ -607,17 +607,17 @@ registry_global(void *data, struct wl_registry *registry, uint32_t name,
else if (strcmp(interface, "xdg_wm_base") == 0) {
inter->shell = wl_registry_bind(registry, name,
&xdg_wm_base_interface,
- MAX(version, 2));
+ MIN(version, 2));
xdg_wm_base_add_listener(inter->shell, &shell_listener, inter);
}
else if (strcmp(interface, "wl_compositor") == 0) {
inter->compositor = wl_registry_bind(registry, name,
&wl_compositor_interface,
- MAX(version, 1));
+ MIN(version, 1));
}
else if (strcmp(interface, "wl_shm") == 0) {
inter->shm = wl_registry_bind(registry, name, &wl_shm_interface,
- MAX(version, 1));
+ MIN(version, 1));
}
}