Previous version used fprintf which buffers and may not flush before
_exit if the crash happened mid-libc. Use write() + fsync() so the
backtrace appears in the log even if the crash is deep in a library.
The WPrefs menu editor creates standalone draggable windows for each
menu item via W_CreateTopView. On X11 these are override-redirect
windows. On Wayland they were becoming framed XDG toplevels with
taskbar entries, cluttering the desktop with phantom 'WINGs...' tabs.
Implementation:
1. New W_View flags.popup field, set by editmenu's standalone mode
2. wclient_wl: when realizing a popup view, set xdg_toplevel app_id
to 'wings-popup' as a hint to the compositor
3. wmaker compositor: detect 'wings-popup' app_id in toplevel_map,
set borderless + skip-taskbar + skip-switchpanel flags, then call
wWindowConfigureBorders to rebuild the frame without decorations
4. New W_EventBackend->window_begin_move vtable method:
- X11: returns False (caller runs manual drag loop)
- Wayland: calls xdg_toplevel_move, returns True (compositor drives drag)
5. editmenu's dragMenu calls window_begin_move first; on Wayland the
compositor handles the entire drag, so the manual loop is skipped
WMEButton.x is at offset 40, WMEMotion.x is at offset 48. The
scroller widget reads event->u.button.x for motion events (legacy
X11 code where XButtonEvent and XMotionEvent have x at the same
offset). Set both union members so widgets reading either get
correct coordinates.
On X11, a button press creates an implicit pointer grab — all
subsequent motion and release events go to the window that received
the press, even if the pointer moves outside it. This is essential
for scroller knob dragging, window resize handles, etc.
Implement the same for Wayland client: on button press, record the
target view as wlc_ptr_grab. Motion events during the grab are
delivered to the grabbed view with coordinates translated relative
to it. On button release, deliver to the grabbed view and clear
the grab. Enter/leave synthesis is suppressed during grabs.
The viewport's event handler is registered for SUBSTRUCTURE_NOTIFY.
WMHandleEvent switches from STRUCTURE_NOTIFY to SUBSTRUCTURE_NOTIFY
when event.window != configure.event. The event was incorrectly
setting both to the parent window. Fix: set event.window to the
child (resized view) so the mismatch triggers the SubstructureNotify
path.
On X11, resizing a child window generates a ConfigureNotify event
delivered to the parent. Scroll views rely on this to update scroller
proportions when the content view is resized. On Wayland, wl_resize
never generated this event, so the scroller's documentFullyVisible
flag stayed at 1 (set during initial setup when content was small)
and paintScroller drew only a stippled 'full' indicator instead of
the knob/track.
Fix: when a mapped non-toplevel view is resized, dispatch a
WME_CONFIGURE event to its parent synchronously.
WMSetWindowMinSize/MaxSize were no-ops on Wayland. Implement
wl_window_set_geometry to call xdg_toplevel_set_min_size/max_size.
WPrefs sets min=max=520x390, making it non-resizable.
The configure event was enqueued for later processing but the redisplay
happened immediately, painting children at their old positions. Now
WMHandleEvent is called directly with the configure event so widget
delegates relayout children before the redisplay paints them.
Also removed scroller debug logging.
When the compositor sends a new size via xdg_surface.configure, the
client buffer was reallocated but content was never repainted into it.
The surface was committed with an empty buffer, making the window
content disappear after resize.
Fix: after resizing the buffer in xdg_surface_handle_configure, call
wl_redisplay on the toplevel view to repaint all widget content into
the new buffer before committing.
Non-toplevel views mapped after the toplevel (e.g., icon buttons added
during Init* calls) need to trigger a redisplay to become visible.
Instead of redisplaying the view itself (which crashed during
realization), find the toplevel ancestor and redisplay from there.
Guards:
- All ancestors must be realized (prevents crash during W_RealizeView)
- Toplevel must be mapped (prevents premature redisplay)
- wl_redisplay_depth==0 (prevents re-entrancy)
The parent-backing-check approach was too fragile. Simplify: wl_map
only triggers wl_redisplay for toplevel views. Non-toplevel views
become visible through:
1. render_wl_pixmap_copy composite-up (when widget paints itself)
2. wl_map_subviews (which redisplays the parent after mapping children)
3. Parent's recursive wl_redisplay (which iterates all mapped children)
This avoids crashes during W_RealizeView recursion where children are
mapped before the widget tree is fully constructed.
During W_RealizeView recursion, children are realized and mapped
before their parent's backing pixman image exists. wl_map triggered
wl_redisplay which sent an expose event, the widget painted itself,
and render_wl_pixmap_copy tried to composite up through the parent
chain — hitting a NULL pixman image in pixman_image_composite32.
Fix: before triggering wl_redisplay from wl_map, walk up the parent
chain and verify all ancestors have valid backings. If any ancestor
lacks a backing (still being realized), skip the redisplay — the
parent's wl_map will handle it once the full tree is ready.
WindowHandling.c and Icons.c called WidthOfScreen(DefaultScreenOfDisplay(
WMScreenDisplay(scr))) which dereferences NULL on Wayland (no X Display).
Use WMScreenWidth/WMScreenHeight instead — these work on both backends.
Also added temporary SIGSEGV backtrace handler to main.c for debugging.
When a panel's createWidgets callback maps child widgets, each
WMMapWidget triggered wl_redisplay which sent expose events. Those
expose handlers could create/destroy more widgets, causing re-entrant
modification of the view tree during iteration — segfault.
Fix: track wl_redisplay call depth. wl_map only triggers wl_redisplay
when depth==0 (not already inside a redisplay). Child views mapped
during a redisplay cycle will be painted by the parent's recursive
child iteration instead.
Also save nextSister before recursing into children to handle list
modifications during iteration.
When a button click triggers changeSection which destroys widgets
(nameL, versionL, statusL) and then maps new ones, the recursive
wl_redisplay and the composite-up in render_wl_pixmap_copy could
encounter views marked alreadyDead or with freed backings.
Add alreadyDead checks to:
- wl_redisplay entry (skip dead views)
- wl_redisplay child iteration (skip dead children)
- render_wl_pixmap_copy composite-up loop (stop at dead views)
The inner 'double sx, sy' declaration shadowed the outer one. When
view_surface_at succeeded inside the frame_buf check, the surface-local
coordinates were written to the inner variables and lost. The outer
sx/sy (used by wlr_seat_pointer_notify_enter/motion) remained
uninitialized, causing the client to receive garbage coordinates.
Also removed debug print from wclient_wl.c.
frame_buf_at() matches the entire window frame tree including the
client content area. This caused wl_update_pointer_focus to never
set seat pointer focus on the client surface, so Wayland clients
(like WPrefs) never received pointer enter/motion/button events.
Fix: when frame_buf_at returns a hit, also check view_surface_at.
If a client surface is found at the pointer position, use it instead
of treating the area as WM-internal decorations.
On X11, painting to a window pixmap (via XCopyArea in the DOUBLE_BUFFER
path) makes content immediately visible because the X server handles
display. On Wayland, writing to a view's backing pixman image has no
effect until it's composited up through the parent chain to the toplevel
surface and committed.
When render_wl_pixmap_copy detects the destination is a registered view
backing (ID in 0x10000000-0x2FFFFFFF range), it now walks up the parent
chain compositing each view into its parent, then commits the toplevel.
This makes widget paint operations (labels, buttons, frames) immediately
visible without requiring a full wl_redisplay cycle.
Rendering: wl_map only triggered wl_redisplay for topLevel views.
Non-toplevel views (buttons, frames, labels) were mapped but never
painted. Now wl_map calls wl_redisplay for any realized view.
wl_redisplay already recurses into children, so wl_map_subviews is
simplified to just set mapped flags then redisplay the parent.
Input: pointer events were delivered to the toplevel view because
Wayland has a single surface per window (unlike X11 where each widget
has its own window). Added hit-testing via W_FindViewAtPoint to route
button press/release and motion events to the correct child view.
Also synthesizes enter/leave events as the pointer moves between
child views (needed for button highlight on hover).
wl_redisplay fills the view's background then paints widget content
via expose, but never re-composited child views. Children painted
earlier were erased by the parent's background fill. Now recursively
calls wl_redisplay on all mapped+realized children after the parent's
expose handler, so the full widget tree composites bottom-up.
WPrefs passes display_name="" by default. wl_display_connect("")
treats the empty string as a literal socket name and fails. Pass NULL
instead so it uses $WAYLAND_DISPLAY. Also handle the literal string
"wayland" (from detect matching) the same way.
wlclient_open passed NULL as the RContext, causing a segfault in
RConvertImageMask (called from makePixmap during screen init) when
WPrefs.app launched under Wayland.
Fix: call RCreateContextWayland() to create a valid 32-bit ARGB
context before passing it to WMCreateScreenWithRContext.
The user-facing root menu's 'Background → Images → Tiled' menu item runs
'wmsetbg -u -t image.jpg', which internally invokes wdwrite TWICE in
rapid succession:
1. wdwrite WindowMaker SmoothWorkspaceBack NO
2. wdwrite WindowMaker WorkspaceBack '(tpixmap, ...)'
Both writes complete within the same wall-clock second. The previous
mtime check used time_t (1-second precision):
if (timestamp < stbuf.st_mtime)
After the first write, wmaker reads the file (only SmoothWorkspaceBack
changed; WorkspaceBack still old) and sets timestamp = current second.
The second write happens in the same second, so st_mtime equals
timestamp exactly — the check fails and the second write is silently
ignored. The user has to invoke the menu twice for the change to apply.
Fix: WDDomain.timestamp is now struct timespec (nanosecond precision).
New MTIME_NEWER() macro compares full timespec values. Two writes within
the same second now have distinct nanosecond components so both are
detected.
Also removed all debug logging.
The atomic-rename pattern (mkstemp + rename) generates two relevant
events per save: IN_CLOSE_WRITE on the temp file (e.g.
WindowMaker.AjuyyW), then IN_MOVED_TO on the destination (WindowMaker).
Previously we reacted to IN_CLOSE_WRITE first and set oneShotFlag,
which then suppressed the IN_MOVED_TO. But at the time of
IN_CLOSE_WRITE, the rename hadn't happened yet — stat(WindowMaker)
returned the OLD mtime — so we'd skip and never re-check on the
subsequent IN_MOVED_TO either.
Fix: skip events on temp files (filenames containing a dot) and
react on IN_MOVED_TO for the actual destination filename. Direct
in-place writes (rare) are still handled via IN_CLOSE_WRITE for
non-temp filenames.
Also removed debug logging.
WMWritePropListToFile uses an atomic write pattern: write to a temp
file, fsync, fclose, then rename to the destination. The inotify
directory watch sees:
1. IN_CLOSE_WRITE on the temp file (WindowMaker.XXXXXX)
2. IN_MOVED_TO on WindowMaker (the rename)
We were only handling IN_CLOSE_WRITE, but at that point the rename
hadn't happened yet, so stat(WindowMaker) returned the OLD mtime
and we skipped. The NEXT save's IN_CLOSE_WRITE would then catch
the PREVIOUS save's mtime change — hence the 'one click behind'
pattern users observed.
Now handles IN_MOVED_TO too, catching the actual atomic replacement.
Also removed debug logging.
IN_MODIFY fires during the write, before the file is fully written.
The Wayland event loop's 16ms dispatch catches this almost instantly,
reading stale/partial content. IN_CLOSE_WRITE fires after the writer
closes the file, guaranteeing the content is complete.
This fixes the 'one step behind' issue where background changes only
appeared on the second apply.
Two issues:
1. bg_image scene node wasn't re-enabled when switching from solid
color back to an image background
2. No frame was scheduled after background change, so the compositor
wouldn't repaint until the next natural frame tick
Now explicitly enables the bg_image node and calls
wlr_output_schedule_frame() after any background change.
- tpixmap (Tiled): repeat image across screen
- spixmap (Scaled): stretch to exact screen dimensions
- cpixmap (Centered): place at center with background color fill
- mpixmap (Maximized): scale preserving aspect ratio, letterbox
- fpixmap (Filled): scale preserving aspect ratio, crop to fill
All modes now use RSmoothScaleImage for quality, respect the
background color (3rd texture argument) for uncovered areas, and
handle transparent images via RCombineImageWithColor.
The named color table only had basic colors (black, white, red, etc.)
but Window Maker backgrounds use extended X11 color names like
deepskyblue4, tomato4, blue4. Now falls back to parsing
/usr/share/X11/rgb.txt for any unrecognized color name.
Fixes Sunset and other multi-color gradient backgrounds that use
X11 named colors.
The color parser only handled #RRGGBB and rgb:XX/XX/XX formats, but
Window Maker backgrounds use X11 named colors (deepskyblue4, black,
tomato4, etc.). Now uses wGetColor() which resolves any color format
through the backend's color lookup.
Also: solid backgrounds now update the scene rect directly (faster,
no buffer allocation needed).
Added mvgradient/mhgradient/mdgradient handling using wrlib's
RRenderMultiGradient(). This covers presets like 'Sunset' which use
more than 2 color stops.
Also cleaned up color parsing (removed empty else branches) and
removed debug logging.
On X11, wmsetbg sets the root window pixmap. On Wayland there's no root
window, so the compositor must render the background directly.
Added wm_backend->set_desktop_background() vtable method:
- X11: NULL (wmsetbg continues to handle it)
- Wayland: parses the texture proplist description and renders:
- solid colors
- vertical/horizontal/diagonal gradients (via RRenderGradient)
- pixmap/spixmap/cpixmap images (via RLoadImage + RScaleImage)
The rendered image is displayed as a wlr_scene_buffer in the
WL_LAYER_BACKGROUND layer, replacing the static solid-color rect.
setWorkspaceBack() in defaults.c now calls the backend method when
available, so background changes from WPrefs take effect immediately.
tileObserver was calling window_clear after update_icon_pixmap, which on
Wayland overwrote the painted icon with just the background tile (erasing
clip workspace number/name text). On X11 this worked because XClearWindow
triggers an Expose event that repaints everything.
Fix: remove the redundant window_clear (update_icon_pixmap already calls
wIconPaint which does window_clear + icon_paint internally), and
explicitly call wClipIconPaint for the clip icon to redraw the workspace
number and name overlay.
wl_window_clear was filling with transparent black, which made dock/clip
icons disappear after a theme change. On X11, XClearWindow repaints the
window with its background pixmap — the Wayland backend now does the same.
Added bg_pixmap field to frame_buf, set in window_set_background_pixmap,
and used in window_clear to composite the background back into the buffer.
The Wayland event loop was missing inotify polling, so theme/style/
background changes from WPrefs (or manual edits to ~/GNUstep/Defaults/)
were never detected. The X11 backend had this since day one.
Now the Wayland event loop checks inotify on every iteration (non-blocking
select with zero timeout). When a config file modification is detected,
wDefaultsCheckDomains() is called, which re-reads the defaults database
and posts appearance-change notifications — triggering immediate visual
refresh of title bars, menus, icons, and backgrounds.
Replaced XCreatePixmap/XCopyArea/XCreateGC/XFreeGC/XFreePixmap with
RImage-based quadrant extraction: RLoadImage → RGetSubImage for each
corner → WMCreatePixmapFromRImage → WMSetLabelImage.
panel->quarter[] changed from WMNativePixmap to WMPixmap*.
Cleanup uses WMReleasePixmap instead of XFreePixmap.
Audit: every "X11 in src/" hit outside src/backend/x11/ and
src/backend/wayland/ is now either:
- a comment mentioning X11 by name, or
- a backend-neutral macro/type alias (WM_STATE_*, CW*, P*, etc.)
whose numeric value happens to match the X11 protocol value.
Zero <X11/...> includes in shared headers/sources.
Zero X11 type uses (XColor/XContext/XEvent/XFontStruct/XGCValues/
XWindowAttributes/XSetWindowAttributes/XErrorEvent etc.).
Zero X11 symbol references in compiled shared object files
(verified: `nm src/*.o | awk '$1=="U"' | grep '^X[A-Z][a-z]'`
returns empty).
Real architectural fixes:
src/backend/backend_types.h — added the missing backend-neutral
constants/types so shared code never names an X11 macro:
- WM_STATE_WITHDRAWN/NORMAL/ICONIC (ICCCM values 0/1/3).
- WContextID (typedef int) — XContext analogue.
- WMColorRGB (XColor-layout-compatible struct).
- CWX..CWStackMode (ConfigureWindow value-mask bits).
- ForgetGravity..StaticGravity (ICCCM win_gravity values).
- PMinSize..PWinGravity (XSizeHints flags) as WNH_* aliases.
- NoSymbol, NoEventMask, ColormapInstalled/Uninstalled.
- BitmapSuccess..BitmapNoMemory.
All guarded by #ifndef so the X11 backend's <X11/X.h> include
overrides them with the real X11 values when present.
src/screen.h — w_visual is now `void *` (was `Visual *`). Added
w_visual_id / w_visual_class so dialog.c's crash panel can read
visual info without dereferencing a Visual struct. tech_draw_font
is also `void *` with companion tech_draw_font_ascent/descent ints
populated by the backend (X11 from XFontStruct->ascent, Wayland
from a hard-coded bitmap-font metric).
src/WindowMaker.h — XContext fields → WContextID, X11 includes
removed, Time → WMNativeTime.
src/dialog.c — wShowCrashingDialogPanel now uses WMOpenScreen +
WMScreenWidth/Height instead of DefaultScreen()/ScreenOfDisplay()/
WidthOfScreen() so it works in either backend.
Dead-code cleanup found while auditing:
src/event.c — handleUnmapNotify and handleEnterNotify both built
an uninitialized `XEvent ev` and ran it through x11_translate_event
on a peeked queue event. The translation always read stack garbage
(the local was never populated). Replaced with the correct flow:
- unmap handler: skip wUnmanageWindow if a Destroy is already
queued, the Destroy handler will run it next iteration.
- enter handler: skip if a Leave for the same window is queued,
no need to inspect mode/detail (was always reading garbage).
Also dropped the now-unused x11_compat.h / x11_event.h includes
from event.c, dock.c, window.c.
src/misc.c — eatExpose's `XEvent event, foo` were never used; the
function delegates to wm_backend->event_flush_type(WME_EXPOSE).
src/wsmap.c — workspace_map_destroy built an XEvent ClientMessage
but never sent it; the actual notify path is switchpanel_send_enter.
Pass the real root_win argument (was passing literal 0) and drop
the dead XEvent.
src/icon.c — set_dockapp_in_icon's `XWindowAttributes attr` and
cycleColor's `XGCValues gcv` were unused.
src/window.c — windowLanguageClick had a function-signature
mismatch with framewin.h's on_click_language (XEvent* vs WMEvent*).
The framewin code passes a WMEvent. Fixed the parameter type and
its single use of event->xbutton.button.
src/moveres.c — already-disabled `#if 0` block in showPosition
that called XDrawLine / XSetForeground on the root window: removed.
Replaced tech_draw_font->ascent/descent dereferences with the new
flat int fields.
src/xutil.h — removed declarations of FormatXError (moved to X11
backend long ago) and Request/GetSelection (never implemented).
Mass renames in shared src/:
IconicState/NormalState/WithdrawnState → WM_STATE_ICONIC/NORMAL/
WITHDRAWN
IconWindowHint/InputHint/StateHint/IconPixmapHint/IconMaskHint/
IconPositionHint/WindowGroupHint/UrgencyHint
→ WMH_*_HINT
XColor (in struct fields and locals) → WMColorRGB
XContext (in screen.context.{...}) → WContextID
XPoint → WMShortPoint
XRectangle → WMShortRect
XFontStruct * → void *
Backends translate at the boundary:
src/backend/x11/x11_backend.c keeps its native XColor/XContext/
XFontStruct internally and casts to the backend-neutral types
at the public-API surface (memcpy works because WMColorRGB has
XColor's exact layout).
src/backend/wayland/wl_backend.c populates the same fields
directly without any X11 indirection.
Verified:
Default build: `Window Maker 0.96.0` runs.
Shared src/ object files: `nm | grep '^X[A-Z][a-z]'` is empty.
All shared X11 macro names (CW*, P*, ICCCM hint flags) are
defined locally in backend_types.h, no X11 dep needed.
Out of scope (separate refactor): wmaker compositor binary itself
still links libX11 because src/backend/x11/* and the XWayland
integration in src/backend/wayland/wl_backend.c need real X11
types. Both are below the vtable, so shared code is unaffected.
Phase θ — wrlib's X11 image-conversion path (RConvertImage,
RPutXImage, the X11 RCreateContext, libXpm-based RLoadXPM) is now
opt-out via --disable-x11-wraster, mirroring the WINGs phase η work.
Result: with --disable-x11-backend --disable-x11-wraster the WINGs
runtime libraries have ZERO libX11 transitive deps:
$ ldd WINGs/.libs/libWINGs.so | grep X11
(empty)
$ ldd wrlib/.libs/libwraster.so | grep X11
(empty)
That was the last libX11 transitive dep coming through WINGs — the
goal of the API surgery is now achieved at the library level.
configure.ac:
- New --enable-x11-wraster (default = same as --enable-x11-backend),
AM_CONDITIONAL([USE_X11_WRASTER]), AC_DEFINE([USE_X11_WRASTER]).
Forcing --disable-x11-wraster while --enable-x11-backend is rejected
(X11 backend depends on the X11 conversion path).
- WRASTER_GFXLIBS_NO_XPM: GFXLIBS with -lXpm filtered (libXpm pulls
libX11; load_xpm_normalized.c is the X11-free XPM loader used in
the disabled-X11 build).
- WINGS_PANGO_LIBS_NO_XFT: PANGO_LIBS with -lpangoxft-* and -lXft
filtered (PangoXft depends on libXft -> libX11; pangoft2 path is
the X11-free Pango variant).
wrlib/Makefile.am:
- Split source list: shared / X11-only / Wayland-only.
- X11 sources (context.c, convert.c, convert_x11.c, xpixmap.c,
xutil.c, load_xpm.c) only built when USE_X11_WRASTER.
- New context_wl.c (always built) — Wayland-mode RCreateContextWayland
extracted from context.c.
- New wstubs_no_x11.c (only built when !USE_X11_WRASTER) — empty
stubs for the public wraster API symbols normally exported from
the X11 path (RCreateContext, RDestroyContext, RConvertImage,
RConvertImageMask, RGetClosestXColor, RCreateImageFromDrawable,
RCreateImageFromXImage, RCreateXImage, RGetXImage, RDestroyXImage,
RPutXImage, RGetImageFromXPMData, RLoadXPM).
- @XLIBS@/@LIBXMU@ only added to libwraster_la_LIBADD when
USE_X11_WRASTER; load_xpm.c only built when (USE_XPM and
USE_X11_WRASTER).
- Added --filter USE_X11_WRASTER to the wraster.h generation rule
so the @!USE_X11_WRASTER@ lines (forcing WRASTER_NO_XLIB) are
retained when X11 is disabled.
wrlib/wraster.h.in:
- When USE_X11_WRASTER is undefined at config time, force
WRASTER_NO_XLIB so consumers see only forward-decl'd opaque types
(Display/Visual/XImage/etc.) and never <X11/Xlib.h>.
- Added True/False/None defines to the WRASTER_NO_XLIB block (raster.c
uses them; previously got via Xlib.h).
wrlib/context.c — RCreateContextWayland moved out to context_wl.c.
wrlib/wstubs_no_x11.c — new (157 lines).
wrlib/context_wl.c — new (extracted Wayland branch).
WINGs/Makefile.am:
- libWINGs_la_LIBADD now uses WINGS_PANGO_LIBS, which is @PANGO_LIBS@
when X11 backend enabled, @WINGS_PANGO_LIBS_NO_XFT@ otherwise.
WINGs/widgets.c — WMCreateScreen + WMCreateSimpleApplicationScreen
moved to widgets_x11.c (they use DefaultScreen() and RCreateContext()
which are X11-only). Stubs added in WINGs/wstubs_no_x11.c.
WINGs shared rootWin assignment now reads context->drawable instead
of calling X11 RootWindow() macro directly.
WINGs/WINGs/wnative.h — added X11-numeric constants used by shared
WINGs widget code:
- Button1..Button5 (X.h pointer-button numbers)
- KeyPress..LASTEvent (X.h event-type constants)
- CWBackPixmap..CWCursor (X.h CreateWindow/ChangeWindowAttributes
mask bits)
- WMShortRect (XRectangle layout-compatible struct)
All guarded by #ifndef so X11 headers can override on the X11 build.
WINGs/configuration.c — dropped unused <X11/Xlocale.h> include.
WINGs/wruler.c, wtabview.c, wtext.c — replaced raw XPoint/XRectangle
with WMShortPoint/WMShortRect; replaced lone XSetWindowAttributes
shim with direct view->attribs.cursor access.
src/WindowMaker.h — explicitly include <X11/Xlib.h>, <X11/Xutil.h>,
<X11/Xresource.h>, <X11/Xatom.h>. The wmaker compositor uses these
extensively in its public headers; previously got them transitively
via WINGs.h. After the WINGs surgery WINGs.h no longer pulls Xlib,
so the compositor must include them itself.
Verified:
Default build (--enable-x11-backend, --enable-x11-wraster):
Window Maker 0.96.0 boots, all features intact.
Pure-Wayland build (--disable-x11-backend --disable-x11-wraster):
libwraster.so / libWINGs.so build cleanly, no libX11 in ldd.
(wmaker compositor binary still has X11 deps from src/* code;
out of scope for this commit — that's a compositor-level
refactor.)
Phase η: completes the WINGs API surgery by adding the configure
option that actually excludes the X11 backend from the build.
./configure --enable-wayland-client --disable-x11-backend
→ libWINGs has zero X11 symbol dependencies in its own objects
configure.ac: --enable-x11-backend (default yes) controls the new
USE_X11_BACKEND m4 conditional and #define.
WINGs/Makefile.am: split source list into:
- backend-neutral / shared sources (always)
- if USE_X11_BACKEND: dragsource_x11.c / dragdestination_x11.c /
dragcommon_x11.c / selection_x11.c / wappresource_x11.c /
wballoon_x11.c / wcolor_x11.c / wcolorpanel_x11.c /
wevent_x11.c / wfont_x11.c / widgets_x11.c /
winputmethod_x11.c / wrender_x11.c / wview_x11.c
- else: wstubs_no_x11.c (new)
XLIBS / XFT_LIBS only added to libWINGs_la_LIBADD when X11 backend
is enabled.
WINGs/wstubs_no_x11.c: empty implementations of every public WINGs
API symbol that normally lives in *_x11.c — DnD setup, selection
handlers, IM context, balloons, color/font panels, application icon
hints, atom helpers. Each stub is a no-op (returns success-neutral
value); calling them in pure-Wayland mode is silent rather than an
error, so future Wayland equivalents can drop in transparently.
WINGs/widgets.c: WMCreateScreenWithRContext uses weak references
to the W_*BackendX11 instances so they can resolve to NULL when not
linked. If the caller asked for X11 mode but X11 backend is not
built, falls back to Wayland with a warning.
WINGs/WINGsP.h.in: backend extern decls (W_*BackendX11) marked weak
so links resolve to NULL when X11 backend is excluded.
Verification:
$ ./configure --disable-x11-backend && make
$ for f in WINGs/.libs/*.o; do nm $f | grep '^.*U X[A-Z][a-z]'; done
(empty)
libWINGs.so still pulls libX11 transitively via wrlib (wraster's X11
image-conversion path); that's a separate refactor. At the WINGs
source level the partition is now complete: shared / X11 / Wayland.
Replaces the inline if-Wayland-else-X11 dispatch in WMOpenScreen with
a proper vtable. Each platform-open backend now provides one
W_PlatformBackend instance:
W_PlatformBackendX11 — widgets_x11.c
W_PlatformBackendWLClient — wclient_wl.c
WMOpenScreen walks an ordered registry of weak references to these
instances:
static const W_PlatformBackend *const wm_platform_backends[] = {
&W_PlatformBackendWLClient,
&W_PlatformBackendX11,
NULL
};
It first asks each backend's .detect() whether it wants the supplied
display string, and calls .open() on the first to claim it. If no
backend claims, it falls back to trying each .open() in order.
Weak references mean a build that excludes a backend (e.g. a future
--disable-x11-backend) link cleanly with the symbol resolving to
NULL — WMOpenScreen just skips it.
The detection logic moves out of shared widgets.c entirely:
x11_detect: explicit non-wayland display string OR $DISPLAY set.
wlclient_detect: 'wayland' prefix, WMAKER_USE_WAYLAND, or
$WAYLAND_DISPLAY set + $DISPLAY unset.
Also replaces WMCreateScreenWithRContext's getenv("WMAKER_USE_WAYLAND")
with an explicit W_SetNextScreenKind(WM_SCREEN_KIND_WAYLAND) flag the
platform backend sets before calling. No env detection in shared code.
Updated wmaker compositor (src/backend/wayland/wl_backend.c) to call
W_SetNextScreenKind(WM_SCREEN_KIND_WAYLAND) before its own
WMCreateScreenWithRContext call.
Verified: wmaker still starts in compositor mode, version string OK,
build clean, vtable dispatch invokes the right backend.
The phase-β sed pass renamed every C 'Window' identifier to
WNativeWindow. That correctly updated typedef uses but also rewrote
the string 'Window Maker', UI labels like 'Window Manager', 'Window
Placement', 'Window Title', 'Window List', 'Window System session',
etc., plus a number of comments referring to 'Window' as English.
Fixed all of those. The C type uses (WNativeWindow rootWin, etc.)
remain unchanged — only English-language occurrences are reverted.
Verified that wmaker now reports 'Window Maker 0.96.0' again and
build is clean across WINGs/, src/, WPrefs.app/.
WPrefs.app/main.c was opening the display directly via XOpenDisplay /
WMCreateScreen. Replaced with WMOpenScreen, which autodetects
Wayland mode from WAYLAND_DISPLAY / DISPLAY env and dispatches to
W_WLClientInit in WINGs (Wayland) or W_X11OpenDisplay
(widgets_x11.c) accordingly.
The XSupportsLocale / XSetLocaleModifiers calls are now skipped in
Wayland mode (they're X11-only). This is just startup plumbing; WPrefs's
many tab modules still have direct Xlib calls that won't work as a
pure Wayland client until each is ported through WINGs vtables. This
commit gets us a minimal Wayland-aware launch path; further work
required to actually run native.