Commit Graph

7 Commits

Author SHA1 Message Date
Window Maker eaea7464b2 arch: drop USE_DOCK_XDND guards from shared src/
The XDND-on-dock feature was a configure-time toggle (--disable-xdnd)
gating ~25 #ifdef sites across shared src/.  This was a pre-Wayland
feature flag, not a backend distinction, but it polluted the policy
layer with build-time conditionals.

Make it unconditional:

  configure.ac    Remove --disable-xdnd and AM_CONDITIONAL.  XDND on
                  the dock is always built.
  src/Makefile.am Move xdnd.c from the if-USE_DOCK_XDND block into
                  the unconditional wmaker_SOURCES list.
  src/dock.h, dock.c, dockedapp.c, appicon.h, appicon.c, event.c,
  misc.c, startup.c, dialog.c, screen.h
                  Strip all #ifdef USE_DOCK_XDND/#endif pairs.  In
                  dockedapp.c the #else branch (rendering an 'XDnD
                  support was not compiled in' label) is dead and
                  removed.

Backend routing: the X11 backend continues to drive the XDND protocol
through xdnd.c via the existing xdnd_process_client_message /
xdnd_process_selection / xdnd_make_awareness vtable slots.  Wayland's
slots are no-ops (XWayland clients drop into the X11 path naturally
via wl_state.x_display).

src/ is now free of feature-flag guards related to DnD.
2026-05-24 08:55:43 +02:00
Levi Neely 9b2448dd7f WIP: Wayland backend - fix atoms, OR surface compositing, frame/window ops
Key changes in wl_backend.c:
- wl_atom_intern: call XInternAtom on XWayland display (was returning 0)
- Add wl_or_view struct to track override_redirect XWayland surfaces
- handle_xwayland_new_surface: composite OR surfaces via scene graph
- frame_create_toplevel/child: create real X11 windows on XWayland
- frame_destroy/configure: delegate to Xlib
- window_map/unmap/move/resize: fall through to Xlib for frame windows
- stacking_raise/lower: update scene graph + Xlib fallback
- event_flush/sync: call XFlush/XSync on XWayland display
- window_set_border/border_width/clear: delegate to Xlib
- window_get_rect: query XWayland geometry for non-toplevel windows

Note: frame creation via XWayland is a temporary bridge. The correct
architectural approach is native scene-buffer rendering with pixman.
2026-05-13 07:05:22 +02:00
Levi Neely 2d9b9b76c5 wayland: migrate wlroots 0.16 API to 0.19 + animation overlay system
Port from wlroots ~0.16 to 0.19 (Gentoo slotted packages) and add the
Phase 81 XOR animation overlay.  Fixes Gentoo build from scratch.

configure.ac: detect wlroots-0.19 versioned slot before falling back to
unversioned; fixes "Package wlroots was not found" on Gentoo.

startup.c: add missing <X11/Xresource.h> for XrmUniqueQuark on Gentoo's
stricter X11 headers.

wl_backend.c — wlroots 0.16→0.19 API migration:
- Backend creation: display* → wl_event_loop* (get_event_loop)
- wlr_output_layout_create gains display* arg
- Output configuration: wlr_output_enable/commit/set_mode → wlr_output_state API
- wlr_output_layout_get_box: returns void, writes to caller-supplied box
- Scene graph: scene root is scene->tree (wlr_scene_tree*); create
  functions return/accept wlr_scene_tree*; scene_node.state.x/y → .x/.y
- wlr_scene_output_commit gains options arg (NULL)
- Protocol globals gain version args: compositor(6), xdg_shell(3),
  layer_shell(4), linux_dmabuf_with_renderer(4), presentation(1)
- Input: dev->keyboard/pointer embedded fields removed; use
  wlr_keyboard/pointer_from_input_device(); headless backend no longer
  has input devices; XKB keymap created independently at startup
- Keyboard: wlr_event_keyboard_key → wlr_keyboard_key_event;
  wlr_seat_set_keyboard takes wlr_keyboard* directly
- Pointer: all wlr_event_pointer_* → wlr_pointer_*_event;
  wlr_seat_pointer_notify_axis gains relative_direction arg;
  wlr_cursor_warp_absolute uses &ev->pointer->base
- Cursor: wlr_xcursor_manager_set_cursor_image → wlr_cursor_set_xcursor
- XDG shell: xdg_surface->events.map/unmap → surface->events.map/unmap;
  xdg_surface->mapped → surface->mapped; toplevel_set_size/send_close/
  parent take wlr_xdg_toplevel*
- XWayland: events.map/unmap → events.associate/dissociate;
  xw->mapped → xw->surface->mapped; size_hints is xcb_size_hints_t*
- Layer shell: ls->events.map/unmap → ls->surface->events.map/unmap
- wlr_buffer: include wlr/interfaces/wlr_buffer.h for wlr_buffer_init
- Remove wlr_input_inhibitor and wlr_idle (dropped in wlroots 0.18)

wl_backend.c — Phase 81 XOR animation overlay:
- Full-screen pixman SHM overlay surface for move/resize rubber-band
  guides and miniaturize animations
- Embedded 5×9 bitmap font (96 printable ASCII glyphs)
- Bresenham line drawing; hline/vline fast paths
- overlay_ensure: lazy alloc/resize tied to WScreen dimensions
- server_ungrab flushes overlay to scene graph

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 18:51:05 +02:00
Levi Neely 1dde83e05e wayland: Phase 29 — pixman SHM surface primitives
Add wm_shm_surface: a compositor-owned pixel buffer that bridges pixman
software rendering to the wlroots scene graph.

The struct embeds a wlr_buffer (wl_container_of compatible) so wlroots
can reference-count and GPU-upload the pixel data on demand via the
wlr_buffer_impl vtable (begin_data_ptr_access / end_data_ptr_access /
destroy).  A pixman_image_t wrapping the same malloc memory provides the
drawing API.

Four entry points:
  wm_shm_surface_create  — alloc + wlr_buffer_init + pixman_image_create
  wm_shm_surface_fill    — pixman_image_composite32(PIXMAN_OP_SRC, ...)
  wm_shm_surface_commit  — wlr_scene_buffer_create / set_position
  wm_shm_surface_destroy — scene node + wlr_buffer_drop (async free)

A 64×64 steel-blue (0xFF4080C0) test surface is committed to the root
scene node at (16,16) inside wl_screen_create_internals, proving the
pixman → wlr_scene_buffer upload pipeline works end-to-end.

Build fixes:
  - Add pixman-1 to PKG_CHECK_MODULES in configure.ac so -lpixman-1
    appears in WLROOTS_LIBS (linker was missing the symbol).
  - Add -I$(srcdir)/backend/wayland to AM_CPPFLAGS in Makefile.am so
    generated Wayland protocol headers are found during compilation.

Smoke test: PASS (all existing checks continue to pass; Phase 29 log
line "Phase 29 test surface committed" confirms the pipeline fires).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 13:31:06 +02:00
Levi Neely d07362b90e wayland: Phase 32 — display_open/close/screen_count through vtable
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>
2026-03-27 22:35:54 +01:00
Levi Neely d2632b8487 wayland: Phase 31 — Wayland backend skeleton (complete stub vtable)
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>
2026-03-27 22:12:41 +01:00
Levi Neely fcee811b99 WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00