Commit Graph

47 Commits

Author SHA1 Message Date
Window Maker 189fde4a19 decompose wl_backend.c: extract wl_virtual_pointer.c 2026-06-02 16:17:44 +02:00
Window Maker 82c08973dd decompose wl_backend.c: extract wl_layer_shell.c 2026-06-02 16:13:15 +02:00
Window Maker 27b59ca388 decompose wl_backend.c: extract wl_xdg_activation.c 2026-06-02 16:11:42 +02:00
Window Maker 52182fcbec decompose wl_backend.c: extract wl_text_input.c 2026-06-02 16:10:42 +02:00
Window Maker 84a2be36c3 decompose wl_backend.c: extract wl_output_mgmt.c 2026-06-02 16:09:42 +02:00
Window Maker e3a8c5d74b decompose wl_backend.c: extract wl_output.c 2026-06-02 16:07:34 +02:00
Window Maker 053ed4e6b3 decompose wl_backend.c: extract wl_xdg.c 2026-06-02 16:05:18 +02:00
Window Maker ac4aa4fe4d decompose wl_backend.c: extract wl_popup.c 2026-06-02 16:01:22 +02:00
Window Maker c46adc93c5 decompose wl_backend.c: extract wl_xwayland.c 2026-06-02 15:53:48 +02:00
Window Maker 5a2faa765a decompose wl_backend.c: extract wl_dock.c 2026-06-02 15:49:44 +02:00
Window Maker 698d4dfba7 decompose wl_backend.c: extract wl_input_fwd.c + make pointer button/frame/axis non-static 2026-06-02 15:47:08 +02:00
Window Maker a1a23099ba decompose wl_backend.c: extract wl_keyboard.c 2026-06-02 15:43:44 +02:00
Window Maker 6df031f834 decompose wl_backend.c: extract wl_grab.c 2026-06-02 15:42:02 +02:00
Window Maker b06e9417ca decompose wl_backend.c: extract wl_pointer_focus.c 2026-06-02 15:39:19 +02:00
Window Maker 2e22c290ac decompose wl_backend.c: extract wl_pointer_motion.c 2026-06-02 14:35:02 +02:00
Window Maker 28fb61668f decompose wl_backend.c: extract wl_dragicon.c 2026-06-02 14:30:57 +02:00
Window Maker 7b02d32a02 decompose wl_backend.c: extract wl_grabstate.c 2026-06-02 14:26:30 +02:00
Window Maker 9f69f7930d decompose wl_backend.c: extract wl_grabs.c 2026-06-02 14:25:01 +02:00
Window Maker e19562a07c decompose wl_backend.c: extract wl_dnd.c 2026-06-02 14:22:24 +02:00
Window Maker f6cf67cb39 decompose wl_backend.c: extract wl_clipboard.c 2026-06-02 14:15:10 +02:00
Window Maker 5fd0eda8d2 decompose wl_backend.c: extract wl_stubs.c (noop stubs + vtable) 2026-06-02 12:40:56 +02:00
Window Maker dceb0cf55b decompose wl_backend.c: extract wl_xdisplay.c 2026-06-02 12:12:22 +02:00
Window Maker bce1aaa62c decompose wl_backend.c: extract wl_wings.c 2026-06-02 12:06:16 +02:00
Window Maker 5e5e4dbd02 decompose wl_backend.c: extract wl_shm.c 2026-06-02 12:03:25 +02:00
Window Maker e1c221948c decompose wl_backend.c: extract wl_screen.c 2026-06-02 12:01:06 +02:00
Window Maker 89668f0202 decompose wl_backend.c: extract wl_focus.c 2026-06-02 11:59:38 +02:00
Window Maker 6044c6418b decompose wl_backend.c: extract wl_events.c 2026-06-02 11:58:23 +02:00
Window Maker a9a3f0ff1d decompose wl_backend.c: extract wl_extensions.c 2026-06-02 11:49:35 +02:00
Window Maker c60c20bf49 decompose wl_backend.c: extract wl_fakeleader.c 2026-06-02 11:08:52 +02:00
Window Maker db0db065a1 decompose wl_backend.c: extract wl_badge.c 2026-06-02 11:07:56 +02:00
Window Maker 0878f6946d decompose wl_backend.c: extract wl_xkb.c 2026-06-02 11:06:53 +02:00
Window Maker ba7b7de898 decompose wl_backend.c: extract wl_signalfd.c 2026-06-02 10:45:56 +02:00
Window Maker 33f686c79f decompose wl_backend.c: extract wl_atom.c 2026-06-02 10:42:28 +02:00
Window Maker e47b44ccd0 decompose wl_backend.c: extract wl_framebuf.c 2026-06-02 10:41:30 +02:00
Window Maker 861ae10c8f decompose wl_backend.c: extract wl_icccm.c 2026-06-02 10:36:07 +02:00
Window Maker cbc9fa5a84 decompose wl_backend.c: extract wl_client.c 2026-06-02 10:28:48 +02:00
Window Maker 36cdc48f23 decompose wl_backend.c: extract wl_props.c 2026-06-02 10:25:02 +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 5175cf880c decompose wl_backend.c: extract event, stacking, overlay modules 2026-06-02 10:07:10 +02:00
Window Maker 758623269b extract context from wl_backend 2026-05-31 12:34:04 +02:00
Window Maker 60348da411 Implement wmaker-popup-v1 Wayland protocol for client-driven popup positioning
Standard xdg_shell does not allow Wayland clients to position toplevels —
the compositor decides placement.  WINGs UI patterns require client-driven
positioning (e.g., a dropdown popup must appear directly below its trigger
button; menu editor items must be placed by the client at specific screen
coordinates).

This protocol lets the client wrap an xdg_toplevel with a wmaker_popup
object and call set_position(x, y) before the surface is mapped.  The
compositor honours the requested position when the surface becomes visible
and on subsequent set_position calls.

Files:
- protocols/wmaker-popup-v1.xml: protocol definition
- src/Makefile.am, src/Makefile: server-protocol.h + protocol.c generation
- WINGs/Makefile.am, WINGs/Makefile: client-protocol.h + protocol.c generation
- src/backend/wayland/wl_backend.c: wmaker_popup_manager global, get_popup
  handler that wraps an xdg_toplevel; set_position handler that updates
  view->popup_x/y and calls wmaker_popup_apply to move the frame_buf
  scene tree.  Apply runs at toplevel_map time too for pre-map positions.
- WINGs/wclient_wl.c: bind manager in registry, wrap popup toplevels with
  wmaker_popup, expose W_WLClientPopupSetPosition.
- WINGs/wview_wl.c: wl_move calls W_WLClientPopupSetPosition for popup
  toplevels so WMMoveWidget propagates to the compositor.
- WINGs/wevent_wl.c: wl_move_window also routes to popup positioning.
2026-05-24 18:27:55 +02:00
Window Maker a2cb136f8a arch: move wmspec.c (EWMH) and xdnd.c (XDND) into src/backend/x11/
Both files implement X11-specific protocols (EWMH _NET_* and XDND).
They were sitting in shared src/ because they predated the backend
split; the only remaining users in shared code were now via
wm_backend-> dispatch.

To get there, four new vtable slots replace the last direct calls
from shared src/:

  screen_get_head_usable_area  (screen.c was calling wNETWMGetUsableArea)
  window_get_icon_image        (icon.c was calling get_window_image_from_x11)
  netwm_set_frame_extents      (window.c, winspector.c were calling wNETFrameExtents)
  (window_fetch_name and window_get_icon_name extended to consult EWMH first)

Other changes:
  * get_window_image_from_x11 now takes Display* explicitly so the
    Wayland backend can pass wl_state.x_display for XWayland clients
    instead of relying on a global (which is NULL on Wayland).
  * Eight shared .c files lose their now-unused #include "wmspec.h"
    or #include "xdnd.h".
  * Makefile.am moves wmspec.{c,h} and xdnd.{c,h} into the backend/x11
    listing.
  * src/Makefile.am drops the obsolete --disable-xdnd Makefile branch
    and unconditional sources list still references the new paths.

Final state: every Xlib call in the codebase lives in src/backend/x11/
or src/backend/wayland/.  The only remaining "X*(" matches outside
backend/ are six XSetForeground/XDrawLine calls in src/moveres.c
inside an \#if 0 block (dead code; left for now).  src/ has zero
_x11_raw references.
2026-05-24 09:16:39 +02:00
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 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 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 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