Commit Graph

19 Commits

Author SHA1 Message Date
lkn 9f86c6091c wayland: remove manual CSD geometry offset from scene positioning
wlr_scene_xdg_surface_create handles geometry offset internally.
Our manual subtraction of geometry.x/y in handle_toplevel_commit,
handle_toplevel_map, and wl_window_move was double-subtracting,
causing client surfaces to render behind their frames.

Remove all manual geometry offset from scene node positioning.
2026-06-25 08:05:13 +02:00
lkn 06dd22254d wayland: auto-contrast menu text color for dark themes
When MenuTextColor is not explicitly set (defaults to black), dark
widget themes render invisible black-on-dark menu text. Compute
luminance contrast between text color and background; if insufficient
(< 64 difference), substitute white text on dark backgrounds or black
text on light backgrounds.
2026-06-25 07:52:58 +02:00
lkn de15ca2282 wayland: fix heap corruption — update backing table after frame resize
wl_frame_configure and wl_window_resize reallocate fb->image (unref
old pixman image, create new one) but never updated the WINGs backing
table. W_GetViewBacking() continued returning the freed pointer.

Any subsequent draw into that backing (e.g. WMDrawString for titlebar
text) wrote into freed memory, corrupting the heap. The corruption
manifested as SIGSEGV/SIGABRT at the next malloc or free — in
fontconfig, Mesa, RReleaseImage, etc. depending on timing.

Fix: call W_RegisterBacking(fb->id, fb->image) after reallocation in
both resize paths.
2026-06-24 21:59:53 +02:00
lkn 7f6a7b66d1 detach scene buffer before all pixman image replacements
Call wlr_scene_buffer_set_buffer(NULL) before freeing the old pixman
image in every resize path (client configure, frame configure,
workspace badge, balloon). This ensures the scene graph never holds
a dangling reference to freed pixel data.
2026-06-23 21:42:00 +02:00
lkn 49a0b50a6d fix widget rendering: stop polluting view_table with frame_buf IDs
Frame_buf IDs (0x10000000-0x1FFFFFFF) were registered in the 256-entry
view_table alongside WINGs views, filling it with tombstones until
lookups failed. Now frame_buf IDs are excluded from the table; the 3
callers that passed frame_buf IDs to WMDrawString pass raw pixman
pointers instead.
2026-06-23 21:22:14 +02:00
lkn b6ad1df42e wayland: implement dockapp rendering inside dock icons
XWayland dockapps (wmclock, etc.) now render their content inside the
dock icon tile instead of in a separate window.

Key changes:
- wl_props.c: implement wl_prop_get_wm_hints for XWayland surfaces,
  reading xcb_icccm_wm_hints_t to detect WithdrawnState dockapps
- appicon.c: for is_dockapp windows, use client_win as icon_win
- icon.c: capture icon_window pixels via XGetImage with XShape mask
  for transparency, skip surface embedding when image is captured
- wl_icon.c: create_rimage_from_drawable handles X11 Window IDs via
  XGetImage, applies XShape bounding rectangles as alpha mask
- wl_stubs.c: pixmap_get_size returns actual view dimensions
- wl_window.c: map XWayland dockapp windows and reparent icon_window
  child into main window for compositing
2026-06-23 12:55:48 +02:00
lkn bb95bd52cd wayland: apply CSD geometry offset in wl_window_move
Without this, moving a CSD client (Firefox) causes the surface to
"pop" out of the WM frame — the scene node was positioned at the
raw frame-relative coords without subtracting geometry.x/y.
2026-06-21 19:18:20 +02:00
lkn ec0a94e077 wayland: fix dock ghost shadow z-order (render below icon)
The dock_shadow was rendering above the dragged icon because:
1. It was in WL_LAYER_OVERLAY/DOCK, above the dock icons in WL_LAYER_FLOATING
2. wl_stacking_restack could not order nodes across different parent trees
3. wl_window_map auto-raised on map, undoing any prior restack

Fixes:
- Place dock_shadow in WL_LAYER_FLOATING (where WMDockLevel=5 maps)
- Rewrite wl_stacking_restack to reparent nodes into the same tree
  and use wlr_scene_node_place_below for guaranteed ordering
- Remove auto-raise from wl_window_map (explicit wRaiseFrame handles it)
2026-06-21 18:49:19 +02:00
lkn 6a37107716 wl_window_resize: update backing store after resizing pixman image
When wl_window_resize frees the old pixman image and creates a new one,
it must call W_RegisterBacking to update the backing store. Otherwise
W_GetViewBacking returns the freed old image pointer, causing a crash
when WMDrawString (via wl_font_resolve_drawable) tries to draw into
the stale backing. This manifests on workspace name badge display
in direct render mode.
2026-06-07 09:49:09 +02:00
lkn 60c43b734a fix combined build: mark stub functions __attribute__((weak)) to resolve multiple-definition conflicts when linking both X11 and Wayland backends 2026-06-06 09:36:03 +02:00
Window Maker b546e9505d fix XWayland-only build: provide unconditional stub for get_window_image_from_x11 in wl_window.c so it links without the X11 backend 2026-06-05 19:40:46 +02:00
Window Maker 0453888f08 split USE_X11_BACKEND from XWayland: USE_XWAYLAND now controls X11 support in the wayland backend (X11 wrapper functions, error handlers, XWayland event loop, X11 window helpers), separate from USE_X11_BACKEND which controls the x11_backend.c classic WM mode 2026-06-05 19:09:55 +02:00
Window Maker 8c11b96ebc confine X11 calls to wl_xdisplay.c and wl_xwayland.c: wrap X11 function bodies in #if USE_X11_BACKEND with stubs, guard wl_backend.c X11 blocks, remove <X11/Xlib.h> from wl_atom.c/wl_event.c/wl_client.c/wl_framebuf.c 2026-06-05 18:36:07 +02:00
Window Maker 8c1cbfaca8 Wayland-only build: guard X11 backend in Makefile.am, add wm_backend.c, WINGs _wl.c stubs 2026-06-04 08:07:21 +02:00
Window Maker 29aeffd6ac decompose wl_stubs.c: move remaining real implementations to module files 2026-06-02 21:25:27 +02:00
Window Maker 859af074ad cleanup: remove stale Phase planning comments from all wayland backend files 2026-06-02 20:23:26 +02:00
Window Maker 273589092d decompose wl_backend.c: extract wl_window.c (window map/unmap/move/resize/border/clear) 2026-06-02 10:18:57 +02:00
Window Maker b9450d16ad remove corrupted extraction files not yet building 2026-06-02 10:07:29 +02:00
Window Maker 5175cf880c decompose wl_backend.c: extract event, stacking, overlay modules 2026-06-02 10:07:10 +02:00