Levi Neely
9cfe322573
Phase 80b: eliminate if(dpy) guards and replace X11 calls with vtable dispatch
...
- Remove all 20 'if (dpy &&' guards from policy files
- Replace XMapWindow, XUnmapWindow, XMoveWindow, XClearWindow,
XFreePixmap, XFlush, XSync, XResizeWindow, XSetWindowBackground,
XSetWindowBackgroundPixmap, XMoveResizeWindow, XSelectInput,
XMapRaised, XUngrabPointer, XUngrabKeyboard, XGrabKeyboard,
XGrabServer, XUngrabServer, XRestackWindows, XDestroyWindow,
XReparentWindow, XAddToSaveSet, XSetWindowBorderWidth
with vtable dispatch across all policy files
- Make wFrameWindowPaint mechanism code: X11 backend's frame_paint
now calls it; all policy call sites dispatch through vtable
- Replace dpy feature-gating in main.c/startup.c with is_wayland
Remaining: 278 dpy refs in policy files, mostly in rendering functions
(wIconPaint, wAppIconPaint, paintEntry, drawFrame, balloon, dock,
dialog, superfluous, event) that are X11 mechanism code reachable
only through the X11 backend path.
2026-05-13 10:21:00 +02:00
Levi Neely
553d2ca0ba
Phase 80: eliminate all 43 if(!dpy) return guards via vtable dispatch
...
Remove every 'if (!dpy) return' guard from policy files by moving
X11 mechanism code behind WMBackend vtable slots. Call sites now
dispatch through wm_backend->slot(), the X11 backend implements the
mechanism, and the Wayland backend provides no-ops or Wayland-native
implementations.
New vtable slots added to backend.h:
- Frame: frame_alloc_border_pixel, frame_update_texture, frame_paint_button
- NETWM: netwm_init, netwm_cleanup, netwm_update_desktop,
netwm_get_current_desktop, netwm_update_opacity, netwm_update_actions,
netwm_check_client_hints, netwm_check_initial_state, netwm_get_pid,
netwm_cleanup_frame_extents
- Properties: prop_get_protocols, prop_get_check_property,
prop_set_wmaker_protocols, prop_set_icon_tile, prop_cleanup
- Client: client_restore, client_set_state, client_send_protocol,
client_kill, client_get_colormap_windows
- Misc: eat_expose, move_window, slide_windows, get_text_selection,
get_shortcut_string, get_command_for_window
- Icon: icon_update_pixmap, icon_paint
- AppIcon: appicon_show, appicon_paint, appicon_bounce
- Shutdown: restore_desktop, wipe_desktop
- Resources: get_color_for_colormap, free_color, colormap_install
- Protocol: xdnd_init, motif_get_hints
- Startup: manage_all_windows
- Event: event_handle_signal_exit
Structural changes:
- MWMHints moved from motif.c local typedef to motif.h
- WProtocols given struct tag for forward declaration
- Static functions made non-static: wGetTextSelection, wGetCommandForWindow,
wGetMWMHints, wWipeDesktop, wManageAllWindows, wNETWMUpdateWindowOpacity
Verification: grep -rn 'if (!dpy)' src/*.c returns zero results.
nm wl_backend.o confirms no new X11 symbols in Wayland path.
2026-05-13 10:01:57 +02:00
Levi Neely
00deab12f2
wayland: WMBackend vtable — port policy files off direct X11
...
Move X11-specific calls in policy code behind the wm_backend dispatch
table so the same code paths work with both X11 and Wayland backends.
backend.h — extend WMBackend vtable with new entry points
event.c — route input events through backend dispatch
framewin.c — title-bar rendering via backend surface ops
icon.c — icon pixmap handling via backend abstraction
main.c — backend selection + initialisation at startup
misc.c — miscellaneous X11 helpers moved behind vtable
pixmap.c — pixmap creation/destruction via backend ops
resources.c — resource loading abstracted over backend
screen.c — screen setup routed through WMBackend vtable
startup.c — startup sequence uses backend entry points
texture.c — texture rendering abstracted for both backends
No functional change on X11; Wayland backend stubs return safe no-ops.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 13:34:05 +02:00
Levi Neely
e82bb279ab
wayland: Phase 59 — guard SetupEnvironment rcontext NULL deref
...
scr->rcontext is NULL in the Wayland path (RContextCreate is only
called under dpy). SetupEnvironment() is reachable via shell command
launch and RelaunchWindow; wrap the WRASTER_COLOR_RESOLUTION putenv
in a scr->rcontext NULL-check to prevent a crash.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 07:46:06 +01:00
Levi Neely
f7dfc50f26
wayland: Phase 33 — event_loop_run/atom_intern vtable; wmaker starts and exits cleanly under Wayland
...
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>
2026-03-27 23:02:26 +01: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
a486329b52
Wayland backend abstraction: WMBackend vtable (Phases 0–30)
...
Introduce a display-system-agnostic WMBackend vtable that routes all
display operations through function pointers, making the WM policy
layer independent of X11. The X11 implementation is preserved in
src/backend/x11/ and behaviour is unchanged.
Key structural changes
──────────────────────
• src/backend/backend_types.h — backend-neutral type definitions:
WNativeWindow, WKeyCode, WContextKey, WBackendScreen,
WBackendEvent (+typed fields), WNormalHints, WWMHints,
WNETWindowType, WHeadGeometry, WClientAttributes, WClientVisual,
WSegment, WPoint, WM_KEY_* keysym constants, WA_* atom IDs,
WKB_GROUP*_INDEX, WCUR_NONE
• src/backend/backend.h — WMBackend vtable (~100 function-pointer
slots) covering: frame/context lifecycle, stacking, focus, grabs,
pointer, keyboard, overlays, properties, ICCCM, EWMH/NETWM,
monitors, screen setup, cursors, extensions, error handlers.
No <X11/> headers remain in this file after Phase 30.
• src/backend/x11/ — X11 backend implementation:
x11_backend.c full vtable; all display calls confined here
x11_props.c WM_NORMAL_HINTS / WM_HINTS translation
x11_event.c XEvent → WBackendEvent translation
x11_monitor.c Xinerama / RandR monitor query
Policy files cleaned
────────────────────
All 47 files in WM_POLICY_CLEAN_FILES pass check-no-x11-policy
(no direct #include <X11/> anywhere). X11 types that still appear
in policy structs (Visual*, Colormap, Window, Atom …) arrive only
transitively via WINGs.h; the vtable boundary itself is X11-free.
Tests
─────
• tests/smoke-test.sh — full Xvfb lifecycle test (PASS)
• tests/test_geom.c — geometry / constraint unit tests
• tests/test_x11_event.c — WBackendEvent field extraction tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 19:20:00 +01:00
Levi Neely
fcee811b99
WindowMaker 0.96.0 upstream source
2026-03-26 15:38:49 +01:00