app.dhover×544 error×73all
// X11 F07 demo — IME / text input via XIM (../../../features/f07-text-input.md).
// Built on the scaffold (../scaffold/app.d): same ImportC binding style, same
// poll(2)-driven readiness loop, same instrument.d event log.
//
// An editable line with a visible caret, rendered as colored block cells
// (committed = colored blocks, pre-edit = gray blocks + underline, caret =
// black bar; the *real* strings go to the log). On top of that, the full XIM
// bring-up with every pathology instrumented:
//
//   * Locale coupling: setlocale(LC_ALL, "") -> XSupportsLocale ->
//     XSetLocaleModifiers("") are all logged — run with LC_ALL=C vs C.UTF-8
//     (the run.sh driver does) to watch the IM stack degrade.
//   * XOpenIM timed (for the XMODIFIERS=@im=nonexistent measurement), the
//     offered style list dumped, and the negotiated style logged after a
//     preference walk: PreeditPosition -> PreeditCallbacks -> PreeditNothing
//     -> PreeditNone (WSI_XIM_STYLE=callbacks|nothing reorders it).
//   * The XFilterEvent gate: EVERY event passes through it first; swallowed
//     events are logged `filtered type=… keycode=…` so the IM's appetite is
//     visible.
//   * Xutf8LookupString in the key path; XNSpotLocation re-reported on every
//     caret move (over-the-spot candidate anchoring); preedit callbacks
//     (start/draw/caret/done) implemented for the on-the-spot style.
//   * XNDestroyCallback on the IM + XRegisterIMInstantiateCallback on the
//     display: an IM server starting *after* the demo (or dying under it) is
//     observed live — flags set in the callbacks, reopened from the loop.
//
// Without an IM (XOpenIM failed and nothing instantiated) the demo falls
// back to XLookupString and keeps running. WSI_AUTO_EXIT=1 bounds the run
// (WSI_DURATION_MS, default 10 s). Headless-safe: no X server -> prints
// `SKIP:` and exits 0. Findings: ../../f07-text-input.md.
module 
(module) app
app
;
import
(module) c
c
; // ImportC: Xlib + Xutil (XIM lives in libX11 proper) + poll
C preprocess command `cpp` failed for file `/home/runner/work/sparkles/sparkles/docs/research/window-system-integration/os-apis/x11/examples/f07-text-input/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.locale

D header file for C99.

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

Source

core/stdc/locale.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)
locale
:
(alias constant) app.LC_ALL = int core.stdc.locale.LC_ALL = 6
LC_ALL
,
(alias) app.setlocale = char* core.stdc.locale.setlocale(int category, scope const(char*) locale) nothrow @nogc @system
setlocale
;
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.atoi = int core.stdc.stdlib.atoi(scope const(char*) nptr) nothrow @nogc
atoi
,
(alias) app.getenv = char* core.stdc.stdlib.getenv(scope const(char*) name) nothrow @nogc
getenv
;
import
(package) core
core
.
(package) core.stdc
stdc
.
(module) core.stdc.string

D header file for C99.

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

Source

core/stdc/string.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)
string
:
(alias) app.memmove = void* core.stdc.string.memmove(return scope void* s1, scope const(void*) s2, ulong n) pure nothrow @nogc
memmove
,
(alias) app.strlen = ulong core.stdc.string.strlen(scope const(char*) s) pure nothrow @nogc
strlen
;
// --------------------------------------------------------------------------- // Constants Xlib exposes as macros that ImportC cannot import; re-declared // per the scaffold gotcha. The XN* "names" are string macros in Xlib.h. enum : c_long {
(enum value) app.KeyPressMask = 1L
KeyPressMask
= 1L << 0,
(enum value) app.KeyReleaseMask = 2L
KeyReleaseMask
= 1L << 1,
(enum value) app.ExposureMask = 32768L
ExposureMask
= 1L << 15,
(enum value) app.StructureNotifyMask = 131072L
StructureNotifyMask
= 1L << 17,
(enum value) app.FocusChangeMask = 2097152L
FocusChangeMask
= 1L << 21,
} enum // XEvent.type discriminators {
(enum value) app.KeyPress = 2
KeyPress
= 2,
(enum value) app.KeyRelease = 3
KeyRelease
= 3,
(enum value) app.FocusIn = 9
FocusIn
= 9,
(enum value) app.FocusOut = 10
FocusOut
= 10,
(enum value) app.Expose = 12
Expose
= 12,
(enum value) app.MapNotify = 19
MapNotify
= 19,
(enum value) app.ConfigureNotify = 22
ConfigureNotify
= 22,
(enum value) app.ClientMessage = 33
ClientMessage
= 33,
} 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.ZPixmap = 2
ZPixmap
= 2;
enum
(constant) int app.RevertToParent = 2
RevertToParent
= 2;
enum
(constant) int app.CurrentTime = 0
CurrentTime
= 0;
enum : c_ulong // XIMStyle bits (Xlib.h macros) {
(enum value) app.XIMPreeditArea = 1LU
XIMPreeditArea
= 0x0001,
(enum value) app.XIMPreeditCallbacks = 2LU
XIMPreeditCallbacks
= 0x0002,
(enum value) app.XIMPreeditPosition = 4LU
XIMPreeditPosition
= 0x0004,
(enum value) app.XIMPreeditNothing = 8LU
XIMPreeditNothing
= 0x0008,
(enum value) app.XIMPreeditNone = 16LU
XIMPreeditNone
= 0x0010,
(enum value) app.XIMStatusArea = 256LU
XIMStatusArea
= 0x0100,
(enum value) app.XIMStatusCallbacks = 512LU
XIMStatusCallbacks
= 0x0200,
(enum value) app.XIMStatusNothing = 1024LU
XIMStatusNothing
= 0x0400,
(enum value) app.XIMStatusNone = 2048LU
XIMStatusNone
= 0x0800,
} enum // Xutf8LookupString status (Xlib.h macros) {
(enum value) app.XBufferOverflow = -1
XBufferOverflow
= -1,
(enum value) app.XLookupNone = 1
XLookupNone
= 1,
(enum value) app.XLookupChars = 2
XLookupChars
= 2,
(enum value) app.XLookupKeySym = 3
XLookupKeySym
= 3,
(enum value) app.XLookupBoth = 4
XLookupBoth
= 4,
} enum // keysyms the editor reacts to (keysymdef.h macros) {
(enum value) app.XK_BackSpace = 65288
XK_BackSpace
= 0xff08,
(enum value) app.XK_Return = 65293
XK_Return
= 0xff0d,
(enum value) app.XK_Escape = 65307
XK_Escape
= 0xff1b,
(enum value) app.XK_Left = 65361
XK_Left
= 0xff51,
(enum value) app.XK_Right = 65363
XK_Right
= 0xff53,
} // XN* argument names (string macros in Xlib.h). immutable
(immutable global) immutable(string) app.XNQueryInputStyle
XNQueryInputStyle
= "queryInputStyle";
immutable
(immutable global) immutable(string) app.XNClientWindow
XNClientWindow
= "clientWindow";
immutable
(immutable global) immutable(string) app.XNInputStyle
XNInputStyle
= "inputStyle";
immutable
(immutable global) immutable(string) app.XNFocusWindow
XNFocusWindow
= "focusWindow";
immutable
(immutable global) immutable(string) app.XNPreeditAttributes
XNPreeditAttributes
= "preeditAttributes";
immutable
(immutable global) immutable(string) app.XNSpotLocation
XNSpotLocation
= "spotLocation";
immutable
(immutable global) immutable(string) app.XNFontSet
XNFontSet
= "fontSet";
immutable
(immutable global) immutable(string) app.XNFilterEvents
XNFilterEvents
= "filterEvents";
immutable
(immutable global) immutable(string) app.XNDestroyCallback
XNDestroyCallback
= "destroyCallback";
immutable
(immutable global) immutable(string) app.XNPreeditStartCallback
XNPreeditStartCallback
= "preeditStartCallback";
immutable
(immutable global) immutable(string) app.XNPreeditDoneCallback
XNPreeditDoneCallback
= "preeditDoneCallback";
immutable
(immutable global) immutable(string) app.XNPreeditDrawCallback
XNPreeditDrawCallback
= "preeditDrawCallback";
immutable
(immutable global) immutable(string) app.XNPreeditCaretCallback
XNPreeditCaretCallback
= "preeditCaretCallback";
// --------------------------------------------------------------------------- // The editable line: committed text + pre-edit, both as arrays of UTF-8 // codepoint cells (block-cell rendering; the log carries the real bytes). enum
(constant) int app.MaxCells = 120
MaxCells
= 120;
struct
(struct) app.CellLine
CellLine
{ char[8][
(constant) int app.MaxCells = 120
MaxCells
]
(field) char[8][120] app.CellLine.cells
cells
;
ubyte[
(constant) int app.MaxCells = 120
MaxCells
]
(field) ubyte[120] app.CellLine.len
len
;
int
(field) int app.CellLine.count
count
,
(field) int app.CellLine.caret
caret
;
void
void app.CellLine.insert(const(char)* bytes, int n) nothrow @nogc
insert
(const(char)*
(parameter) const(char)* bytes
bytes
, int
(parameter) int n
n
) @nogc nothrow
{ int
(local variable) int i
i
= 0;
while (
(local variable) int i
i
<
(parameter) int n
n
&&
(field) int app.CellLine.count
count
<
(constant) int app.MaxCells = 120
MaxCells
)
{ int
(local variable) int cl
cl
= 1; // codepoint length from the UTF-8 lead byte
while (
(local variable) int i
i
+
(local variable) int cl
cl
<
(parameter) int n
n
&& (
(parameter) const(char)* bytes
bytes
[
(local variable) int i
i
+
(local variable) int cl
cl
] & 0xc0) == 0x80)
++
(local variable) int cl
cl
;
if (
(local variable) int cl
cl
> 8)
(local variable) int cl
cl
= 8;
void* core.stdc.string.memmove(return scope void* s1, scope const(void*) s2, ulong n) pure nothrow @nogc
memmove
(&
(field) char[8][120] app.CellLine.cells
cells
[
(field) int app.CellLine.caret
caret
+ 1], &
(field) char[8][120] app.CellLine.cells
cells
[
(field) int app.CellLine.caret
caret
], (
(field) int app.CellLine.count
count
-
(field) int app.CellLine.caret
caret
) * 8);
void* core.stdc.string.memmove(return scope void* s1, scope const(void*) s2, ulong n) pure nothrow @nogc
memmove
(&
(field) ubyte[120] app.CellLine.len
len
[
(field) int app.CellLine.caret
caret
+ 1], &
(field) ubyte[120] app.CellLine.len
len
[
(field) int app.CellLine.caret
caret
],
(field) int app.CellLine.count
count
-
(field) int app.CellLine.caret
caret
);
(field) char[8][120] app.CellLine.cells
cells
[
(field) int app.CellLine.caret
caret
][0 ..
(local variable) int cl
cl
] =
(parameter) const(char)* bytes
bytes
[
(local variable) int i
i
..
(local variable) int i
i
+
(local variable) int cl
cl
];
(field) ubyte[120] app.CellLine.len
len
[
(field) int app.CellLine.caret
caret
] = cast(ubyte)
(local variable) int cl
cl
;
++
(field) int app.CellLine.count
count
;
++
(field) int app.CellLine.caret
caret
;
(local variable) int i
i
+=
(local variable) int cl
cl
;
} } void
void app.CellLine.remove(int first, int n) nothrow @nogc
remove
(int
(parameter) int first
first
, int
(parameter) int n
n
) @nogc nothrow
{ if (
(parameter) int first
first
< 0 ||
(parameter) int first
first
>=
(field) int app.CellLine.count
count
)
return; if (
(parameter) int first
first
+
(parameter) int n
n
>
(field) int app.CellLine.count
count
)
(parameter) int n
n
=
(field) int app.CellLine.count
count
-
(parameter) int first
first
;
void* core.stdc.string.memmove(return scope void* s1, scope const(void*) s2, ulong n) pure nothrow @nogc
memmove
(&
(field) char[8][120] app.CellLine.cells
cells
[
(parameter) int first
first
], &
(field) char[8][120] app.CellLine.cells
cells
[
(parameter) int first
first
+
(parameter) int n
n
], (
(field) int app.CellLine.count
count
-
(parameter) int first
first
-
(parameter) int n
n
) * 8);
void* core.stdc.string.memmove(return scope void* s1, scope const(void*) s2, ulong n) pure nothrow @nogc
memmove
(&
(field) ubyte[120] app.CellLine.len
len
[
(parameter) int first
first
], &
(field) ubyte[120] app.CellLine.len
len
[
(parameter) int first
first
+
(parameter) int n
n
],
(field) int app.CellLine.count
count
-
(parameter) int first
first
-
(parameter) int n
n
);
(field) int app.CellLine.count
count
-=
(parameter) int n
n
;
if (
(field) int app.CellLine.caret
caret
>
(field) int app.CellLine.count
count
)
(field) int app.CellLine.caret
caret
=
(field) int app.CellLine.count
count
;
} /// NUL-terminated concatenation, for the log. const(char)*
const(char)* app.CellLine.str(return ref char[1024] buf) nothrow @nogc

NUL-terminated concatenation, for the log.

str
(return ref char[1024]
(parameter) char[1024] buf
buf
) @nogc nothrow
{
(alias) object.size_t = ulong
size_t
(local variable) ulong o
o
;
foreach (
(local variable) int i
i
; 0 ..
(field) int app.CellLine.count
count
)
{
(parameter) char[1024] buf
buf
[
(local variable) ulong o
o
..
(local variable) ulong o
o
+
(field) ubyte[120] app.CellLine.len
len
[
(local variable) int i
i
]] =
(field) char[8][120] app.CellLine.cells
cells
[
(local variable) int i
i
][0 ..
(field) ubyte[120] app.CellLine.len
len
[
(local variable) int i
i
]];
(local variable) ulong o
o
+=
(field) ubyte[120] app.CellLine.len
len
[
(local variable) int i
i
];
}
(parameter) char[1024] buf
buf
[
(local variable) ulong o
o
] = '\0';
return
(parameter) char[1024] buf
buf
.
(constant) char* char[1024].ptr = &buf
ptr
;
} } // --------------------------------------------------------------------------- // Shared state the XIM callbacks mutate (single-threaded demo; the callbacks // run inside XFilterEvent/XPending on this thread). __gshared
(struct) app.CellLine
CellLine
(__gshared global) app.CellLine app.g_text
g_text
; // committed
__gshared
(struct) app.CellLine
CellLine
(__gshared global) app.CellLine app.g_pre
g_pre
; // pre-edit (PreeditCallbacks style only)
__gshared bool
(__gshared global) bool app.g_imDestroyed
g_imDestroyed
,
(__gshared global) bool app.g_imInstantiated
g_imInstantiated
,
(__gshared global) bool app.g_dirty
g_dirty
;
__gshared int
(__gshared global) int app.g_preeditDraws
g_preeditDraws
;
extern (C) int
app.preeditStart
preeditStart
(XIC
(parameter) XIC ic
ic
, XPointer client, XPointer call) @nogc nothrow
undefined identifier `XIC`
undefined identifier `XPointer`
undefined identifier `XPointer`
{ emit("preedit_start (returning -1: no length limit)"); return -1; } extern (C) void
app.preeditDone
preeditDone
(XIC
(parameter) XIC ic
ic
, XPointer client, XPointer call) @nogc nothrow
undefined identifier `XIC`
undefined identifier `XPointer`
undefined identifier `XPointer`
{ emit("preedit_done"); g_pre.
g_pre.count
count
= 0;
g_pre.
g_pre.caret
caret
= 0;
g_dirty = true; } extern (C) void
app.preeditDraw
preeditDraw
(XIC
(parameter) XIC ic
ic
, XPointer client,
undefined identifier `XIC`
undefined identifier `XPointer`
XIMPreeditDrawCallbackStruct* call) @nogc nothrow
undefined identifier `XIMPreeditDrawCallbackStruct`
{ ++g_preeditDraws; const
_error_ mb
mb
= xim_text_mb(call.text);
emitf("preedit_draw", "caret=%d chg_first=%d chg_length=%d text=%s", call.
call.caret
caret
, call.chg_first, call.chg_length,
mb !is null ? mb : "(null)".
"(null)".ptr
ptr
);
// Replace [chg_first, chg_first+chg_length) with the new text (the XIM // delta protocol; text==null means pure deletion). g_pre.
g_pre.remove
remove
(call.chg_first, call.chg_length);
if (mb !is null) { g_pre.
g_pre.caret
caret
= call.chg_first;
g_pre.
g_pre.insert
insert
(mb, cast(int) strlen(mb));
} g_pre.
g_pre.caret
caret
= call.
call.caret
caret
;
char[1024]
_error_ buf
buf
;
emitf("preedit_state", "text=%s caret=%d", g_pre.
g_pre.str
str
(buf), g_pre.
g_pre.caret
caret
);
g_dirty = true; } extern (C) void
app.preeditCaret
preeditCaret
(XIC
(parameter) XIC ic
ic
, XPointer client,
undefined identifier `XIC`
undefined identifier `XPointer`
XIMPreeditCaretCallbackStruct* call) @nogc nothrow
undefined identifier `XIMPreeditCaretCallbackStruct`
{ emitf("preedit_caret", "position=%d direction=%d style=%d", call.position, call.direction, call.
call.style
style
);
g_pre.
g_pre.caret
caret
= call.position;
g_dirty = true; } extern (C) void
app.imDestroyed
imDestroyed
(XIM
(parameter) XIM im
im
, XPointer client, XPointer call) @nogc nothrow
undefined identifier `XIM`
undefined identifier `XPointer`
undefined identifier `XPointer`
{ // The IM server died. The XIM and all its XICs are already invalid — // using (or closing) them is a use-after-free; just forget them. emit("im_destroyed (XIM and XICs now invalid; must NOT XCloseIM)"); g_imDestroyed = true; } extern (C) void
app.imInstantiated
imInstantiated
(Display*
(parameter) Display* dpy
dpy
, XPointer client, XPointer call) @nogc nothrow
undefined identifier `Display`
undefined identifier `XPointer`
undefined identifier `XPointer`
{ // An IM matching the locale modifiers just became available (e.g. an IM // server started after us, or the built-in IM at registration time). emit("im_instantiated"); g_imInstantiated = true; } // --------------------------------------------------------------------------- // XIM bring-up: style negotiation + IC creation, every step logged. const(char)*
const(char)* app.styleName(ulong s, return ref char[64] buf) nothrow @nogc
styleName
(c_ulong
(parameter) ulong s
s
, return ref char[64]
(parameter) char[64] buf
buf
) @nogc nothrow
{ 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) snprintf = int core.stdc.stdio.snprintf(scope char* s, ulong n, scope const(char*) format, scope const ...) nothrow @nogc
snprintf
;
const(char)*
(local variable) const(char)* pre
pre
= (
(parameter) ulong s
s
&
(enum value) app.XIMPreeditPosition = 4LU
XIMPreeditPosition
) ? "Position"
: (
(parameter) ulong s
s
&
(enum value) app.XIMPreeditCallbacks = 2LU
XIMPreeditCallbacks
) ? "Callbacks" : (
(parameter) ulong s
s
&
(enum value) app.XIMPreeditArea = 1LU
XIMPreeditArea
) ? "Area"
: (
(parameter) ulong s
s
&
(enum value) app.XIMPreeditNothing = 8LU
XIMPreeditNothing
) ? "Nothing" : (
(parameter) ulong s
s
&
(enum value) app.XIMPreeditNone = 16LU
XIMPreeditNone
) ? "None" : "?";
const(char)*
(local variable) const(char)* st
st
= (
(parameter) ulong s
s
&
(enum value) app.XIMStatusCallbacks = 512LU
XIMStatusCallbacks
) ? "Callbacks"
: (
(parameter) ulong s
s
&
(enum value) app.XIMStatusArea = 256LU
XIMStatusArea
) ? "Area"
: (
(parameter) ulong s
s
&
(enum value) app.XIMStatusNothing = 1024LU
XIMStatusNothing
) ? "Nothing" : (
(parameter) ulong s
s
&
(enum value) app.XIMStatusNone = 2048LU
XIMStatusNone
) ? "None" : "?";
int core.stdc.stdio.snprintf(scope char* s, ulong n, scope const(char*) format, scope const ...) nothrow @nogc
snprintf
(
(parameter) char[64] buf
buf
.
(constant) char* char[64].ptr = &buf
ptr
,
(parameter) char[64] buf
buf
.
(constant) ulong char[64].length = 64LU
length
, "Preedit%s|Status%s",
(local variable) const(char)* pre
pre
,
(local variable) const(char)* st
st
);
return
(parameter) char[64] buf
buf
.
(constant) char* char[64].ptr = &buf
ptr
;
} struct
(struct) app.Im
Im
{ XIM
(field) _error_ app.Im.im
im
;
undefined identifier `XIM`
XIC
(field) _error_ app.Im.ic
ic
;
undefined identifier `XIC`
c_ulong
(field) ulong app.Im.style
style
;
c_long
(field) long app.Im.filterMask
filterMask
;
} /// XOpenIM (timed) + destroy callback + style query/negotiation + XCreateIC. /// Returns im=null when no IM is reachable for the current locale modifiers.
(struct) app.Im
Im
app.openInputMethod

XOpenIM (timed) + destroy callback + style query/negotiation + XCreateIC. Returns im=null when no IM is reachable for the current locale modifiers.

openInputMethod
(Display*
(parameter) Display* dpy
dpy
, Window
(parameter) Window win
win
, XFontSet
(parameter) XFontSet fs
fs
, ref XPoint
(parameter) XPoint spot
spot
) nothrow
undefined identifier `Display`
undefined identifier `Window`
undefined identifier `XFontSet`, did you mean variable `XNFontSet`?
undefined identifier `XPoint`
{
(unresolved type) Im
Im
_error_ r
r
;
const
_error_ t0
t0
= nowUs();
r.
r.im
im
= XOpenIM(dpy, null, null, null);
emitf("step", "name=XOpenIM ok=%d took_us=%lld", cast(int)(r.
r.im
im
!is null),
nowUs() - t0); if (r.
r.im
im
is null)
return r; static XIMCallback
XIMCallback destroyCb
destroyCb
; // must outlive the IM
destroyCb.client_data = null; destroyCb.callback = cast(XIMProc)&imDestroyed; const
_error_ dcErr
dcErr
= XSetIMValues(r.
r.im
im
, XNDestroyCallback.
XNDestroyCallback.ptr
ptr
, &destroyCb, null);
emitf("step", "name=XSetIMValues destroy_callback=%s", dcErr is null ? "registered".
"registered".ptr
ptr
: dcErr);
// What the IM offers, verbatim. XIMStyles*
_error_ styles
styles
;
char[64]
_error_ nm
nm
;
if (XGetIMValues(r.
r.im
im
, XNQueryInputStyle.
XNQueryInputStyle.ptr
ptr
, &styles, null) !is null
|| styles is null) { emit("step name=XGetIMValues queryInputStyle=FAILED"); return r; } foreach (
(parameter) i
i
; 0 .. styles.count_styles)
emitf("xim_style_offered", "style=0x%04lx name=%s", styles.supported_styles[i], styleName(styles.supported_styles[i], nm)); // Preference walk (F07 spec: Position first, fall back through Nothing). const
_error_ pref
pref
= getenv("WSI_XIM_STYLE");
c_ulong[4]
_error_ wanted
wanted
= [
XIMPreeditPosition | XIMStatusNothing, XIMPreeditCallbacks | XIMStatusNothing, XIMPreeditNothing | XIMStatusNothing, XIMPreeditNone | XIMStatusNone, ]; if (pref !is null && pref[0] == 'c') // callbacks (on-the-spot) first wanted[0 .. 2] = [XIMPreeditCallbacks | XIMStatusNothing, XIMPreeditPosition | XIMStatusNothing]; if (pref !is null && pref[0] == 'n') // nothing (root-window style) only wanted = [XIMPreeditNothing | XIMStatusNothing, XIMPreeditNone | XIMStatusNone, 0, 0]; foreach (
(parameter) w
w
; wanted)
{ bool
_error_ offered
offered
= false;
foreach (
(parameter) i
i
; 0 .. styles.count_styles)
offered |= styles.supported_styles[i] == w; if (w == 0 || !offered) continue; if (w & XIMPreeditPosition) { // Over-the-spot: the IM draws the pre-edit at XNSpotLocation // with XNFontSet; both are *required* create-time attributes. XVaNestedList
_error_ plist
plist
= XVaCreateNestedList(0,
XNSpotLocation.
XNSpotLocation.ptr
ptr
, &spot, XNFontSet.
XNFontSet.ptr
ptr
, fs, null);
r.
r.ic
ic
= XCreateIC(r.
r.im
im
, XNInputStyle.
XNInputStyle.ptr
ptr
, w,
XNClientWindow.
XNClientWindow.ptr
ptr
, win, XNFocusWindow.
XNFocusWindow.ptr
ptr
, win,
XNPreeditAttributes.
XNPreeditAttributes.ptr
ptr
, plist, null);
XFree(plist); } else if (w & XIMPreeditCallbacks) { // On-the-spot: the app draws the pre-edit; the IM drives it // through these four callbacks. static XIMCallback
XIMCallback startCb
startCb
,
XIMCallback doneCb
doneCb
,
XIMCallback drawCb
drawCb
,
XIMCallback caretCb
caretCb
;
startCb.callback = cast(XIMProc)&preeditStart; doneCb.callback = cast(XIMProc)&preeditDone; drawCb.callback = cast(XIMProc)&preeditDraw; caretCb.callback = cast(XIMProc)&preeditCaret; XVaNestedList
_error_ plist
plist
= XVaCreateNestedList(0,
XNPreeditStartCallback.
XNPreeditStartCallback.ptr
ptr
, &startCb,
XNPreeditDoneCallback.
XNPreeditDoneCallback.ptr
ptr
, &doneCb,
XNPreeditDrawCallback.
XNPreeditDrawCallback.ptr
ptr
, &drawCb,
XNPreeditCaretCallback.
XNPreeditCaretCallback.ptr
ptr
, &caretCb, null);
r.
r.ic
ic
= XCreateIC(r.
r.im
im
, XNInputStyle.
XNInputStyle.ptr
ptr
, w,
XNClientWindow.
XNClientWindow.ptr
ptr
, win, XNFocusWindow.
XNFocusWindow.ptr
ptr
, win,
XNPreeditAttributes.
XNPreeditAttributes.ptr
ptr
, plist, null);
XFree(plist); } else r.
r.ic
ic
= XCreateIC(r.
r.im
im
, XNInputStyle.
XNInputStyle.ptr
ptr
, w,
XNClientWindow.
XNClientWindow.ptr
ptr
, win, XNFocusWindow.
XNFocusWindow.ptr
ptr
, win, null);
if (r.
r.ic
ic
!is null)
{ r.
r.style
style
= w;
emitf("xim_style_negotiated", "style=0x%04lx name=%s", w, styleName(w, nm)); break; } emitf("step", "name=XCreateIC style=0x%04lx FAILED (falling back)", w); } XFree(styles); if (r.
r.ic
ic
is null)
return r; // The IM may need events the app did not select (e.g. the built-in IM // wants KeyRelease for compose) — the app MUST add XNFilterEvents to its // own mask or XFilterEvent never sees them. XGetICValues(r.
r.ic
ic
, XNFilterEvents.
XNFilterEvents.ptr
ptr
, &r.
r.filterMask
filterMask
, null);
emitf("step", "name=XGetICValues filterEvents=0x%lx", r.
r.filterMask
filterMask
);
return r; } // --------------------------------------------------------------------------- // Block-cell rendering: committed cells colored by codepoint, pre-edit cells // gray with an underline, caret as a black bar. F07 req 1, sans fonts. enum
(constant) int app.CellW = 14
CellW
= 14,
(constant) int app.CellH = 22
CellH
= 22,
(constant) int app.OriginX = 12
OriginX
= 12,
(constant) int app.OriginY = 40
OriginY
= 40;
void
app.draw
draw
(XImage*
(parameter) XImage* img
img
) @nogc nothrow
undefined identifier `XImage`
{ const
_error_ w
w
= img.
img.width
width
,
_error_ h
h
= img.
img.height
height
;
if (img.bits_per_pixel != 32) return; foreach (
(parameter) y
y
; 0 .. h)
{ auto
_error_ row
row
= cast(uint*)(img.data + y * img.bytes_per_line);
row[0 .. w] = 0xf0f0e8; if (y == 0 || y == h - 1) row[0 .. w] = 0; row[0] = 0; row[w - 1] = 0; } void
void cell(int i, uint color, bool underline)
cell
(int
(parameter) int i
i
, uint
(parameter) uint color
color
, bool
(parameter) bool underline
underline
)
{ const
_error_ x0
x0
= OriginX + i * CellW;
if (x0 + CellW >= w) return; foreach (
(parameter) y
y
; OriginY .. OriginY + CellH)
{ auto
_error_ row
row
= cast(uint*)(img.data + y * img.bytes_per_line);
const
_error_ ul
ul
= underline && y >= OriginY + CellH - 3;
row[x0 + 1 .. x0 + CellW - 1] = ul ? 0x303030 : color; } } // committed │ pre-edit (inline at the caret) │ rest of committed int
_error_ col
col
= 0;
foreach (
(parameter) i
i
; 0 .. g_text.
g_text.caret
caret
)
cell(col++, 0x4060c0 + (g_text.
g_text.cells
cells
[i][0] & 0x3f) * 0x300, false);
const
_error_ preStart
preStart
= col;
foreach (
(parameter) i
i
; 0 .. g_pre.
g_pre.count
count
)
cell(col++, 0xb0b0b0, true); foreach (
(parameter) i
i
; g_text.
g_text.caret
caret
.. g_text.
g_text.count
count
)
cell(col++, 0x4060c0 + (g_text.
g_text.cells
cells
[i][0] & 0x3f) * 0x300, false);
// caret bar (inside the pre-edit while composing) const
_error_ cx
cx
= OriginX + (preStart + g_pre.
g_pre.caret
caret
) * CellW;
foreach (
(parameter) y
y
; OriginY - 2 .. OriginY + CellH + 2)
{ auto
_error_ row
row
= cast(uint*)(img.data + y * img.bytes_per_line);
if (cx + 2 < w) row[cx .. cx + 2] = 0; } } 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
("f07_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';
const
(local variable) const(char*) envDur
envDur
=
char* core.stdc.stdlib.getenv(scope const(char*) name) nothrow @nogc
getenv
("WSI_DURATION_MS");
const
(local variable) const(int) durationMs
durationMs
=
(local variable) const(char*) envDur
envDur
!is null ?
int core.stdc.stdlib.atoi(scope const(char*) nptr) nothrow @nogc
atoi
(
(local variable) const(char*) envDur
envDur
) : 10_000;
// -- The locale coupling, step by step (F07's first pathology) ------------ // XIM is the only input path in this tree whose availability depends on // the C runtime locale: XOpenIM consults it (and XMODIFIERS) at open time. const
(local variable) const(char*) loc
loc
=
char* core.stdc.locale.setlocale(int category, scope const(char*) locale) nothrow @nogc @system
setlocale
(
(constant) int core.stdc.locale.LC_ALL = 6
LC_ALL
, "");
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=setlocale result=%s",
(local variable) const(char*) loc
loc
!is null ?
(local variable) const(char*) loc
loc
: "(failed)".
(constant) immutable(char)* "(failed)".ptr = "(failed)"
ptr
);
const
(local variable) const(_error_) supported
supported
= XSupportsLocale();
undefined identifier `XSupportsLocale`
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=XSupportsLocale supported=%d", supported);
const
(local variable) const(_error_) mods
mods
= XSetLocaleModifiers("");
undefined identifier `XSetLocaleModifiers`
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=XSetLocaleModifiers result=%s XMODIFIERS=%s",
mods !is null ? mods : "(failed)".ptr,
char* core.stdc.stdlib.getenv(scope const(char*) name) nothrow @nogc
getenv
("XMODIFIERS") !is null ?
char* core.stdc.stdlib.getenv(scope const(char*) name) nothrow @nogc
getenv
("XMODIFIERS") : "(unset)".
(constant) immutable(char)* "(unset)".ptr = "(unset)"
ptr
);
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`
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`
// -- Window ---------------------------------------------------------------- int
(local variable) int width
width
= 640,
(local variable) int height
height
= 120;
Window
(local variable) _error_ win
win
= XCreateSimpleWindow(dpy, XRootWindow(dpy, screen), 0, 0,
undefined identifier `Window`
undefined identifier `XCreateSimpleWindow`
width, height, 1, XBlackPixel(dpy, screen), XWhitePixel(dpy, screen)); XStoreName(dpy, win, "Sparkles · X11 F07 text input");
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`
enum c_long
(constant) long app.main.baseMask = 2260995L
baseMask
=
(enum value) app.KeyPressMask = 1L
KeyPressMask
|
(enum value) app.KeyReleaseMask = 2L
KeyReleaseMask
|
(enum value) app.ExposureMask = 32768L
ExposureMask
|
(enum value) app.StructureNotifyMask = 131072L
StructureNotifyMask
|
(enum value) app.FocusChangeMask = 2097152L
FocusChangeMask
;
XSelectInput(dpy, win, baseMask);
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
);
// -- Fontset (required by XIMPreeditPosition) ------------------------------ char**
(local variable) char** missing
missing
;
int
(local variable) int nMissing
nMissing
;
char*
(local variable) char* defStr
defStr
;
XFontSet
(local variable) _error_ fs
fs
= XCreateFontSet(dpy,
undefined identifier `XFontSet`, did you mean variable `XNFontSet`?
undefined identifier `XCreateFontSet`
"-*-fixed-medium-r-normal--14-*-*-*-*-*-*-*,-*-*-*-*-*-*-14-*-*-*-*-*-*-*", &missing, &nMissing, &defStr);
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=XCreateFontSet ok=%d missing_charsets=%d",
cast(int)(fs !is null),
(local variable) int nMissing
nMissing
);
if (
(local variable) char** missing
missing
!is null)
XFreeStringList(missing);
undefined identifier `XFreeStringList`
// -- IM lifecycle hooks, then the IM itself -------------------------------- // Registered BEFORE XOpenIM so an IM server that starts later (fcitx5 in // the run.sh choreography) is announced; Xlib also fires it immediately // when an IM for the current modifiers is already reachable. XRegisterIMInstantiateCallback(dpy, null, null, null,
undefined identifier `XRegisterIMInstantiateCallback`
cast(XIDProc)&imInstantiated, null);
void instrument.emit(scope const(char)* kind) nothrow @nogc

Emit an event with no key=value payload.

emit
("step name=XRegisterIMInstantiateCallback");
XPoint
(local variable) _error_ spot
spot
= XPoint(OriginX, cast(short)(OriginY + CellH)); // caret baseline
undefined identifier `XPoint`
undefined identifier `XPoint`
(struct) app.Im
Im
(local variable) _error_ im
im
= openInputMethod(dpy, win, fs, spot);
if (im.
(field) _error_ im.ic
ic
!is null && im.
(field) _error_ im.filterMask
filterMask
!= 0)
XSelectInput(dpy, win, baseMask | im.
im.filterMask
filterMask
);
undefined identifier `XSelectInput`
GC
(local variable) _error_ gc
gc
= XDefaultGC(dpy, screen);
undefined identifier `GC`
undefined identifier `XDefaultGC`
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) malloc = void* core.stdc.stdlib.malloc(ulong size) nothrow @nogc
malloc
;
XImage*
(local variable) _error_ img
img
= XCreateImage(dpy, visual, cast(uint) depth, ZPixmap, 0,
undefined identifier `XImage`
undefined identifier `XCreateImage`
cast(char*) malloc(cast(
(unresolved type) size_t
size_t
) width * height * 4),
cast(uint) width, cast(uint) height, 32, 0); // -- Helpers bound to the loop's state ------------------------------------- char[1024]
(local variable) char[1024] lineBuf
lineBuf
;
void
void app.main.updateSpot() nothrow @nogc @system
updateSpot
()
{ if (im.
(field) _error_ im.ic
ic
is null || !(im.
(field) _error_ im.style
style
&
(enum value) app.XIMPreeditPosition = 4LU
XIMPreeditPosition
))
return; spot.x = cast(short)(OriginX + g_text.
g_text.caret
caret
* CellW);
spot.
spot.y
y
= cast(short)(OriginY + CellH);
XVaNestedList
(local variable) _error_ plist
plist
= XVaCreateNestedList(0, XNSpotLocation.
XNSpotLocation.ptr
ptr
, &spot, null);
undefined identifier `XVaNestedList`
undefined identifier `XVaCreateNestedList`
XSetICValues(im.
im.ic
ic
, XNPreeditAttributes.
XNPreeditAttributes.ptr
ptr
, plist, null);
undefined identifier `XSetICValues`
XFree(plist);
undefined identifier `XFree`
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

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

emitf
("spot", "x=%d y=%d (caret cell %d)", spot.x, spot.
(field) _error_ spot.y
y
,
(__gshared global) app.CellLine app.g_text
g_text
.
(field) int app.CellLine.caret
caret
);
} const
(local variable) const(_error_) fd
fd
= XConnectionNumber(dpy);
undefined identifier `XConnectionNumber`
bool
(local variable) bool running
running
= true,
(local variable) bool focused
focused
= false;
int
(local variable) int commits
commits
= 0,
(local variable) int filtered
filtered
= 0,
(local variable) int keyEvents
keyEvents
= 0;
(__gshared global) bool app.g_dirty
g_dirty
= true;
while (
(local variable) bool running
running
)
{ while (XPending(dpy) > 0)
undefined identifier `XPending`
{ XEvent
(local variable) _error_ ev
ev
;
undefined identifier `XEvent`
XNextEvent(dpy, &ev);
undefined identifier `XNextEvent`
// THE GATE. Every event — not just key events — must be offered // to the IM first; a True return means the IM swallowed it (it // becomes pre-edit fuel / compose state) and the app must NOT // process it. Skipping this breaks every XIM on earth. if (XFilterEvent(&ev, 0) == True)
undefined identifier `XFilterEvent`
{ ++
(local variable) int filtered
filtered
;
if (ev.type ==
(enum value) app.KeyPress = 2
KeyPress
|| ev.type ==
(enum value) app.KeyRelease = 3
KeyRelease
)
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

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

emitf
("filtered", "type=%s keycode=%u",
ev.type ==
(enum value) app.KeyPress = 2
KeyPress
? "KeyPress".ptr : "KeyRelease".ptr,
ev.xkey.keycode); else
void instrument.emitf(scope const(char)* kind, scope const(char)* fmt, ...) nothrow @nogc

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

emitf
("filtered", "type=%d", ev.type);
continue; } switch (ev.type) { case KeyPress: ++keyEvents; char[256]
_error_ buf
buf
;
KeySym
_error_ sym
sym
= 0;
int
_error_ status
status
= XLookupNone,
_error_ n
n
= 0;
if (im.
im.ic
ic
!is null)
{ n = Xutf8LookupString(im.
im.ic
ic
, &ev.xkey, buf.
buf.ptr
ptr
,
cast(int) buf.
buf.length
length
- 1, &sym, &status);
} else // no IM at all: raw Latin-1 fallback path { n = XLookupString(&ev.xkey, buf.
buf.ptr
ptr
, cast(int) buf.
buf.length
length
- 1,
&sym, null); status = n > 0 ? XLookupBoth : XLookupKeySym; } buf[n] = '\0'; emitf("lookup", "via=%s status=%d sym=0x%lx len=%d text=%s", im.
im.ic
ic
!is null ? "Xutf8LookupString".
"Xutf8LookupString".ptr
ptr
: "XLookupString".
"XLookupString".ptr
ptr
,
status, sym, n, buf.
buf.ptr
ptr
);
if ((status == XLookupChars || status == XLookupBoth) && n > 0) { g_text.
g_text.insert
insert
(buf.
buf.ptr
ptr
, n);
++commits; emitf("commit", "text=%s line=%s caret=%d", buf.
buf.ptr
ptr
,
g_text.
g_text.str
str
(lineBuf), g_text.
g_text.caret
caret
);
updateSpot(); g_dirty = true; } if (status == XLookupKeySym || status == XLookupBoth) { const
_error_ old
old
= g_text.
g_text.caret
caret
;
if (sym == XK_BackSpace && g_text.
g_text.caret
caret
> 0)
g_text.
g_text.remove
remove
(--g_text.
g_text.caret
caret
, 1);
else if (sym == XK_Left && g_text.
g_text.caret
caret
> 0)
--g_text.
g_text.caret
caret
;
else if (sym == XK_Right && g_text.
g_text.caret
caret
< g_text.
g_text.count
count
)
++g_text.
g_text.caret
caret
;
else if (sym == XK_Return) { emitf("line_submitted", "text=%s", g_text.
g_text.str
str
(lineBuf));
g_text.
g_text.count
count
= 0;
g_text.
g_text.caret
caret
= 0;
} else if (sym == XK_Escape) break; // reaches us only when the IM didn't want it if (g_text.
g_text.caret
caret
!= old || sym == XK_BackSpace || sym == XK_Return)
{ emitf("caret", "cell=%d line=%s", g_text.
g_text.caret
caret
,
g_text.
g_text.str
str
(lineBuf));
updateSpot(); g_dirty = true; } } break; case KeyRelease: ++keyEvents; break; case MapNotify: // Bare Xvfb has no WM: self-focus so injected XTEST events // land here (same as the F06 demo). XSetInputFocus(dpy, win, RevertToParent, CurrentTime); XFlush(dpy); break; case FocusIn: focused = true; emit("focus state=in"); if (im.
im.ic
ic
!is null)
XSetICFocus(im.
im.ic
ic
);
break; case FocusOut: focused = false; emitf("focus", "state=out preedit_pending=%d", g_pre.
g_pre.count
count
);
if (im.
im.ic
ic
!is null)
XUnsetICFocus(im.
im.ic
ic
);
break; case Expose: if (ev.xexpose.
ev.xexpose.count
count
== 0)
g_dirty = true; break; case ClientMessage: if (cast(Atom) ev.xclient.data.l[0] == wmDelete) running = false; break; default: break; } } // IM lifecycle transitions signalled from the callbacks. if (
(__gshared global) bool app.g_imDestroyed
g_imDestroyed
)
{
(__gshared global) bool app.g_imDestroyed
g_imDestroyed
= false;
im = Im.init; // XIM/XIC are already freed by Xlib — just forget
(__gshared global) app.CellLine app.g_pre
g_pre
.
(field) int app.CellLine.count
count
= 0;
(__gshared global) app.CellLine app.g_pre
g_pre
.
(field) int app.CellLine.caret
caret
= 0;
(__gshared global) bool app.g_dirty
g_dirty
= true;
} if (
(__gshared global) bool app.g_imInstantiated
g_imInstantiated
)
{
(__gshared global) bool app.g_imInstantiated
g_imInstantiated
= false;
if (im.
(field) _error_ im.im
im
is null)
{
void instrument.emit(scope const(char)* kind) nothrow @nogc

Emit an event with no key=value payload.

emit
("step name=reopen_im (instantiate callback fired)");
im = openInputMethod(dpy, win, fs, spot); if (im.
(field) _error_ im.ic
ic
!is null)
{ if (im.
(field) _error_ im.filterMask
filterMask
!= 0)
XSelectInput(dpy, win, baseMask | im.
im.filterMask
filterMask
);
undefined identifier `XSelectInput`
if (
(local variable) bool focused
focused
)
XSetICFocus(im.
im.ic
ic
);
undefined identifier `XSetICFocus`
void app.main.updateSpot() nothrow @nogc @system
updateSpot
();
} } } if (
(__gshared global) bool app.g_dirty
g_dirty
&& img !is null)
{ draw(img); XPutImage(dpy, win, gc, img, 0, 0, 0, 0,
undefined identifier `XPutImage`
cast(uint) width, cast(uint) height); XFlush(dpy);
undefined identifier `XFlush`
(__gshared global) bool app.g_dirty
g_dirty
= false;
} if (
(local variable) const(bool) autoExit
autoExit
&&
long instrument.nowUs() nothrow @nogc

Microseconds elapsed since initInstrument.

nowUs
() > cast(long)
(local variable) const(int) durationMs
durationMs
* 1000)
{
void instrument.emit(scope const(char)* kind) nothrow @nogc

Emit an event with no key=value payload.

emit
("auto_exit");
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 ? 100 : -1);
undefined identifier `poll`
} char[64]
(local variable) char[64] nm
nm
;
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", "im=%d style=%s commits=%d filtered=%d key_events=%d "
~ "preedit_draws=%d line=%s", cast(int)(im.
(field) _error_ im.im
im
!is null),
im.
(field) _error_ im.im
im
!is null ?
const(char)* app.styleName(ulong s, return ref char[64] buf) nothrow @nogc
styleName
(im.
(field) _error_ im.style
style
,
(local variable) char[64] nm
nm
) : "(none)".ptr,
(local variable) int commits
commits
,
(local variable) int filtered
filtered
,
(local variable) int keyEvents
keyEvents
,
(__gshared global) int app.g_preeditDraws
g_preeditDraws
,
(__gshared global) app.CellLine app.g_text
g_text
.
const(char)* app.CellLine.str(return ref char[1024] buf) nothrow @nogc

NUL-terminated concatenation, for the log.

str
(
(local variable) char[1024] lineBuf
lineBuf
));
if (im.
(field) _error_ im.ic
ic
!is null)
XDestroyIC(im.
im.ic
ic
);
undefined identifier `XDestroyIC`
if (im.
(field) _error_ im.im
im
!is null)
XCloseIM(im.
im.im
im
);
undefined identifier `XCloseIM`
img.f.destroy_image(img); XDestroyWindow(dpy, win);
undefined identifier `XDestroyWindow`
XCloseDisplay(dpy);
undefined identifier `XCloseDisplay`
void instrument.emit(scope const(char)* kind) nothrow @nogc

Emit an event with no key=value payload.

emit
("teardown");
return 0; }