app.dhover×303 error×52all
// F02 — resize correctness, X11 edition (../../../features/f02-resize.md).
// Derived from the X11 scaffold (../scaffold/app.d). A continuously refreshed
// corner-anchored gradient survives an aggressive programmatic resize storm
// driven over BOTH paths a real X11 window experiences:
//
//   1. self-resize  — XResizeWindow on the demo's own connection (an app
//      resizing itself), including one burst of three back-to-back requests;
//   2. external resize — a SECOND Display* connection (opened mid-run, same
//      process) resizes the window by XID, exactly what a window manager or
//      `xdotool` does. The window is a server-side resource: any
//      authenticated client may configure it.
//
// Logged per the F02 spec, with everything needed to compare the two paths:
//   * every ConfigureNotify:  configure_notify size=WxH pos=X+Y serial=N
//     send_event=0|1 override=0|1  (send_event=1 marks an ICCCM *synthetic*
//     ConfigureNotify, the kind WMs send on move; serial ties the event to
//     the last request the server processed *on this connection* — external
//     resizes arrive under a stale serial)
//   * every Expose (`expose count=… area=…`), every buffer (re)allocation
//     (`buffer_realloc`), every resize request (`step name=XResizeWindow…`)
//   * `stale_frame` — a frame presented at the old size between a resize
//     request and its ConfigureNotify; XResizeWindow is asynchronous, so one
//     such frame per resize is structural on X11 (the artifact window that
//     Wayland's configure/ack protocol closes)
//   * `quirk name=beyond_screen` — ConfigureNotify reporting a size larger
//     than the screen (the storm includes 900x560 on Xvfb's 640x480) while
//     the matching Expose stays clipped to the visible region
//   * `x_error` — every protocol error, via XSetErrorHandler; the run must
//     end `errors=0`
//
// WSI_AUTO_EXIT=1 bounds the run (storm + drain, then exit 0); otherwise it
// runs until WM_DELETE_WINDOW. Headless-safe: no display prints `SKIP:` and
// exits 0. Findings: ../../f02-resize.md.
module 
(module) app
app
;
import
(module) c
c
; // ImportC: Xlib + Xutil + Xatom + XShm + sys/ipc + sys/shm + poll
C preprocess command `cpp` failed for file `/home/runner/work/sparkles/sparkles/docs/research/window-system-integration/os-apis/x11/examples/f02-resize/c.c`, exit status 1
import
(module) instrument
instrument
;
import
(package) core
core
.
(package) core.stdc
stdc
.
(module) core.stdc.config

D compatible types that correspond to various basic types in associated C and C++ compilers.

Source

core/stdc/config.d

@copyrightCopyright Sean Kelly 2005 - 2009.@licenseDistributed under the Boost Software License 1.0. (See accompanying file LICENSE)@authorsSean Kelly@standardsISO/IEC 9899:1999 (E)
config
: c_long, c_ulong;
import
(package) core
core
.
(package) core.stdc
stdc
.
(module) core.stdc.stdio

D header file for C99 <stdio.h>

pubs.opengroup.org/onlinepubs/009695399/basedefs/stdio.h.html, stdio.h

Source

core/stdc/stdio.d

@copyrightCopyright Sean Kelly 2005 - 2009.@licenseDistributed under the Boost Software License 1.0. (See accompanying file LICENSE)@authorsSean Kelly, Alex Rønne Petersen@standardsISO/IEC 9899:1999 (E)
stdio
:
(alias) app.printf = int core.stdc.stdio.printf(scope const(char*) format, scope const ...) nothrow @nogc
printf
;
import
(package) core
core
.
(package) core.stdc
stdc
.
(module) core.stdc.stdlib

D header file for C99.

pubs.opengroup.org/onlinepubs/009695399/basedefs/stdlib.h.html, stdlib.h

Source

core/stdc/stdlib.d

@copyrightCopyright Sean Kelly 2005 - 2014.@licenseDistributed under the Boost Software License 1.0. (See accompanying file LICENSE)@authorsSean Kelly@standardsISO/IEC 9899:1999 (E)
stdlib
:
(alias) app.getenv = char* core.stdc.stdlib.getenv(scope const(char*) name) nothrow @nogc
getenv
;
// Constants Xlib/glibc expose only as macros (not ImportC-able); re-declared // per the ImportC guide, same as the scaffold. enum : c_long {
(enum value) app.KeyPressMask = 1L
KeyPressMask
= 1L << 0,
(enum value) app.ExposureMask = 32768L
ExposureMask
= 1L << 15,
(enum value) app.StructureNotifyMask = 131072L
StructureNotifyMask
= 1L << 17,
} enum // XEvent.type discriminators {
(enum value) app.KeyPress = 2
KeyPress
= 2,
(enum value) app.Expose = 12
Expose
= 12,
(enum value) app.UnmapNotify = 18
UnmapNotify
= 18,
(enum value) app.MapNotify = 19
MapNotify
= 19,
(enum value) app.ReparentNotify = 21
ReparentNotify
= 21,
(enum value) app.ConfigureNotify = 22
ConfigureNotify
= 22,
(enum value) app.GravityNotify = 24
GravityNotify
= 24,
(enum value) app.ClientMessage = 33
ClientMessage
= 33,
} enum
(constant) int app.ZPixmap = 2
ZPixmap
= 2;
enum
(constant) int app.ShmCompletion = 0
ShmCompletion
= 0; // offset inside MIT-SHM's allocated event range
enum
(constant) int app.False = 0
False
= 0;
enum
(constant) int app.True = 1
True
= 1;
enum
(constant) int app.POLLIN = 1
POLLIN
= 0x001;
enum
(constant) int app.IPC_PRIVATE = 0
IPC_PRIVATE
= 0;
enum
(constant) int app.IPC_CREAT = 512
IPC_CREAT
= 0x200; // 01000 octal
enum
(constant) int app.IPC_RMID = 0
IPC_RMID
= 0;
// --------------------------------------------------------------------------- // Protocol-error accounting (F02: "no protocol errors"). Xlib reports errors // asynchronously through this handler; the demo logs each and tallies them. __gshared int
(__gshared global) int app.g_xErrors
g_xErrors
= 0;
extern (C) int
app.onXError
onXError
(Display*
(parameter) Display* dpy
dpy
, XErrorEvent* e) @nogc nothrow
undefined identifier `Display`
undefined identifier `XErrorEvent`
{ char[128]
_error_ text
text
= 0;
XGetErrorText(dpy, e.error_code, text.ptr, text.
text.length
length
);
emitf("x_error", "code=%d request=%d.%d resource=0x%lx text=%s", e.error_code, e.request_code, e.minor_code, e.resourceid, text.ptr); ++g_xErrors; return 0; } // --------------------------------------------------------------------------- // Backbuffer: MIT-SHM XImage with plain-XPutImage fallback (as the scaffold). struct
(struct) app.Backbuffer
Backbuffer
{ XImage*
(field) _error_ app.Backbuffer.ximg
ximg
;
undefined identifier `XImage`
XShmSegmentInfo
(field) _error_ app.Backbuffer.shminfo
shminfo
;
undefined identifier `XShmSegmentInfo`
bool
(field) bool app.Backbuffer.usingShm
usingShm
;
int
(field) int app.Backbuffer.width
width
,
(field) int app.Backbuffer.height
height
;
}
(struct) app.Backbuffer
Backbuffer
app.createBackbuffer
createBackbuffer
(Display*
(parameter) Display* dpy
dpy
, Visual*
(parameter) Visual* visual
visual
, int
(parameter) int depth
depth
,
undefined identifier `Display`
undefined identifier `Visual`
int
(parameter) int w
w
, int
(parameter) int h
h
, bool wantShm) @nogc nothrow
{
(unresolved type) Backbuffer
Backbuffer
_error_ b
b
;
b.
b.width
width
= w;
b.
b.height
height
= h;
if (wantShm) { b.
b.ximg
ximg
= XShmCreateImage(dpy, visual, cast(uint) depth, ZPixmap,
null, &b.
b.shminfo
shminfo
, cast(uint) w, cast(uint) h);
if (b.
b.ximg
ximg
!is null)
{ const
_error_ nbytes
nbytes
= cast(size_t)(b.
b.ximg
ximg
.bytes_per_line * b.
b.ximg
ximg
.
b.ximg.height
height
);
b.
b.shminfo
shminfo
.shmid = shmget(IPC_PRIVATE, nbytes, IPC_CREAT | 0x180 /* 0600 */ );
if (b.
b.shminfo
shminfo
.shmid >= 0)
{ b.
b.shminfo
shminfo
.shmaddr = cast(char*) shmat(b.
b.shminfo
shminfo
.shmid, null, 0);
if (b.
b.shminfo
shminfo
.shmaddr !is cast(char*)-1)
{ b.
b.ximg
ximg
.
b.ximg.data
data
= b.
b.shminfo
shminfo
.shmaddr;
b.
b.shminfo
shminfo
.readOnly = False;
XShmAttach(dpy, &b.
b.shminfo
shminfo
);
XSync(dpy, False); // server attached before ... shmctl(b.
b.shminfo
shminfo
.shmid, IPC_RMID, null); // ... mark-for-delete
b.
b.usingShm
usingShm
= true;
return b; } shmctl(b.
b.shminfo
shminfo
.shmid, IPC_RMID, null);
} b.
b.ximg
ximg
.f.destroy_image(b.
b.ximg
ximg
); // XDestroyImage is a macro
b.
b.ximg
ximg
= null;
} emit("step name=shm_fallback reason=alloc_or_attach_failed"); } import core.stdc.stdlib : malloc; auto
_error_ data
data
= cast(char*) malloc(cast(size_t) w * h * 4);
b.
b.ximg
ximg
= XCreateImage(dpy, visual, cast(uint) depth, ZPixmap, 0, data,
cast(uint) w, cast(uint) h, 32, 0); b.
b.usingShm
usingShm
= false;
return b; } void
app.destroyBackbuffer
destroyBackbuffer
(Display*
(parameter) Display* dpy
dpy
, ref
(struct) app.Backbuffer
Backbuffer
(parameter) Backbuffer b
b
) @nogc nothrow
undefined identifier `Display`
{ if (b.
b.ximg
ximg
is null)
return; if (b.
b.usingShm
usingShm
)
{ XSync(dpy, False); // let any in-flight XShmPutImage finish reading XShmDetach(dpy, &b.
b.shminfo
shminfo
);
} b.
b.ximg
ximg
.f.destroy_image(b.
b.ximg
ximg
);
if (b.
b.usingShm
usingShm
)
shmdt(b.
b.shminfo
shminfo
.shmaddr);
b.
b.ximg
ximg
= null;
} /// Corner-anchored diagonal gradient: red tracks x/width, green tracks /// y/height, so the geometry visibly re-anchors at every size (F02 req. 1); /// `phase` animates the blue channel so successive frames are distinguishable. void
app.drawGradient

Corner-anchored diagonal gradient: red tracks x/width, green tracks y/height, so the geometry visibly re-anchors at every size (F02 req. 1); phase animates the blue channel so successive frames are distinguishable.

drawGradient
(XImage*
(parameter) XImage* ximg
ximg
, int
(parameter) int phase
phase
) @nogc nothrow
undefined identifier `XImage`
{ const
_error_ w
w
= ximg.
ximg.width
width
,
_error_ h
h
= ximg.
ximg.height
height
;
if (ximg.bits_per_pixel != 32) return; foreach (
(parameter) y
y
; 0 .. h)
{ auto
_error_ row
row
= cast(uint*)(ximg.
ximg.data
data
+ y * ximg.bytes_per_line);
const
_error_ g
g
= cast(uint)(h > 1 ? (y * 255) / (h - 1) : 0);
foreach (
(parameter) x
x
; 0 .. w)
{ const
_error_ r
r
= cast(uint)(w > 1 ? (x * 255) / (w - 1) : 0);
const
_error_ bl
bl
= cast(uint)((x + y + phase) & 0xff);
row[x] = (r << 16) | (g << 8) | bl; } } } int
int D main()
main
()
{
void instrument.initInstrument(const(char)* demoName) nothrow @nogc

Names the demo, starts the monotonic clock, and emits init_start. Call this first, before any platform API call.

initInstrument
("f02_x11");
const
(local variable) const(char*) envAuto
envAuto
=
char* core.stdc.stdlib.getenv(scope const(char*) name) nothrow @nogc
getenv
("WSI_AUTO_EXIT");
const
(local variable) const(bool) autoExit
autoExit
=
(local variable) const(char*) envAuto
envAuto
!is null &&
(local variable) const(char*) envAuto
envAuto
[0] == '1';
XSetErrorHandler(&onXError);
undefined identifier `XSetErrorHandler`
// -- Connection #1: the app's own ---------------------------------------- Display*
(local variable) _error_ dpy
dpy
= XOpenDisplay(null);
undefined identifier `Display`
undefined identifier `XOpenDisplay`
if (dpy is null) {
int core.stdc.stdio.printf(scope const(char*) format, scope const ...) nothrow @nogc
printf
("SKIP: no X11 display (XOpenDisplay returned null)\n");
return 0; }
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("step", "name=XOpenDisplay fd=%d", XConnectionNumber(dpy));
undefined identifier `XConnectionNumber`
const
(local variable) const(_error_) screen
screen
= XDefaultScreen(dpy);
undefined identifier `XDefaultScreen`
const
(local variable) const(_error_) root
root
= XRootWindow(dpy, screen);
undefined identifier `XRootWindow`
Visual*
(local variable) _error_ visual
visual
= XDefaultVisual(dpy, screen);
undefined identifier `Visual`
undefined identifier `XDefaultVisual`
const
(local variable) const(_error_) depth
depth
= XDefaultDepth(dpy, screen);
undefined identifier `XDefaultDepth`
const
(local variable) const(_error_) screenW
screenW
= XDisplayWidth(dpy, screen),
(local variable) const(_error_) screenH
screenH
= XDisplayHeight(dpy, screen);
undefined identifier `XDisplayWidth`
undefined identifier `XDisplayHeight`
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("step", "name=XDisplayWidth/Height screen=%dx%d", screenW, screenH);
bool
(local variable) bool haveShm
haveShm
= XShmQueryExtension(dpy) != 0 &&
char* core.stdc.stdlib.getenv(scope const(char*) name) nothrow @nogc
getenv
("WSI_NO_SHM") is null;
undefined identifier `XShmQueryExtension`
int
(local variable) int shmCompletionType
shmCompletionType
=
(local variable) bool haveShm
haveShm
? XShmGetEventBase(dpy) + ShmCompletion : -1;
undefined identifier `XShmGetEventBase`
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("step", "name=XShmQueryExtension using_shm=%d", cast(int)
(local variable) bool haveShm
haveShm
);
int
(local variable) int width
width
= 480,
(local variable) int height
height
= 320;
Window
(local variable) _error_ win
win
= XCreateSimpleWindow(dpy, root, 0, 0, width, height, 1,
undefined identifier `Window`
undefined identifier `XCreateSimpleWindow`
XBlackPixel(dpy, screen), XWhitePixel(dpy, screen));
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("step", "name=XCreateSimpleWindow xid=0x%lx", win);
XStoreName(dpy, win, "Sparkles · X11 F02");
undefined identifier `XStoreName`
Atom
(local variable) _error_ wmDelete
wmDelete
= XInternAtom(dpy, "WM_DELETE_WINDOW", False);
undefined identifier `Atom`
undefined identifier `XInternAtom`
XSetWMProtocols(dpy, win, &wmDelete, 1);
undefined identifier `XSetWMProtocols`
XSelectInput(dpy, win, ExposureMask | KeyPressMask | StructureNotifyMask);
undefined identifier `XSelectInput`
XMapWindow(dpy, win);
undefined identifier `XMapWindow`
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("window_created", "xid=0x%lx size=%dx%d", win,
(local variable) int width
width
,
(local variable) int height
height
);
GC
(local variable) _error_ gc
gc
= XDefaultGC(dpy, screen);
undefined identifier `GC`
undefined identifier `XDefaultGC`
auto
(local variable) _error_ buf
buf
= createBackbuffer(dpy, visual, depth, width, height, haveShm);
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("buffer_realloc", "size=%dx%d shm=%d bytes=%d",
(local variable) int width
width
,
(local variable) int height
height
,
cast(int) buf.
(field) _error_ buf.usingShm
usingShm
, buf.
(field) _error_ buf.ximg
ximg
.bytes_per_line * buf.
(field) _error_ buf.ximg
ximg
.
(field) _error_ buf.ximg.height
height
);
// -- Connection #2: the "outside world" (WM / xdotool stand-in) ---------- // Opened lazily when the external phase starts, closed when it ends. Display*
(local variable) _error_ dpy2
dpy2
= null;
undefined identifier `Display`
scope (exit) { if (dpy2 !is null) XCloseDisplay(dpy2);
undefined identifier `XCloseDisplay`
destroyBackbuffer(dpy, buf); XDestroyWindow(dpy, win);
undefined identifier `XDestroyWindow`
XCloseDisplay(dpy);
undefined identifier `XCloseDisplay`
} // -- The storm ------------------------------------------------------------ // Phase "self": 6 spaced XResizeWindow calls on dpy, then one burst of 3 // back-to-back requests (aggressive: queued faster than frames present). // Phase "ext": 4 XResizeWindow calls on dpy2 — including 900x560, larger // than Xvfb's default 640x480 screen (the beyond-screen quirk). static immutable int[2][6]
(immutable global) immutable(int[2][6]) app.main.selfStorm
selfStorm
= [
[640, 400], [320, 240], [800, 520], [400, 300], [720, 480], [360, 260], ]; static immutable int[2][3]
(immutable global) immutable(int[2][3]) app.main.burst
burst
= [[600, 380], [440, 300], [560, 360]];
static immutable int[2][4]
(immutable global) immutable(int[2][4]) app.main.extStorm
extStorm
= [
[500, 340], [900, 560], [300, 200], [480, 320], ]; const
(local variable) const(_error_) fd
fd
= XConnectionNumber(dpy);
undefined identifier `XConnectionNumber`
bool
(local variable) bool running
running
= true,
(local variable) bool needsRedraw
needsRedraw
= false,
(local variable) bool awaitingCompletion
awaitingCompletion
= false;
bool
(local variable) bool sawFirstPixel
sawFirstPixel
= false,
(local variable) bool burstIssued
burstIssued
= false;
int
(local variable) int frames
frames
= 0,
(local variable) int phase
phase
= 0,
(local variable) int selfIssued
selfIssued
= 0,
(local variable) int extIssued
extIssued
= 0;
int
(local variable) int pendingW
pendingW
= 0,
(local variable) int pendingH
pendingH
= 0; // last size we *requested*, any connection
int
(local variable) int staleFrames
staleFrames
= 0,
(local variable) int reallocs
reallocs
= 1,
(local variable) int configures
configures
= 0;
while (
(local variable) bool running
running
)
{ while (XPending(dpy) > 0) // XPending also flushes the output buffer
undefined identifier `XPending`
{ XEvent
(local variable) _error_ ev
ev
;
undefined identifier `XEvent`
XNextEvent(dpy, &ev);
undefined identifier `XNextEvent`
switch (ev.type) { case MapNotify: emitf("map_notify", "serial=%lu send_event=%d", ev.xany.serial, cast(int) ev.xany.send_event); break; case ReparentNotify: // a WM adopted us (never seen on bare Xvfb) emitf("reparent_notify", "parent=0x%lx serial=%lu", ev.xreparent.parent, ev.xany.serial); break; case UnmapNotify: emitf("unmap_notify", "serial=%lu", ev.xany.serial); break; case GravityNotify: emitf("gravity_notify", "pos=%d+%d", ev.xgravity.
ev.xgravity.x
x
, ev.xgravity.
ev.xgravity.y
y
);
break; case ConfigureNotify: const
_error_ cw
cw
= ev.xconfigure.
ev.xconfigure.width
width
,
_error_ ch
ch
= ev.xconfigure.
ev.xconfigure.height
height
;
++configures; emitf("configure_notify", "size=%dx%d pos=%d+%d serial=%lu send_event=%d override=%d", cw, ch, ev.xconfigure.
ev.xconfigure.x
x
, ev.xconfigure.
ev.xconfigure.y
y
,
ev.xany.serial, cast(int) ev.xany.send_event, cast(int) ev.xconfigure.override_redirect); if (cw > screenW || ch > screenH) emitf("quirk", "name=beyond_screen configure=%dx%d screen=%dx%d", cw, ch, screenW, screenH); if (cw == pendingW && ch == pendingH) pendingW = pendingH = 0; // our request landed if (cw != width || ch != height) { width = cw; height = ch; emitf("resize", "size=%dx%d scale=1", width, height); destroyBackbuffer(dpy, buf); buf = createBackbuffer(dpy, visual, depth, width, height, haveShm); ++reallocs; emitf("buffer_realloc", "size=%dx%d shm=%d bytes=%d", width, height, cast(int) buf.
buf.usingShm
usingShm
, buf.
buf.ximg
ximg
.bytes_per_line * buf.
buf.ximg
ximg
.
buf.ximg.height
height
);
needsRedraw = true; } break; case Expose: emitf("expose", "count=%d area=%dx%d+%d+%d serial=%lu", ev.xexpose.count, ev.xexpose.
ev.xexpose.width
width
, ev.xexpose.
ev.xexpose.height
height
, ev.xexpose.
ev.xexpose.x
x
, ev.xexpose.
ev.xexpose.y
y
,
ev.xany.serial); if (ev.xexpose.count == 0) // last Expose of the batch needsRedraw = true; break; case ClientMessage: if (cast(Atom) ev.xclient.
ev.xclient.data
data
.l[0] == wmDelete)
{ emit("close_requested via=WM_DELETE_WINDOW"); running = false; } break; case KeyPress: emit("close_requested via=KeyPress"); running = false; break; default: if (buf.
buf.usingShm
usingShm
&& ev.type == shmCompletionType)
awaitingCompletion = false; break; } } // Storm driver (auto-exit mode): self resizes every ~6 frames, then // the burst, then external resizes from the second connection. if (
(local variable) const(bool) autoExit
autoExit
&&
(local variable) bool sawFirstPixel
sawFirstPixel
&& !
(local variable) bool awaitingCompletion
awaitingCompletion
)
{ if (
(local variable) int selfIssued
selfIssued
<
(immutable global) immutable(int[2][6]) app.main.selfStorm
selfStorm
.
(constant) ulong immutable(int[2][6]).length = 6LU
length
&&
(local variable) int frames
frames
>= 6 * (
(local variable) int selfIssued
selfIssued
+ 1))
{ const
(local variable) immutable(int[2]) s
s
=
(immutable global) immutable(int[2][6]) app.main.selfStorm
selfStorm
[
(local variable) int selfIssued
selfIssued
];
XResizeWindow(dpy, win, cast(uint) s[0], cast(uint) s[1]);
undefined identifier `XResizeWindow`
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("step", "name=XResizeWindow conn=self n=%d size=%dx%d",
(local variable) int selfIssued
selfIssued
+ 1,
(local variable) immutable(int[2]) s
s
[0],
(local variable) immutable(int[2]) s
s
[1]);
(local variable) int pendingW
pendingW
=
(local variable) immutable(int[2]) s
s
[0];
(local variable) int pendingH
pendingH
=
(local variable) immutable(int[2]) s
s
[1];
++
(local variable) int selfIssued
selfIssued
;
} else if (
(local variable) int selfIssued
selfIssued
==
(immutable global) immutable(int[2][6]) app.main.selfStorm
selfStorm
.
(constant) ulong immutable(int[2][6]).length = 6LU
length
&& !
(local variable) bool burstIssued
burstIssued
&&
(local variable) int frames
frames
>= 6 * (
(local variable) int selfIssued
selfIssued
+ 1))
{ foreach (
(parameter) ulong i
i
,
(parameter) immutable(int[2]) s
s
;
(immutable global) immutable(int[2][3]) app.main.burst
burst
) // three requests, no frame in between
{ XResizeWindow(dpy, win, cast(uint) s[0], cast(uint) s[1]);
undefined identifier `XResizeWindow`
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("step", "name=XResizeWindow conn=self_burst n=%zu size=%dx%d",
(local variable) ulong i
i
+ 1,
(local variable) immutable(int[2]) s
s
[0],
(local variable) immutable(int[2]) s
s
[1]);
}
(local variable) int pendingW
pendingW
=
(immutable global) immutable(int[2][3]) app.main.burst
burst
[$ - 1][0];
(local variable) int pendingH
pendingH
=
(immutable global) immutable(int[2][3]) app.main.burst
burst
[$ - 1][1];
(local variable) bool burstIssued
burstIssued
= true;
} else if (
(local variable) bool burstIssued
burstIssued
&&
(local variable) int extIssued
extIssued
<
(immutable global) immutable(int[2][4]) app.main.extStorm
extStorm
.
(constant) ulong immutable(int[2][4]).length = 4LU
length
&&
(local variable) int frames
frames
>= 6 * (
(local variable) int selfIssued
selfIssued
+ 2 +
(local variable) int extIssued
extIssued
))
{ if (dpy2 is null) { dpy2 = XOpenDisplay(null);
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("step", "name=XOpenDisplay conn=external fd=%d",
dpy2 !is null ? XConnectionNumber(dpy2) : -1);
undefined identifier `XConnectionNumber`
} if (dpy2 !is null) { const
(local variable) immutable(int[2]) s
s
=
(immutable global) immutable(int[2][4]) app.main.extStorm
extStorm
[
(local variable) int extIssued
extIssued
];
XResizeWindow(dpy2, win, cast(uint) s[0], cast(uint) s[1]);
undefined identifier `XResizeWindow`
XSync(dpy2, False); // make the external client synchronous
undefined identifier `XSync`
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("step", "name=XResizeWindow conn=external n=%d size=%dx%d",
(local variable) int extIssued
extIssued
+ 1,
(local variable) immutable(int[2]) s
s
[0],
(local variable) immutable(int[2]) s
s
[1]);
(local variable) int pendingW
pendingW
=
(local variable) immutable(int[2]) s
s
[0];
(local variable) int pendingH
pendingH
=
(local variable) immutable(int[2]) s
s
[1];
} ++
(local variable) int extIssued
extIssued
;
if (
(local variable) int extIssued
extIssued
==
(immutable global) immutable(int[2][4]) app.main.extStorm
extStorm
.
(constant) ulong immutable(int[2][4]).length = 4LU
length
&& dpy2 !is null)
{ XCloseDisplay(dpy2);
undefined identifier `XCloseDisplay`
dpy2 = null;
void instrument.emit(scope const(char)* kind) nothrow @nogc

Emit an event with no key=value payload.

emit
("step name=XCloseDisplay conn=external");
} } ++
(local variable) int phase
phase
;
(local variable) bool needsRedraw
needsRedraw
= true;
} // Present. A frame drawn while a resize request is still in flight is // the structural X11 stale-frame artifact — log it as such. if (
(local variable) bool needsRedraw
needsRedraw
&& !
(local variable) bool awaitingCompletion
awaitingCompletion
&& buf.
(field) _error_ buf.ximg
ximg
!is null)
{ drawGradient(buf.
buf.ximg
ximg
, phase);
if (buf.
(field) _error_ buf.usingShm
usingShm
)
{ XShmPutImage(dpy, win, gc, buf.
buf.ximg
ximg
, 0, 0, 0, 0,
undefined identifier `XShmPutImage`
cast(uint) buf.
buf.width
width
, cast(uint) buf.
buf.height
height
, True);
XFlush(dpy); // push the put before sleeping in poll()
undefined identifier `XFlush`
(local variable) bool awaitingCompletion
awaitingCompletion
= true;
} else { XPutImage(dpy, win, gc, buf.
buf.ximg
ximg
, 0, 0, 0, 0,
undefined identifier `XPutImage`
cast(uint) buf.
buf.width
width
, cast(uint) buf.
buf.height
height
);
XSync(dpy, False);
undefined identifier `XSync`
} if (!
(local variable) bool sawFirstPixel
sawFirstPixel
)
{
(local variable) bool sawFirstPixel
sawFirstPixel
= true;
void instrument.emit(scope const(char)* kind) nothrow @nogc

Emit an event with no key=value payload.

emit
("first_pixel_presented");
} ++
(local variable) int frames
frames
;
if (
(local variable) int pendingW
pendingW
!= 0 && (buf.
(field) _error_ buf.width
width
!=
(local variable) int pendingW
pendingW
|| buf.
(field) _error_ buf.height
height
!=
(local variable) int pendingH
pendingH
))
{ ++
(local variable) int staleFrames
staleFrames
;
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("stale_frame", "frame=%d size=%dx%d pending=%dx%d",
(local variable) int frames
frames
, buf.
(field) _error_ buf.width
width
, buf.
(field) _error_ buf.height
height
,
(local variable) int pendingW
pendingW
,
(local variable) int pendingH
pendingH
);
}
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("frame_callback", "t=%lld frame=%d size=%dx%d",
long instrument.nowUs() nothrow @nogc

Microseconds elapsed since initInstrument.

nowUs
(),
(local variable) int frames
frames
, buf.
(field) _error_ buf.width
width
, buf.
(field) _error_ buf.height
height
);
(local variable) bool needsRedraw
needsRedraw
= false;
} if (
(local variable) const(bool) autoExit
autoExit
&& (
(local variable) int frames
frames
>= 140 ||
long instrument.nowUs() nothrow @nogc

Microseconds elapsed since initInstrument.

nowUs
() > 8_000_000))
{
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("auto_exit", "frames=%d self=%d burst=%d ext=%d",
(local variable) int frames
frames
,
(local variable) int selfIssued
selfIssued
, cast(int)
(local variable) bool burstIssued
burstIssued
* 3,
(local variable) int extIssued
extIssued
);
break; } pollfd
(local variable) _error_ pfd
pfd
;
undefined identifier `pollfd`
pfd.
pfd.fd
fd
= fd;
pfd.events = POLLIN; pfd.revents = 0; poll(&pfd, 1, autoExit ? 5 : -1);
undefined identifier `poll`
} // The F02 verdict line: zero protocol errors, zero size mismatches at exit.
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

Emit an event with a printf-formatted key=value ... payload.

emitf
("summary", "configures=%d reallocs=%d stale_frames=%d errors=%d final=%dx%d",
(local variable) int configures
configures
,
(local variable) int reallocs
reallocs
,
(local variable) int staleFrames
staleFrames
,
(__gshared global) int app.g_xErrors
g_xErrors
,
(local variable) int width
width
,
(local variable) int height
height
);
void instrument.emit(scope const(char)* kind) nothrow @nogc

Emit an event with no key=value payload.

emit
("teardown");
return
(__gshared global) int app.g_xErrors
g_xErrors
== 0 ? 0 : 1;
}