Implement wl_prop_get_normal_hints: look up the wl_toplevel_view, read
wlr_xdg_toplevel::current.{min,max}_{width,height} for WNH_P_MIN/MAX_SIZE
flags, and report the current committed surface size as WNH_P_SIZE so
wManageWindow/wClientGetNormalHints sees real constraints.
Returns 1 if any flags were set, 0 if the view has no constraints.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add client_close vtable slot to WMBackend:
- x11: XKillClient + XFlush
- wl: wlr_xdg_toplevel_send_close (politely asks client to close)
- wClientKill: use wm_backend->client_close() for Wayland path
Guard wClientSendProtocol with if (!dpy) return so it is safe to call
on Wayland windows (protocols.DELETE_WINDOW is always 0 for Wayland).
Wire XDG toplevel set_title signal: add title_listener to
wl_toplevel_view; handle_toplevel_title updates wwin->wm_class /
wm_instance when the client changes its title, and calls
wWindowUpdateName (which no-ops on frameless windows but posts
WMNChangedName when a frame is present).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pointer_query / pointer_query_full: return 1 when compositor is running
(wl_state.started) so the same_screen check in wManageWindow passes and
wSetFocusTo is called for newly mapped XDG toplevels.
Guard frame-dependent calls in the focus update path:
- wWindowFocus (window.c): guard wFrameWindowChangeState on frame!=NULL
- wWindowUnfocus (window.c): same; also guard wFrameWindowPaint on
owner->frame when clearing semi-focus on transient owner
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implement three vtable slots:
- client_synth_configure: calls wlr_xdg_toplevel_set_size + schedule_configure
so the WM can resize/reposition XDG toplevel clients
- window_resize: same — sends a configure with the new width/height
- window_move: no-op comment (position is WM-side only for Wayland)
All three use wl_find_view_by_id to recover the wl_toplevel_view.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Create a headless keyboard input device during wl_display_open and
attach it to wlr_seat so wlr_seat_keyboard_notify_enter() can deliver
keyboard focus to XDG toplevel surfaces.
Implement wl_focus_set: look up the view by synthetic ID, call
wlr_seat_keyboard_notify_enter with the xdg_surface->surface.
Call wl_focus_set from handle_toplevel_map immediately after
wManageWindow so newly mapped toplevels receive keyboard focus.
Smoke test: add Phase 43 check — grep "focus_set id=" in stderr.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implement wl_window_get_client_attrs: look up the toplevel view, return
WCLIENT_VIEWABLE with width/height from wlr_surface.current for mapped
surfaces; WCLIENT_UNMAPPED for unknown IDs.
Extend the wManageWindow success log to include geo=WxH so the smoke
test can verify the geometry is non-zero after the client commits a frame.
Smoke test: add Phase 42 check — grep geo= and verify it is logged.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add wl_find_view_by_id() helper that walks toplevel_list to recover a
wl_toplevel_view from its synthetic WNativeWindow ID.
Implement vtable slots:
- prop_get_wm_class: returns XDG app_id as both WM_CLASS and WM_INSTANCE
- window_fetch_name: returns XDG toplevel title
Extend the wManageWindow success log to include class= and name= so
the smoke test can verify these fields are populated from Wayland metadata.
Smoke test: add Phase 41 check — grep for
"class=org.freedesktop.weston.simple-shm" in manage log.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Guard all dpy==NULL / frame==NULL crash sites in the unmanage path:
- wUnmanageWindow (window.c): frame ptr set to NULL-safe expression;
window_unmap, raise_delay timer, and owner border change all
guarded on frame != NULL
- wSelectWindow (actions.c): early return if !wwin->frame
- wNETCleanupFrameExtents (wmspec.c): early return if !dpy
- wClientRestore (client.c): early return if !dpy
Wire handle_toplevel_unmap → context_find → wUnmanageWindow(destroyed=True)
so XDG toplevels are removed from scr->focused_window on client disconnect.
Smoke test: add Phase 40 check — grep "toplevel unmapped".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduce struct wl_toplevel_view with map/unmap/destroy wl_signal
listeners and a synthetic WNativeWindow ID (>= 0x10000000).
Implement context_save/find/delete as a per-key linked list of
(WNativeWindow, void*) entries — enables downstream policy code to
look up views by handle. wl-smoke-test now verifies "toplevel mapped"
appears in compositor stderr when weston-simple-shm creates its surface.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the output frame listener + render pipeline approach (which
required a swapchain allocator) with a simple wl_event_loop timer that
calls wlr_output_send_frame every 16 ms. Clients (weston-simple-shm)
now complete their render loops without the compositor needing a GPU
allocator. Also schedule an initial xdg_surface configure on new
toplevels so they can commit their first buffer. wl-smoke-test verifies
weston-simple-shm runs for 3 s without crashing the compositor.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Advertise wl_shm (via wlr_renderer_init_wl_shm) and expose the headless
output as a wl_output global so SHM buffer clients can render. Wire up
the xdg_shell new_surface listener to track incoming XDG toplevels
(management hook placeholder). wl-smoke-test now verifies wl_shm and
wl_output in the registry and that weston-simple-shm can connect without
crashing the compositor.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Register wl_compositor (+ wl_subcompositor), wl_seat, wl_data_device_manager,
and xdg_wm_base in the compositor's global registry so that Wayland clients
can enumerate and bind them. Add generated xdg-shell-protocol.{h,c} from
wayland-scanner. wl-smoke-test now uses weston-info to verify all three
key globals are present.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Create the compositor UNIX socket via wl_display_add_socket_auto so
Wayland clients can connect; store socket name and set WAYLAND_DISPLAY.
Add wlr_output_layout for multi-head tracking and implement monitors_query
to return real 1920x1080 head geometry from the headless output.
wl-smoke-test now verifies the socket file exists in XDG_RUNTIME_DIR.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add display_default_screen, atom_intern, and event_loop_run vtable slots.
Guard all X11-only paths in startup.c/screen.c/shutdown.c/event.c/xdnd.c
with if (!dpy) so the Wayland path reaches wl_display_run() and exits
cleanly (exit 0) on SIGTERM. wl-smoke-test.sh now PASSES.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add three display-lifecycle slots to WMBackend:
display_open(name) — open/init display connection, return Display*
(NULL for Wayland; compositor init side-effect)
display_close() — tear down display connection
display_screen_count() — number of logical screens
x11_backend: implement with XOpenDisplay (including close-on-exec fcntl),
XCloseDisplay, ScreenCount(dpy); remove fcntl/FD_CLOEXEC from main.c.
wl_backend: implement display_open() with full wlroots headless compositor
init — wl_display_create, wlr_headless_backend_create, wlr_renderer_autocreate,
wlr_backend_start. display_close() tears down in reverse order.
Compositor state held in a file-static struct. Adds -DWLR_USE_UNSTABLE
to WLROOTS_CFLAGS in configure.ac.
main.c: move backend selection before display_open() (was in StartUp()),
call wm_backend->display_open() instead of XOpenDisplay(); guard all
X11-specific post-open code (visual-id, DisplayName, wXModifierInitialize)
in if(dpy != NULL).
startup.c: replace ScreenCount(dpy) with wm_backend->display_screen_count();
remove now-redundant backend-selection block (owned by main.c).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- startup.c: include wl_backend.h when USE_WAYLAND_BACKEND is defined;
select wl_backend when WMAKER_USE_WAYLAND env var is set, otherwise
fall back to x11_backend (no-op for non-Wayland builds)
- tests/smoke-test.sh renamed to tests/x11-smoke-test.sh (X11-only path)
- tests/wl-smoke-test.sh: new Wayland smoke test; currently verifies
wl_backend symbol presence and wlroots linkage; headless compositor
tests will be added as vtable slots are implemented
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add --enable-wayland-backend configure option (default: auto).
Requires wlroots >= 0.15, wayland-server, xkbcommon via pkg-config.
Detected at build time on this system: wlroots 0.15.1.
New files:
src/backend/wayland/wl_backend.h — declares extern const WMBackend wl_backend
src/backend/wayland/wl_backend.c — complete stub vtable (108 slots)
All stubs return safe zero/null/false values. Every slot matches the
exact WMBackend function-pointer signature; zero compiler warnings.
Build system compiles the Wayland backend files conditionally when
USE_WAYLAND_BACKEND is set; WLROOTS_CFLAGS/LIBS wired into AM_CFLAGS
and wmaker_LDADD.
Subsequent phases will replace stubs with real wlroots implementations.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>