Add int workspace to WWindow so Wayland-managed windows (which have no
WFrameWindow and therefore no frame->workspace slot) can track their
workspace assignment. Set wwin->workspace = workspace in the Wayland
branch of wManageWindow alongside the existing geometry recording.
Guard wWorkspaceForceChange against NULL frame dereferences: introduce a
tmp_workspace local that falls back to tmp->workspace when frame is NULL,
and protect the omnipresent workspace assignment the same way. Also add
a NULL guard for tmp->icon->core in the miniwindow-unmap path.
This prevents NULL dereferences if workspace switching is triggered
(e.g., via a root-menu action) while Wayland windows are managed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Handle WLR_XDG_SURFACE_ROLE_POPUP surfaces in handle_xdg_new_surface by
scheduling the initial configure event. XDG popups (context menus,
autocomplete dropdowns, tooltips) need a compositor configure before they
can commit their first buffer; without it they stall indefinitely.
Popups are not managed by the policy layer — they are self-contained
transient surfaces positioned relative to their parent by the positioner.
We schedule configure and log the event without creating a wl_toplevel_view.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implement prop_get_transient_for for the Wayland backend by walking the
xdg_surface->toplevel->parent pointer and looking up the corresponding
wl_toplevel_view to return its synthetic WNativeWindow ID.
This ensures dialog windows and other transient toplevels that set a
parent via set_parent() are correctly identified as transients by the
policy layer (wManageWindow sets transient_for / no_miniaturizable /
no_miniaturize_button correctly).
Add a helper wl_find_view_by_xdg_surface() for surface-based lookups.
Smoke test gains a header comment noting Phase 65 is a build-only check.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Advertise the XDG decoration manager protocol so clients that support
server-side decoration negotiation can communicate with the compositor.
Since the Wayland path has no X11 frame rendering, respond to all
new_toplevel_decoration events with CLIENT_SIDE mode, directing clients
to draw their own title bars and borders.
Smoke test gains two new checks: compositor logs "xdg-decoration-manager
created" at startup, and weston-info reports zxdg_decoration_manager_v1
in the global registry.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All XDG toplevels support polite close via wlr_xdg_toplevel_send_close.
PropGetProtocols now sets DELETE_WINDOW=1 in the Wayland path so
wManageWindow sets kill_close=0 (prefer polite close over force-kill)
and the MC_CLOSE menu item is enabled for Wayland windows.
wClientSendProtocol dispatches wm_backend->client_close in the Wayland
path instead of returning early; since all atoms are 0 in Wayland, atom
comparison is unreliable, but all callers that reach wClientSendProtocol
are requesting a polite close — the only Wayland-meaningful WM_PROTOCOL.
wManageWindow succeeded log gains a kill_close= field; smoke test check
21 verifies kill_close=0 for each managed Wayland toplevel.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three related fixes to make the WM focus lifecycle work end-to-end in
the Wayland path:
1. window.c: set wwin->flags.mapped=1 for Wayland windows (the
wWindowMap call in wManageWindow is guarded by if(wwin->frame)
which is NULL in Wayland, leaving mapped=0 and causing wSetFocusTo
to take the no-focus branch immediately).
2. screen.c: call screen_create_internals in the Wayland goto path;
this was skipped by goto screen_done but is needed to set
auto_focus=1 and clear initial keyboard focus via wlr_seat.
3. wl_backend.c: implement wl_screen_create_internals (sets
no_focus_win=WNATIVE_NONE, auto_focus=1, clears seat focus);
wl_focus_set now calls wlr_seat_keyboard_clear_focus and logs
"focus_clear" when win==WNATIVE_NONE; remove the redundant direct
wl_focus_set call from handle_toplevel_map since wManageWindow now
handles focus via wSetFocusTo.
Smoke test: add check 20 verifying "focus_clear" is logged after the
last managed window unmaps.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add pointer_x/pointer_y fields to wl_compositor_state, initialised to
screen centre (960,540) in wl_display_open. pointer_warp/warp_to now
update the tracked position (clamped to output bounds); pointer_query and
pointer_query_full return the tracked coordinates instead of hardcoded 0,0.
Also fix the smoke test to ensure XDG_RUNTIME_DIR is set before launching
wmaker (the fix from Phase 53 was already applied; this commits it
permanently). Adds a Phase 54 check verifying the "virtual pointer
initialised at" log line.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a headless pointer input device (WLR_INPUT_DEVICE_POINTER) to the
Wayland seat alongside the existing keyboard device. wlr_seat now
advertises both WL_SEAT_CAPABILITY_KEYBOARD and WL_SEAT_CAPABILITY_POINTER
to clients that bind wl_seat.
Also fix the smoke test to set XDG_RUNTIME_DIR when it is unset so
wl_display_add_socket_auto() can always create the compositor socket.
Smoke test gains a Phase 53 check: weston-info must show 'pointer' in the
wl_seat capabilities output.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Run two weston-simple-shm processes in parallel during the smoke test
and verify that all three toplevels (one from the single-client section
plus two from the parallel section) are managed and unmanaged without
crashing the compositor. The synthetic-ID counter, focus chain, and
wUnmanageWindow path all survive the multi-client scenario.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implement wl_client_get_pid using wl_resource_get_client +
wl_client_get_credentials so the WM can retrieve the OS PID of
Wayland clients. Guard getCommandForWindow in misc.c against NULL
dpy to prevent XGetCommand crash when the real PID path fires.
Guard wWindowChangeWorkspace against NULL frame for frameless
Wayland windows. Log pid= in the wManageWindow-succeeded line;
add Phase 50 pid check to smoke test.
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>
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>
- 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>