From 6d9a16e0426144e414a4f5c838781fb08591c67e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 28 Apr 2026 17:32:15 +0200 Subject: [PATCH 1/4] ci: use variables for package lists Avoids duplicating these. --- .github/workflows/main.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bd7cca0..6fd2efc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,6 +7,8 @@ on: env: WLROOTS_VERSION: "0.20" + ALPINE_PACKAGES: "build-base xcb-util-wm-dev libseat-dev clang git eudev-dev mesa-dev libdrm-dev libinput-dev libxkbcommon-dev pixman-dev wayland-dev meson wayland-protocols xwayland-dev scdoc-doc hwdata libdisplay-info-dev" + ARCHLINUX_PACKAGES: "xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc libdisplay-info" jobs: compile: @@ -26,13 +28,13 @@ jobs: - name: Install dependencies (Alpine) if: "matrix.OS == 'alpine:edge'" - run: apk add build-base xcb-util-wm-dev libseat-dev clang git eudev-dev mesa-dev libdrm-dev libinput-dev libxkbcommon-dev pixman-dev wayland-dev meson wayland-protocols xwayland-dev scdoc-doc hwdata libdisplay-info-dev + run: apk add $ALPINE_PACKAGES - name: Install dependencies (Arch) if: "matrix.OS == 'archlinux:base-devel'" run: | pacman-key --init - pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc libdisplay-info + pacman -Syu --noconfirm $ARCHLINUX_PACKAGES - name: Fetch wlroots as a subproject run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b $WLROOTS_VERSION @@ -53,7 +55,7 @@ jobs: - name: Install dependencies run: | pacman-key --init - pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc hwdata libdisplay-info + pacman -Syu --noconfirm $ARCHLINUX_PACKAGES - name: Fetch wlroots as a subproject run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b $WLROOTS_VERSION - name: Check for formatting changes @@ -72,7 +74,7 @@ jobs: - name: Install dependencies run: | pacman-key --init - pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc hwdata libdisplay-info + pacman -Syu --noconfirm $ARCHLINUX_PACKAGES - name: Fetch wlroots as a subproject run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b $WLROOTS_VERSION - name: Run scan-build From bed2ff5afe94a68102a95c714251e232a397c7dd Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 28 Apr 2026 17:33:22 +0200 Subject: [PATCH 2/4] ci: use "meson setup" --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6fd2efc..547bbc7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,7 @@ jobs: - name: Compile Cage (XWayland=${{ matrix.xwayland }}) run: | - meson --fatal-meson-warnings --wrap-mode=nodownload \ + meson setup --fatal-meson-warnings --wrap-mode=nodownload \ build-${{ matrix.CC }}-${{matrix.xwayland }} \ -Dwlroots:xwayland=${{ matrix.xwayland }} ninja -C build-${{ matrix.CC }}-${{matrix.xwayland }} @@ -60,7 +60,7 @@ jobs: run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b $WLROOTS_VERSION - name: Check for formatting changes run: | - meson --wrap-mode=nodownload build-clang-format -Dwlroots:xwayland=enabled + meson setup --wrap-mode=nodownload build-clang-format -Dwlroots:xwayland=enabled ninja -C build-clang-format clang-format-check scan-build: @@ -79,5 +79,5 @@ jobs: run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b $WLROOTS_VERSION - name: Run scan-build run: | - meson --wrap-mode=nodownload build-scan-build -Dwlroots:xwayland=enabled + meson setup --wrap-mode=nodownload build-scan-build -Dwlroots:xwayland=enabled ninja -C build-scan-build scan-build From 4ba2f605f43362314f14941793f62653825f1bca Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 17 Apr 2026 17:12:20 +0200 Subject: [PATCH 3/4] seat: change default seat name to "default" from "seat0" "seat0" is confusing because it's the name used by logind for physical seats. Logical Wayland seats are completely orthogonal to login physical seats, so let's switch the name to reduce mixups a bit. See the discussion in https://github.com/cage-kiosk/cage/pull/497 --- seat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seat.c b/seat.c index 5f659a4..050a097 100644 --- a/seat.c +++ b/seat.c @@ -816,9 +816,9 @@ seat_create(struct cg_server *server, struct wlr_backend *backend) return NULL; } - seat->seat = wlr_seat_create(server->wl_display, "seat0"); + seat->seat = wlr_seat_create(server->wl_display, "default"); if (!seat->seat) { - wlr_log(WLR_ERROR, "Cannot allocate seat0"); + wlr_log(WLR_ERROR, "Cannot allocate seat"); free(seat); return NULL; } From 14d12cfa49d12d8fa71e74870eb7577760218246 Mon Sep 17 00:00:00 2001 From: David Cohen Date: Thu, 2 Apr 2026 03:17:08 -0500 Subject: [PATCH 4/4] cage: add -x flag to disable XWayland at runtime Allows disabling XWayland support at runtime even when the binary was built with it. --- cage.c | 66 ++++++++++++++++++++++++++++++++------------------------ server.h | 1 + 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/cage.c b/cage.c index d524dfd..b2523ca 100644 --- a/cage.c +++ b/cage.c @@ -248,6 +248,7 @@ usage(FILE *file, const char *cage) " -m last Use only the last connected output\n" " -s\t Allow VT switching\n" " -v\t Show the version number and exit\n" + " -x\t Disable XWayland\n" "\n" " Use -- when you want to pass arguments to APPLICATION\n", cage); @@ -256,8 +257,10 @@ usage(FILE *file, const char *cage) static bool parse_args(struct cg_server *server, int argc, char *argv[]) { + server->enable_xwayland = true; + int c; - while ((c = getopt(argc, argv, "dDhm:sv")) != -1) { + while ((c = getopt(argc, argv, "dDhm:svx")) != -1) { switch (c) { case 'd': server->xdg_decoration = true; @@ -281,6 +284,9 @@ parse_args(struct cg_server *server, int argc, char *argv[]) case 'v': fprintf(stdout, "Cage version " CAGE_VERSION "\n"); exit(0); + case 'x': + server->enable_xwayland = false; + break; default: usage(stderr, argv[0]); return false; @@ -562,35 +568,39 @@ main(int argc, char *argv[]) #if CAGE_HAS_XWAYLAND struct wlr_xcursor_manager *xcursor_manager = NULL; - struct wlr_xwayland *xwayland = wlr_xwayland_create(server.wl_display, compositor, true); - if (!xwayland) { - wlr_log(WLR_ERROR, "Cannot create XWayland server"); - } else { - server.new_xwayland_surface.notify = handle_xwayland_surface_new; - wl_signal_add(&xwayland->events.new_surface, &server.new_xwayland_surface); - - xcursor_manager = wlr_xcursor_manager_create(DEFAULT_XCURSOR, XCURSOR_SIZE); - if (!xcursor_manager) { - wlr_log(WLR_ERROR, "Cannot create XWayland XCursor manager"); - ret = 1; - goto end; - } - - if (setenv("DISPLAY", xwayland->display_name, true) < 0) { - wlr_log_errno(WLR_ERROR, - "Unable to set DISPLAY for XWayland. Clients may not be able to connect"); + struct wlr_xwayland *xwayland = NULL; + if (server.enable_xwayland) { + xwayland = wlr_xwayland_create(server.wl_display, compositor, true); + if (!xwayland) { + wlr_log(WLR_ERROR, "Cannot create XWayland server"); } else { - wlr_log(WLR_DEBUG, "XWayland is running on display %s", xwayland->display_name); - } + server.new_xwayland_surface.notify = handle_xwayland_surface_new; + wl_signal_add(&xwayland->events.new_surface, &server.new_xwayland_surface); - if (!wlr_xcursor_manager_load(xcursor_manager, 1)) { - wlr_log(WLR_ERROR, "Cannot load XWayland XCursor theme"); - } - struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(xcursor_manager, DEFAULT_XCURSOR, 1); - if (xcursor) { - struct wlr_xcursor_image *image = xcursor->images[0]; - wlr_xwayland_set_cursor(xwayland, wlr_xcursor_image_get_buffer(image), image->hotspot_x, - image->hotspot_y); + xcursor_manager = wlr_xcursor_manager_create(DEFAULT_XCURSOR, XCURSOR_SIZE); + if (!xcursor_manager) { + wlr_log(WLR_ERROR, "Cannot create XWayland XCursor manager"); + ret = 1; + goto end; + } + + if (setenv("DISPLAY", xwayland->display_name, true) < 0) { + wlr_log_errno(WLR_ERROR, + "Unable to set DISPLAY for XWayland. Clients may not be able to connect"); + } else { + wlr_log(WLR_DEBUG, "XWayland is running on display %s", xwayland->display_name); + } + + if (!wlr_xcursor_manager_load(xcursor_manager, 1)) { + wlr_log(WLR_ERROR, "Cannot load XWayland XCursor theme"); + } + struct wlr_xcursor *xcursor = + wlr_xcursor_manager_get_xcursor(xcursor_manager, DEFAULT_XCURSOR, 1); + if (xcursor) { + struct wlr_xcursor_image *image = xcursor->images[0]; + wlr_xwayland_set_cursor(xwayland, wlr_xcursor_image_get_buffer(image), image->hotspot_x, + image->hotspot_y); + } } } #endif diff --git a/server.h b/server.h index 27f212a..a5b7138 100644 --- a/server.h +++ b/server.h @@ -72,6 +72,7 @@ struct cg_server { bool xdg_decoration; bool allow_vt_switch; + bool enable_xwayland; bool return_app_code; bool terminated; enum wlr_log_importance log_level;