- Add selection_acquire, selection_release, platform_init to
W_ViewBackend struct (were used but not declared).
- Add lookup_string to W_FontBackend struct (same issue).
- Guard selection_acquire call with NULL check in selection.c.
- Remove pixman_image_unref in wl_frame_configure resize path —
wlroots manages the buffer lifecycle via scene refcounting.
LSan confirms no leak.
- Remove #include of wmspec.c/xdnd.c/xmodifier.c from x11_backend.c
— they are already compiled as standalone objects, causing
multiple-definition linker errors on clean builds.
wMouseMoveWindow and wMouseResizeWindow took XEvent* but were
being passed WMEvent* via casts. The XEvent union layout differs
completely from WMEvent, so ev->xmotion.x_root read garbage —
causing the window to jump to a wrong position and the move to
become uncontrollable.
Changed both functions to take WMEvent*, accessing ev->u.button
fields directly. Removes all XEvent references from the core
policy layer (zero backend-specific types in the middle).
When a client (e.g. foot) sets its own cursor surface via
wl_pointer.set_cursor, the cursor disappears once the pointer
moves off the client surface because nobody resets it. Now
wl_update_pointer_focus resets to left_ptr when the pointer
leaves all surfaces or enters a new one (before the client
gets a chance to override via request_set_cursor).
Three issues fixed:
1. Frame and client surface moved independently during interactive
window move. The client surface (wl_toplevel_view) and frame
decorations (wl_frame_buf) are independent scene graph nodes —
unlike X11 where reparenting creates an implicit parent-child
relationship. Added frame_id/frame_rel_x/frame_rel_y to
wl_toplevel_view so wl_window_move keeps them in sync.
2. window_move(client_win, x, y) treated coordinates as absolute,
but the WM core passes relative-to-frame coordinates (matching
X11 child window semantics). Now detected via frame_id and
converted to absolute scene positions.
3. Titlebar scene node was offset by left_button_width because
updateTitlebar() configures it for X11 layout (separate
overlapping windows). Since the Wayland backend composites
buttons directly into the titlebar buffer, override the
titlebar position to frame origin during wl_frame_paint.
Remove every is_wayland / !is_wayland guard from WM policy files.
All backend-specific logic now lives exclusively in the backends:
- main.c: display_post_open vtable slot handles fatal check, visual ID,
display name, and multiHead parsing (X11) or no-ops (Wayland)
- event.c: EventLoop() unconditionally calls event_loop_run(); the X11
backend's implementation contains the WMNextEvent+inotify loop
- screen.c: screen_init_display vtable slot handles RContext/WMScreen/
color creation (each backend owns its full init path)
- monitor.c: show_crash_dialog vtable slot (X11 shows panel, Wayland
returns abort)
- startup.c: InitializeSwitchMenu called unconditionally (it's
backend-agnostic); defaults polling timer no longer guarded
- shutdown.c: wScreenSaveState called unconditionally
- window.c: client_reparent called unconditionally (Wayland no-ops);
dead frameless-window code removed
Policy code is now completely backend-agnostic. The only references to
is_wayland are the vtable field definitions in the two backend files.
- Create WM frames (titlebar, buttons, resizebar) for native XDG
toplevels — remove the is_wayland guard that skipped frame creation
- Set decoration mode to SERVER_SIDE so clients don't draw their own
titlebar (CSD)
- Skip client_reparent for Wayland (no X11 reparenting needed; the
client scene node is independent of the frame scene buffers)
- Set frame_border_width=0 in wl_screen_create_internals (Wayland has
no X11-style window border; the frame_buf renders all decoration)
- Use wlr_scene_subsurface_tree_create for client surface (avoids XDG
geometry offset issues)
Known issue: transient size mismatch on initial map when saved session
state or size constraints differ from the client's committed buffer.
Resolves after the client processes the configure event.
- Add wlr_subcompositor global (required by all modern Wayland clients)
- Switch from xdg_shell new_surface to new_toplevel signal (wlroots 0.19
fires new_surface with role=NONE before get_toplevel assigns the role)
- Defer initial xdg_surface configure to first client commit via
surface->events.commit listener (surface must be initialized first)
- Defer xdg_decoration set_mode to first commit (set_mode internally
calls schedule_configure which asserts initialized)
- Wire destroy_listener to toplevel->events.destroy instead of
xdg_surface->events.destroy (wlroots asserts toplevel event lists
are empty before the toplevel is freed)
- Log DISPLAY and WAYLAND_DISPLAY env vars at startup
- Add WAYLAND_ROADMAP.md
Native Wayland clients (foot, etc.) can now connect, render, and
disconnect without crashing the compositor.
Was calling redisplay then map_subviews separately, with background
overwriting children. Now calls vb->map which does background first,
then children composite on top, with final commit showing everything.
- Only apply default XKB keymap as fallback when the host compositor
hasn't provided one yet (kb->xkb_state == NULL)
- The nested backend receives the host's keymap (Dvorak, etc.) via
wl_keyboard.keymap — don't overwrite it with QWERTY default
wlr_seat_keyboard_notify_key was being called unconditionally, which
caused re-entrancy that consumed WINGs events from the queue before
the modal loop could fetch them. Now only forwards to the seat when
there's an actual focused client surface.
Also use 16ms timeout in wl_flush so keyboard events from the nested
compositor are actually received during modal loop dispatch.
Eliminated the separate Wayland/X11 code paths. Now ONE path:
1. Backend selection (based on WMAKER_USE_WAYLAND)
2. Backend init
3. Common init (colors, fonts, antialiasedText)
4. viewBackend->platform_init() — X11 does GCs, atoms, cursors,
cut buffers, modifier masks, pixmaps, IM, W_InitApplication.
Wayland is NULL (no platform-specific late init needed).
5. rootView, balloon, return
All X11-specific screen setup moved to W_X11PlatformInit() called
through the view backend vtable. No if-guards, no early returns,
no separate paths.
- WINGsP.h: add selection_acquire/release slots to W_ViewBackend
- wview_x11.c: implement via XSetSelectionOwner/XGetSelectionOwner
- wview_wl.c: stub that returns True (TODO: wl_data_device)
- selection.c: use vtable instead of direct X11 calls
In X11, the server delivers events to the deepest child window.
In Wayland, all widgets share one frame_buf. WMHandleEvent now
does hit-testing within the view tree to find the correct child
widget for button press/release/motion events.
After WMHandleEvent processes a key press, the text field repaints
into its backing image. The modal loop now re-composites the view tree
and commits to the scene graph so changes are visible immediately.
Warn and drop the event rather than silently swallowing it. This makes
the root cause visible — key events arriving before keyboard is fully
initialized.
wl_map was calling wl_map_subviews (children) then wl_redisplay (bg fill),
overwriting children with the background. Reversed order so background
is filled first, then children composite on top.
- window.c: always call frame_paint for internal windows (title=NULL
skipped wFrameWindowChangeTitle which was the only paint trigger)
- wview_wl.c: fill view backing with background color before expose
(X11 server fills background automatically, Wayland needs explicit fill)
When fake_leader is reparented into the frame, its children (the WINGs
view frame_buf) weren't being repositioned. Now cascades position
updates to children of the reparented frame_buf.
Children were painted during panel creation (before frame_buf backing
was connected). Now wl_map triggers wl_map_subviews when a top-level
view is mapped, re-painting all children into the correct backing image.
wl_map was calling wl_redisplay on every view map, including internal
widgets during startup. This caused crashes when non-dialog views
received expose events before being fully set up.
The Wayland screen init path had 'goto screen_done' which skipped
gview creation. Now creates it before the goto. Also added safety
guard in moveGeometryDisplayCentered.
- wl_map: set mapped=1 before calling wl_redisplay (was bailing because
mapped flag wasn't set yet)
- wl_view_commit_backing_impl: enable scene node when content is committed
(frame_buf was created disabled, never enabled before frame was mapped)
- fake_leader_create: return a real frame_buf ID (was returning 0)
- client_reparent: handle frame_buf-to-frame_buf reparenting
- client_reparent: get WINGs view size from view table
- window_map: enable grandchildren (dialog content is grandchild of frame)
- window_move: move grandchildren when parent moves
- dialog.c: guard scr->w_visual for Wayland mode in Info panel
All WINGs render backend functions (draw_line, draw_rect, fill_rect,
pixmap_copy, composite_pixmap) now use resolve_drawable() to handle
WINGs view IDs (0x20000000+) by looking up the backing pixman image.
Also fixes:
- wfont_wl.c: resolve view IDs in draw_string/draw_image_string
- wtextfield.c paintCursor: use render backend draw_line (not XDrawLine)
- dialog.c wShowInfoPanel: guard scr->w_visual for Wayland mode
- wl_client_reparent: create child frame_buf for WINGs views, connect
backing pixman image so widgets paint into the scene graph
- View lookup table: map synthetic IDs to W_View* for event dispatch
- render_wl_pixmap_copy: detect view IDs and copy into backing image
- W_ViewCommitBacking callback: commit frame_buf after WINGs paint
- WMHandleEvent: use view table in Wayland mode (was always NULL)
- wtextfield.c paintCursor: use render backend draw_line instead of
XDrawLine (crash fix for Run dialog)
- wl_draw_string: remove ascent subtraction, y is TOP position (matches
X11 Pango behavior where pango_xft_render_layout takes top-left)
- Menu entry text: pass top position (y+3) not baseline (y+3+fh-1)
- Icon title: pass y=0 (top) not y=fh (baseline)
- frame_paint_titlebar: pass centered top not baseline
- frame_configure: compute absolute position from parent for children
(was setting absolute pos to relative coords, warping to 0,0)
- Titlebar buffer: always render full frame width, resize if needed
- Frame scene node: disable when no resizebar (transparent, not needed)
- Always call frame_paint after show/hide button (TS_NEW was skipping it)
wFrameWindowShowButton was only calling updateTitlebar (not frame_paint)
when new_style==TS_NEW. Now always calls frame_paint so the close button
icon is rendered into the frame buffer after pinning a menu.
frame_buf_at was returning the parent frame instead of child windows
(titlebar, content area) because the parent was later in the list.
Now prefers children (frame_bufs with parent_id set) over parents.
This fixes menu titlebar click detection — clicking the titlebar now
dispatches to titlebarMouseDown/menuTitleMouseDown instead of
menuMouseDown, enabling menu pinning and drag-to-move.
On SIGINT/SIGTERM:
- signalfd handler sets terminate flag and exits the event loop
- After loop exit, remove wlroots pointer listeners to prevent
assertion failure in wlr_pointer_finish
- Reset SIGTERM/SIGINT/SIGHUP to SIG_DFL after signalfd takes over
to prevent the old handleExitSig from competing
handleKeyPress passed event->_x11_raw (NULL in Wayland mode) to
wRootMenuPerformShortcut which dereferences it immediately. Skip
the call when _x11_raw is NULL.
When a menu entry triggers a WINGs dialog (e.g. 'Run...'), the
realizeObserver notification calls realizeWindow which does X11 calls
(XSetClassHint, XAllocWMHints). In Wayland mode scr->display is NULL,
causing a segfault. Skip the entire function when display is NULL.
pointer_get_position was a noop returning (0,0), causing findMenu to
always return NULL. This made the menu close on every button release
regardless of pointer position. Now returns wl_state.pointer_x/y which
are updated on every pointer motion event.
With this fix, the root menu stays open when the pointer is over it on
release (matching X11 behavior), allowing entry selection or titlebar
pinning.
findMenu was returning y relative to the frame top (including titlebar).
getEntryAt expects y relative to the content area. Subtracting top_width
means pointer in titlebar gives y<0 → entry_no=-1 (no selection), which
is correct behavior matching the X11 path.
Add wl_frame_paint_button which renders button icons from XPM data
into the parent frame buffer. Called both from the vtable slot and
from wl_frame_paint during titlebar rendering. Uses PRED_CLOSE_XPM
and PRED_ICONIFY_XPM parsed lazily via RGetImageFromXPMData.
Also removes XEvent from all WFrameWindow callbacks (on_click_left,
on_click_right, on_dblclick_right, on_mousedown_resizebar) — they
now take WMEvent*.
wl_window_unmap now disables child scene nodes when the parent is
hidden. This fixes the menu entries staying visible after the menu
frame (titlebar) was unmapped. The entire menu now disappears
together, matching X11 behavior where the brother menu closes on
button release.
The root menu uses a 'brother' copy for the live instance. findMenu
was only checking the original, not the brother, so it returned NULL
when the pointer was over the active menu copy. This caused the menu
to close immediately on button release (closeCascade triggered by
!smenu condition).
All WFrameWindow callbacks (on_mousedown_titlebar, on_dblclick_titlebar,
on_mousedown_resizebar, on_click_left, on_click_right, on_dblclick_right)
now take WMEvent* instead of XEvent*. This fixes the crash when clicking
the menu titlebar in Wayland mode (_x11_raw was NULL).
Affected files: framewin.h, framewin.c, menu.c, window.c, dialog.c,
winspector.c. All verified X11-free with nm.
findMenu always returned NULL because the refactored code set win=0
then checked 'if (win == None) return NULL'. Replace with geometric
bounds checking against mapped menus. This fixes the menu disappearing
on button release (closeCascade was called because smenu was NULL).
The menu frame was created at 1x1 and resized via wFrameWindowResize
which calls window_resize. But wl_window_resize didn't handle
frame_bufs — it only handled toplevel views. Now it reallocates the
pixman image when dimensions change, so the frame has the correct
size when wl_frame_paint renders the title bar.
- Entry separators: light line on top, dark line on bottom between entries
- Left/right bevel edges on each entry
- Cascade arrow (triangle) for submenu entries
- Paint menu frame title bar (wl_frame_paint) when menu is shown
- Matches X11 menu_draw_frame behavior
All dock/clip/appicon mouse handlers now use WMEvent directly:
- openDockMenu, iconDblClick, handleDockMove, handleClipChangeWorkspace
- wHandleAppIconMove (appicon.c)
- Removed x11_translate_event hack in dock menu forwarding
- dock.o and appicon.o verified X11-free with nm
In X11, child windows are only visible when the parent is mapped.
In Wayland, all frame_bufs are independent scene nodes. The menu
content window was being mapped at creation time (wMenuCreate),
making it visible even though the parent frame was offscreen/hidden.
Fix: wl_window_map skips enabling a child node if its parent's
scene node is not yet enabled.
Child windows (menu content area, titlebar, resizebar) need their own
pixman buffers for painting. Previously frame_create_child returned a
bare synthetic ID with no buffer, so menu_paint_entry found nothing.
Also add parent-child tracking: when a parent frame moves or maps,
all children are repositioned/enabled automatically. Children store
their relative offset and parent ID.
In X11, mapping a window triggers Expose which causes repainting.
In Wayland there are no Expose events, so wMenuPaint must be called
explicitly after the menu is mapped in wMenuMapAt.