windowmaker-wl/wrlib
Window Maker a4eb10b2b5 wrlib: split X11 image-conversion path; --disable-x11-wraster
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.)
2026-05-24 12:24:45 +02:00
..
po gitignore: stop tracking all generated build outputs 2026-03-31 13:36:58 +02:00
tests gitignore: stop tracking all generated build outputs 2026-03-31 13:36:58 +02:00
AUTHORS WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
COPYING WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
ChangeLog WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
INSTALL WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
Makefile.am wrlib: split X11 image-conversion path; --disable-x11-wraster 2026-05-24 12:24:45 +02:00
NEWS WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
README WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
TODO WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
alpha_combine.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
color.c F.1: remove gratuitous Xlib.h includes from pure files 2026-05-16 12:30:12 +02:00
context.c wrlib: split X11 image-conversion path; --disable-x11-wraster 2026-05-24 12:24:45 +02:00
context_wl.c wrlib: split X11 image-conversion path; --disable-x11-wraster 2026-05-24 12:24:45 +02:00
convert.c wrlib: split RConvertImage into X11/Wayland backends 2026-05-14 16:41:15 +02:00
convert.h wrlib: split RConvertImage into X11/Wayland backends 2026-05-14 16:41:15 +02:00
convert_funcs.h wrlib: split RConvertImage into X11/Wayland backends 2026-05-14 16:41:15 +02:00
convert_wl.c wrlib: split RConvertImage into X11/Wayland backends 2026-05-14 16:41:15 +02:00
convert_x11.c wrlib: split RConvertImage into X11/Wayland backends 2026-05-14 16:41:15 +02:00
convolve.c F.1: remove gratuitous Xlib.h includes from pure files 2026-05-16 12:30:12 +02:00
draw.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
flip.c F.1: remove gratuitous Xlib.h includes from pure files 2026-05-16 12:30:12 +02:00
gradient.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
imgformat.h complete F.2-5 2026-05-16 13:54:44 +02:00
load.c complete F.2-5 2026-05-16 13:54:44 +02:00
load_gif.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
load_jpeg.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
load_magick.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
load_png.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
load_ppm.c F.1: remove gratuitous Xlib.h includes from pure files 2026-05-16 12:30:12 +02:00
load_tiff.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
load_webp.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
load_xpm.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
load_xpm_normalized.c complete F.2-5 2026-05-16 13:54:44 +02:00
misc.c F.1: remove gratuitous Xlib.h includes from pure files 2026-05-16 12:30:12 +02:00
raster.c F.1: remove gratuitous Xlib.h includes from pure files 2026-05-16 12:30:12 +02:00
rotate.c F.1: remove gratuitous Xlib.h includes from pure files 2026-05-16 12:30:12 +02:00
rotate.h WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
save.c F.1: remove gratuitous Xlib.h includes from pure files 2026-05-16 12:30:12 +02:00
save_jpeg.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
save_png.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
save_xpm.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
scale.c F.1: remove gratuitous Xlib.h includes from pure files 2026-05-16 12:30:12 +02:00
scale.h WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
wr_i18n.h WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
wraster.h.in wrlib: split X11 image-conversion path; --disable-x11-wraster 2026-05-24 12:24:45 +02:00
wstubs_no_x11.c wrlib: split X11 image-conversion path; --disable-x11-wraster 2026-05-24 12:24:45 +02:00
xpixmap.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
xutil.c WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00
xutil.h WindowMaker 0.96.0 upstream source 2026-03-26 15:38:49 +01:00

README

WindowMaker raster graphics library

This library is used to manipulate images and convert them to
a format that can be displayed through the X window system.
Read the wraster.h header for an idea of what is available


This Library is LGPL and
Copyright (c) Alfredo K. Kojima <kojima@inf.ufrgs.br>


The following environment variables control some parameters:

RIMAGE_CACHE <integer>

Is the maximum number of images to store in the internal cache.
Default is 8

RIMAGE_CACHE_SIZE <integer>

Is the size of the biggest image to store in the cache.
Default is 4k (64x64)



Porting
=======

It should be fairly easy to port it to other environments
(svgalib, libggi etc), probably only requiring wraster.h,
context.c and convert.c to be changed. Note that the X specific
code should be disabled in that case, including support for libXpm.