diff --git a/src/startup.c b/src/startup.c index e86e3f1..d32495a 100644 --- a/src/startup.c +++ b/src/startup.c @@ -49,6 +49,9 @@ #include "session.h" #include "defaults.h" #include "backend/x11/x11_backend.h" +#ifdef USE_WAYLAND_BACKEND +#include "backend/wayland/wl_backend.h" +#endif #include "properties.h" #include "dialog.h" #include "wmspec.h" @@ -520,7 +523,12 @@ void StartUp(Bool defaultScreenOnly) w_global.screen_count = 0; /* Select the display backend before any screen is initialized. */ - wm_backend = &x11_backend; +#ifdef USE_WAYLAND_BACKEND + if (getenv("WMAKER_USE_WAYLAND")) + wm_backend = &wl_backend; + else +#endif + wm_backend = &x11_backend; /* Check if TIFF images are supported */ formats = RSupportedFileFormats(); diff --git a/tests/wl-smoke-test.sh b/tests/wl-smoke-test.sh new file mode 100755 index 0000000..1fb0fee --- /dev/null +++ b/tests/wl-smoke-test.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# tests/wl-smoke-test.sh +# +# Wayland backend smoke test for Window Maker. +# Uses the wlroots headless compositor (no display hardware needed). +# +# Currently verifies: +# 1. wmaker was built with Wayland backend support (symbol present) +# 2. wmaker links against wlroots +# +# This test grows as wl_backend vtable slots are implemented. +# When the compositor can open a headless display, tests for window +# management, EWMH properties, etc. will be added here in the same +# style as tests/x11-smoke-test.sh. +# +# Exit 0 = PASS, non-zero = FAIL. + +set -e + +# Use the real ELF binary (src/wmaker is a libtool wrapper script) +WMAKER=src/.libs/wmaker +[ -x "$WMAKER" ] || WMAKER=src/wmaker + +die() { + echo "FAIL: $*" >&2 + exit 1 +} + +# -- 1. Build check: wl_backend symbol must be present -------------------- +[ -x "$WMAKER" ] || die "wmaker binary not found (tried src/.libs/wmaker and src/wmaker)" + +nm "$WMAKER" 2>/dev/null | grep -q 'wl_backend' \ + || die "wl_backend symbol not found in $WMAKER (built without --enable-wayland-backend?)" + +# -- 2. Link check: wlroots library must be linked in --------------------- +ldd "$WMAKER" 2>/dev/null | grep -qi 'wlroots\|libwlr' \ + || die "wmaker does not link against wlroots" + +# -- Done (headless compositor tests to be added as vtable is implemented) -- +echo "PASS (wl_backend symbol + wlroots link verified; full headless tests pending)" +exit 0 diff --git a/tests/smoke-test.sh b/tests/x11-smoke-test.sh similarity index 100% rename from tests/smoke-test.sh rename to tests/x11-smoke-test.sh