Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ jobs:
UI_REPLAY_XVFB: --xvfb
UI_REPLAY_SCREENSHOT_COMMAND: import
UI_REPLAY_DISPLAY: 121
run: make check-unit
# XCB=1: the XCB shim is off by default (mk/config.mk), so ask for it
# explicitly or its libraries, tests and ABI gate never build here.
run: make XCB=1 check-unit

- name: Build bundled examples
run: make examples -j"$(nproc)"
Expand Down Expand Up @@ -323,7 +325,7 @@ jobs:
UI_REPLAY_XVFB: --xvfb
UI_REPLAY_SCREENSHOT_COMMAND: import
UI_REPLAY_DISPLAY: 121
run: make OPTFLAGS=-O0 CFLAGS_EXTRA=-DDEBUG_LIBX11_COMPAT check-unit
run: make XCB=1 OPTFLAGS=-O0 CFLAGS_EXTRA=-DDEBUG_LIBX11_COMPAT check-unit

- name: ccache stats
run: ccache --show-stats
Expand Down Expand Up @@ -413,7 +415,7 @@ jobs:
# autoconf which probes for Xutf8TextExtents via a link test
# that fails when SAN_FLAGS leak into the upstream configure
# ("Motif requires a UTF-8 capable libX11").
make CFLAGS_EXTRA="$SAN_FLAGS" LDFLAGS="$SAN_FLAGS" check-unit
make XCB=1 CFLAGS_EXTRA="$SAN_FLAGS" LDFLAGS="$SAN_FLAGS" check-unit

- name: ccache stats
run: ccache --show-stats
Expand Down Expand Up @@ -2138,7 +2140,7 @@ jobs:
# dummy, software renderer) plus symbol coverage; it does not need
# Xvfb. The make test runner also folds SDL_RUNTIME_LIBDIR (the sdl3
# pkg-config libdir) onto LD_LIBRARY_PATH so libSDL3 resolves.
run: make SDL_BACKEND=sdl3 check-unit
run: make XCB=1 SDL_BACKEND=sdl3 check-unit

- name: Build bundled examples (SDL_BACKEND=sdl3)
run: make SDL_BACKEND=sdl3 examples -j"$(nproc)"
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ include mk/common.mk
include mk/font-data.mk
include mk/sdl-wrapper.mk
include mk/library.mk
include mk/libxcb.mk

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The $(UPSTREAM_HEADERS_STAMP) prerequisite in mk/libxcb.mk's object rules expands to empty because that variable is only defined in mk/libxt.mk, mk/libxaw.mk, and mk/upstream-headers.mk, all included after mk/libxcb.mk. The stamp ordering is therefore silently dropped for xcb-compat.o, xcb-requests.o, and xlib-xcb-compat.o, and on a clean parallel build (make -j XCB=1) these objects can compile before the upstream headers are staged, failing with missing X11/Xlib.h (the compat sources include it, and it is not in the local include/X11 tree). Follow the pattern libxt.mk/libxaw.mk use: define UPSTREAM_HEADERS_DIR ?= $(OUT)/upstream/include and UPSTREAM_HEADERS_STAMP ?= $(UPSTREAM_HEADERS_DIR)/.upstream-stamp at the top of mk/libxcb.mk before the rules that reference the stamp.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Makefile, line 28:

<comment>The $(UPSTREAM_HEADERS_STAMP) prerequisite in mk/libxcb.mk's object rules expands to empty because that variable is only defined in mk/libxt.mk, mk/libxaw.mk, and mk/upstream-headers.mk, all included after mk/libxcb.mk. The stamp ordering is therefore silently dropped for xcb-compat.o, xcb-requests.o, and xlib-xcb-compat.o, and on a clean parallel build (make -j XCB=1) these objects can compile before the upstream headers are staged, failing with missing X11/Xlib.h (the compat sources include it, and it is not in the local include/X11 tree). Follow the pattern libxt.mk/libxaw.mk use: define UPSTREAM_HEADERS_DIR ?= $(OUT)/upstream/include and UPSTREAM_HEADERS_STAMP ?= $(UPSTREAM_HEADERS_DIR)/.upstream-stamp at the top of mk/libxcb.mk before the rules that reference the stamp.</comment>

<file context>
@@ -25,6 +25,7 @@ include mk/common.mk
 include mk/font-data.mk
 include mk/sdl-wrapper.mk
 include mk/library.mk
+include mk/libxcb.mk
 include mk/libxt.mk
 include mk/libxpm.mk
</file context>

include mk/libxt.mk
include mk/libxpm.mk
include mk/xcompat-libs.mk
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,20 @@ Clients link against it the same way they would link against the system `libX11.

## Examples

`examples/` bundles real Xlib clients built against the local `libX11-compat.so`:
`examples/` bundles real Xlib and XCB clients built against the local
compatibility libraries:

```sh
make examples
build/examples/2048
make XCB=1 examples
build/examples/xcb-kaleidoscope
```

The bundle covers a 2048 game, a paint demo, Conway's Game of Life, an analog clock, an interactive Mandelbrot viewer, a single-runner Processing-style showcase, an SDL-backed clipboard probe, and the upstream X.Org `x11perf` benchmark.
The XCB shim is off by default, so `XCB=1` adds the two native XCB clients: a
geometric image/primitives demo and a CPU-rendered Mandelbrot client; see
[`examples/README-xcb.md`](examples/README-xcb.md).
See [`docs/EXAMPLES.md`](docs/EXAMPLES.md) for the API each example exercises.
The screenshot above is from the larger ViolaWWW port described in [Larger Workloads Under Investigation](#larger-workloads-under-investigation).

Expand Down
34 changes: 34 additions & 0 deletions compat/xcb-compat-private.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef LIBX11_COMPAT_XCB_PRIVATE_H
#define LIBX11_COMPAT_XCB_PRIVATE_H
#include <stdint.h>
#include <xcb/xcb.h>
typedef struct _XDisplay Display;
typedef union _XEvent XEvent;
Display *xcbCompatDisplay(xcb_connection_t *connection);
xcb_connection_t *xcbCompatConnectionForDisplay(Display *display);
void xcbCompatSetQueueOwner(xcb_connection_t *connection, int owner);
unsigned int xcbCompatEventWaiters(xcb_connection_t *connection);
void xcbCompatSetConnectionError(xcb_connection_t *connection, int error);
int xcbCompatRequestReady(xcb_connection_t *connection);
void xcbCompatReleaseRequestResources(xcb_connection_t *connection);
uint64_t xcbCompatNextSequence(xcb_connection_t *connection);
void xcbCompatSetNextSequence(xcb_connection_t *connection, uint64_t sequence);
void xcbCompatStorePending(xcb_connection_t *connection,
uint64_t sequence,
void *reply,
xcb_generic_error_t *error);
void xcbCompatStoreProtocolError(xcb_connection_t *connection,
uint64_t sequence,
uint8_t code,
uint32_t resource,
uint8_t opcode,
int checked);
void *xcbCompatTakeReply(xcb_connection_t *connection,
uint64_t sequence,
xcb_generic_error_t **error);
xcb_void_cookie_t xcbCompatVoidCookie(xcb_connection_t *connection,
uint8_t errorCode,
uint32_t resource,
uint8_t opcode,
int checked);
#endif
Loading
Loading