The color picker dialog uses XGetImage / XGrabPointer / XShape /
XPutImage / XCopyArea to implement the magnify-glass screen picker.
Wayland intentionally does not allow reading pixels from other
windows (security), so the screen-pick feature has no Wayland
equivalent. The whole file is therefore X11-only.
A future commit will provide a stub that returns a wwarning when
WMShowColorPanel is called in Wayland mode.
Mechanical rename to make architectural intent visible:
dragsource.c → dragsource_x11.c
dragdestination.c → dragdestination_x11.c
selection.c → selection_x11.c
winputmethod.c → winputmethod_x11.c
wballoon.c → wballoon_x11.c
wappresource.c → wappresource_x11.c
Each is essentially a wrapper around X11 features (XDND, X11
selection, XIM, XShape, X11 WM hints) with no Wayland equivalent
yet. These files keep providing their public WINGs API symbols
unchanged, so build+link is identical at this point.
A future commit will add Wayland counterparts (or no-op stubs) and
wire a configure option that conditionally excludes *_x11.c when
the build is Wayland-client-only. Doing this now would force a
choice between linkable but Wayland-broken (no stubs) or partial
double-implementation (some functions stubbed); the right answer
needs vtable dispatchers in shared *.c files for each, which is
the next round of surgery.
dragcommon.c now contains only backend-neutral helpers
(WMCreateDragOperationArray/Item, accessors, W_FreeViewXdndPart).
dragcommon_x11.c is new and owns:
- W_OperationToAction/W_ActionToOperation atom translation
- windowExists / handleNoWindowXError probe
- W_SendDnDClientMessage XSendEvent path
- W_HandleDNDClientMessage XDND wire dispatch
- handleLeaveMessage
These touch scr->xdnd*Atom fields and call XSendEvent / XGetAtomName /
XSetErrorHandler etc. — strictly X11. Wayland DnD will be added later
through wl_data_device.
dragsource.c and dragdestination.c still contain Xlib calls; those
splits come next.
WINGs/widgets.c is now Xlib-call-free. All Xlib code moved to a new
WINGs/widgets_x11.c:
* W_X11PlatformInit (~178 lines): GC creation, modifier-mask probe,
cut-buffer setup, cursor/atom/IM init. Hooked from
W_ViewBackendX11.platform_init exactly as before.
* W_X11OpenDisplay: XOpenDisplay + WMCreateSimpleApplicationScreen.
WMOpenScreen() in widgets.c now calls this for the X11 path.
Dead code removed: the static renderPixmap that nothing called and
that was the last X11-direct-draw path in widgets.c.
X11 includes dropped from widgets.c. Display * typedef still resolves
through WINGsP.h transitively until phase ε removes that.
Build verified clean, wmaker still links and runs.
Task 1 + 2 of the WINGs Wayland-client backend.
Adds optional --enable-wayland-client (default auto) which depends on
wayland-client, xkbcommon, wayland-protocols, and wayland-scanner.
configure.ac probes for these and exposes WAYLAND_CLIENT_CFLAGS/LIBS
plus the protocols data dir and scanner path.
WINGs/Makefile.am wires a wayland-scanner rule that generates
xdg-shell-{protocol,client-protocol}.{c,h} at build time and links
libWINGs against wayland-client + xkbcommon when enabled.
WINGs/wclient_wl.c is the new file. It self-stubs when the feature
is disabled. When enabled it provides:
W_WLClientInit(scrPtr, display)
Connects via wl_display_connect, registers a wl_registry listener,
binds wl_compositor/wl_shm/wl_seat/xdg_wm_base, creates an xkb_context,
and hooks the libwayland event pump into the existing
W_EventBackendWL via W_WL_SetLoopDispatch(). This lets the existing
ring-buffer event mechanism keep working unchanged: the ring is fed
by client-side wl_pointer/wl_keyboard listeners (next task) and
drained by WMNextEvent / WMMaskEvent / waitForEvent.
W_WLClientShutdown(scrPtr)
Tears down all bound globals and disconnects the wl_display.
No surfaces / buffers / input dispatch yet — those come in tasks 3-5.
Build verified clean, wmaker still links and runs as before.
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.