build: target wlroots 0.20, pin fallback to 0.20.2

Rename the text_input/input_method manager events and declare the
host-side cursor-shape interfaces wlroots 0.20 no longer exports
via its headers.
This commit is contained in:
Andrew Hamilton 2026-09-07 23:37:45 +10:00
parent 1f35f90a95
commit 0dc782a5d3
5 changed files with 35 additions and 23 deletions

1
.gitignore vendored
View file

@ -9,5 +9,6 @@ core.*
/build-*/
/subprojects/packagecache/
/subprojects/wlroots-0.19.1/
/subprojects/wlroots-0.20.2/
/subprojects/.wraplock
__pycache__/

View file

@ -37,10 +37,11 @@ sudo apt install build-essential meson ninja-build pkg-config \
libegl1-mesa-dev libgles2-mesa-dev
```
No wlroots package is needed: this project targets wlroots 0.19, while
Debian/Ubuntu ship another version as a versioned package (e.g.
`libwlroots-0.20-dev` on Debian >= trixie, pkg-config name `wlroots-0.20`),
so Meson builds the bundled 0.19.1 instead (see below).
No wlroots package is needed: this project targets wlroots 0.20, and
where the distribution ships it as a versioned package (e.g.
`libwlroots-0.20-dev` on Debian >= trixie, pkg-config name `wlroots-0.20`)
Meson uses the system copy directly; otherwise it builds the bundled
0.20.2 instead (see below).
### Arch
@ -59,14 +60,14 @@ sudo dnf install gcc meson ninja-build pkgconf-pkg-config \
### When the system wlroots dep is missing / the fallback can't find one
The Meson setup searches for `wlroots-0.19` then `wlroots`; if neither is
installed it builds the pinned 0.19.1 from `subprojects/wlroots.wrap`, which
The Meson setup searches for `wlroots-0.20` then `wlroots`; if neither is
installed it builds the pinned 0.20.2 from `subprojects/wlroots.wrap`, which
only needs the wayland, wayland-protocols, xkbcommon and EGL/GLES2 dev
packages listed above. On newer Debian/Ubuntu the packaged wlroots is a
versioned library (e.g. `libwlroots-0.20-dev`, pkg-config `wlroots-0.20`)
whose version falls outside this project's `>=0.19,<0.20` pin, so the
fallback build is used automatically and no wlroots package needs to be
installed. Optional wlroots features (Vulkan, X11, libinput, etc.) are
packages listed above. On older Debian/Ubuntu the packaged wlroots is a
versioned library for another series (e.g. `libwlroots-0.19-dev`, pkg-config
`wlroots-0.19`) whose version falls outside this project's `>=0.20,<0.21`
pin, so the fallback build is used automatically and no wlroots package
needs to be installed. Optional wlroots features (Vulkan, X11, libinput, etc.) are
auto-detected and skipped when their build deps aren't present, so a minimal
install works too.

20
kick.c
View file

@ -1,4 +1,4 @@
/* kick.c -- nested kick compositor built on wlroots 0.19.
/* kick.c -- nested kick compositor built on wlroots 0.20.
*
* Renders a headless wlroots output (via wlr_scene) inside a host Wayland
* window (the "host" connection, e.g. labwc). Input from the host is
@ -141,6 +141,16 @@
#include <wlr/xwayland/xwayland.h>
#endif
/* Host-side cursor-shape-v1 interface descriptors, used for the manual
wl_proxy_marshal_flags() forwarding below. wlroots 0.19 exposed these via
its wlr_cursor_shape_v1.h (which included the generated server header);
0.20 only includes the enum header, so declare them here instead. The
definitions come from kick's own generated cursor-shape protocol code
(not from libwlroots), which is why the generated client header must NOT
be included here too -- it would redefine the shape enum. */
extern const struct wl_interface wp_cursor_shape_manager_v1_interface;
extern const struct wl_interface wp_cursor_shape_device_v1_interface;
/* server.tabs is a plain list of tabs; there is no tab limit. */
/* ===================== Server-side (wlroots) state ===================== */
@ -7303,8 +7313,8 @@ static void host_cursor_shape_get_pointer(void) {
return;
}
/* get_pointer = the sole new_id request (opcode 1); the interface symbol
comes from libwlr (we must not also include the generated client header
here: both server and client headers define the shape enum). */
is declared above (defined by our generated cursor-shape protocol
code, not by libwlr). */
host.shape_dev = (struct wp_cursor_shape_device_v1 *)wl_proxy_marshal_flags(
(struct wl_proxy *)host.shape_mgr, 1 /* WP_CURSOR_SHAPE_MANAGER_V1_GET_POINTER */,
&wp_cursor_shape_device_v1_interface,
@ -11497,10 +11507,10 @@ int main(int argc, char *argv[]) {
server.input_method_mgr =
wlr_input_method_manager_v2_create(server.wl_display);
server.text_input_new.notify = handle_text_input_new;
wl_signal_add(&server.text_input_mgr->events.text_input,
wl_signal_add(&server.text_input_mgr->events.new_text_input,
&server.text_input_new);
server.input_method_new.notify = handle_input_method_new;
wl_signal_add(&server.input_method_mgr->events.input_method,
wl_signal_add(&server.input_method_mgr->events.new_input_method,
&server.input_method_new);
server.seat_keyboard_focus.notify = handle_seat_keyboard_focus;
wl_signal_add(&server.seat->keyboard_state.events.focus_change,

View file

@ -3,13 +3,13 @@ project('kick', 'c',
meson_version: '>=1.0',
default_options: ['c_std=c11', 'warning_level=2'])
wlroots_ver = '>=0.19,<0.20'
wlroots_ver = '>=0.20,<0.21'
# wlroots' pkg-config name varies between distributions (wlroots-0.19 on
# wlroots' pkg-config name varies between distributions (wlroots-0.20 on
# Debian/Ubuntu, plain wlroots on Arch/Fedora). Prefer the system copy, and
# fall back to a pinned source build from subprojects/wlroots.wrap when no
# matching system library is found.
wlroots = dependency('wlroots-0.19', version: wlroots_ver, required: false)
wlroots = dependency('wlroots-0.20', version: wlroots_ver, required: false)
if not wlroots.found()
wlroots = dependency('wlroots', version: wlroots_ver, required: false)
endif

View file

@ -1,5 +1,5 @@
[wrap-file]
directory = wlroots-0.19.1
source_url = https://gitlab.freedesktop.org/wlroots/wlroots/-/archive/0.19.1/wlroots-0.19.1.tar.bz2
source_filename = wlroots-0.19.1.tar.bz2
source_hash = 73e150569c42bdfe36dcb5751e7ec96e9bbd72f8bc6fcbfdd45c4d3cd98ce093
directory = wlroots-0.20.2
source_url = https://gitlab.freedesktop.org/wlroots/wlroots/-/archive/0.20.2/wlroots-0.20.2.tar.bz2
source_filename = wlroots-0.20.2.tar.bz2
source_hash = 20c37b521dc3054b6e9627b79bdd45fc716db9ebc58bdf97e57e84d04b04610f