Fix the build with the wayland 1.20 headers

axis_value120 (wl_pointer version 8) and axis_relative_direction (version
9) do not exist in the headers older distributions ship, which broke the
build on ubuntu 22.04.

They are not needed anyway: a pointer inherits the version of its seat,
which is bound at version 7 here, so the compositor cannot send those
events at all. The version cap now documents that the listener covers it
and that raising it requires handling the newer events too.
This commit is contained in:
alexei-zebra 2026-10-10 14:15:40 +03:00
parent 714567a06e
commit b558beeea3
No known key found for this signature in database
GPG key ID: D19D450AC3D9A80E

View file

@ -172,8 +172,6 @@ static void seat_capabilities(void*, wl_seat* seat, uint32_t capabilities) {
listener.axis_source = ignore_event<>;
listener.axis_stop = ignore_event<>;
listener.axis_discrete = ignore_event<>;
listener.axis_value120 = ignore_event<>;
listener.axis_relative_direction = ignore_event<>;
return listener;
}();
@ -303,6 +301,10 @@ void registry_global(
}();
xdg_wm_base_add_listener(state.wmBase, &listener, nullptr);
} else if (strcmp(interface, wl_seat_interface.name) == 0) {
// A pointer inherits the seat version, so the pointer listener only
// has to cover the events of version 7 and below. Version 8 adds
// axis_value120 and version 9 axis_relative_direction, whose members
// do not exist in the wayland 1.20 headers either.
state.seat = static_cast<wl_seat*>(wl_registry_bind(
registry, name, &wl_seat_interface, std::min(version, 7u)
));