inject.dhover×40 error×28all
// Virtual-pointer injector mode for the F11 demo:
//
//     f11_scroll inject <hold_ms> <steps> <a> <b> <interval_ms> [wheel]
//
// Plugs a `zwlr_virtual_pointer_v1` device in (which is what makes a headless
// wlroots seat gain the pointer capability — the F12 lesson) and keeps it
// alive for `hold_ms` after the steps complete. Two uses here:
//
//   - steps=0: a pure capability HOLD. While the held device is up, the seat
//     keeps its pointer capability, the demo's wl_pointer survives, and the
//     transient `wlrctl pointer scroll` bursts land on a live resource.
//   - mode `wheel`: per step send axis_source(wheel) + axis_discrete(axis=
//     vertical, value=a×15, discrete=a) + frame — a notched-wheel click.
//     wlroots converts the discrete count to wl_pointer.axis_value120
//     (discrete × 120) for v8+ clients, which is the only way to exercise
//     the v120/detent path on a headless host (wlrctl never sends discrete).
//     The 15-units-per-detent value follows the libinput wheel convention.
//
// Without a mode argument, streams `steps` relative motions of (a, b) every
// `interval_ms` (unused by ./run.sh; kept aligned with the F10 injector).
module 
(module) inject
inject
;
import c; // ImportC shim — wsi_vpm_* / wsi_vptr_* are hand-marshalled (see ./c.c)
unable to read module `c` Expected 'c.d' or 'c/package.d' in one of the following import paths:
unable to read module `c` Expected 'c.d' or 'c/package.d' in one of the following import paths:
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) inject.fprintf = int core.stdc.stdio.fprintf(shared(core.stdc.stdio._IO_FILE)* stream, scope const(char*) format, scope const ...) nothrow @nogc
fprintf
,
(alias) inject.printf = int core.stdc.stdio.printf(scope const(char*) format, scope const ...) nothrow @nogc
printf
,
(alias shared global) inject.stderr = shared(core.stdc.stdio._IO_FILE*) core.stdc.stdio.stderr
stderr
;
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) inject.strcmp = int core.stdc.string.strcmp(scope const(char*) s1, scope const(char*) s2) pure nothrow @nogc
strcmp
;
__gshared wl_proxy*
_error_ inject.gi_mgr
gi_mgr
;
undefined identifier `wl_proxy`
__gshared wl_seat*
_error_ inject.gi_seat
gi_seat
;
undefined identifier `wl_seat`, did you mean variable `gi_seat`?
extern (C) void
inject.injGlobal
injGlobal
(void* data, wl_registry*
(parameter) wl_registry* reg
reg
, uint name,
undefined identifier `wl_registry`
const(char)* iface, uint ver) nothrow @nogc { if (strcmp(iface, "zwlr_virtual_pointer_manager_v1") == 0) gi_mgr = cast(wl_proxy*) wsi_registry_bind(reg, name, &wsi_virtual_pointer_manager_interface, 1); else if (strcmp(iface, wl_seat_interface.name) == 0 && gi_seat is null) gi_seat = cast(wl_seat*) wsi_registry_bind(reg, name, &wl_seat_interface, 1); } extern (C) void
inject.injGlobalRemove
injGlobalRemove
(void* data, wl_registry*
(parameter) wl_registry* reg
reg
, uint name) nothrow @nogc {}
undefined identifier `wl_registry`
__gshared wl_registry_listener
_error_ inject.gi_registryListener
gi_registryListener
= {&injGlobal, &injGlobalRemove};
undefined identifier `wl_registry_listener`
int
int inject.injectMain(int holdMs, int steps, int dx, int dy, int intervalMs, bool wheel)
injectMain
(int
(parameter) int holdMs
holdMs
, int
(parameter) int steps
steps
, int
(parameter) int dx
dx
, int
(parameter) int dy
dy
, int
(parameter) int intervalMs
intervalMs
, bool
(parameter) bool wheel
wheel
)
{ wl_display*
(local variable) _error_ dpy
dpy
= wl_display_connect(null);
undefined identifier `wl_display`
undefined identifier `wl_display_connect`
if (dpy is null) {
int core.stdc.stdio.printf(scope const(char*) format, scope const ...) nothrow @nogc
printf
("SKIP: inject: no Wayland compositor\n");
return 0; } wl_registry*
(local variable) _error_ reg
reg
= wsi_display_get_registry(dpy);
undefined identifier `wl_registry`
undefined identifier `wsi_display_get_registry`
wsi_registry_add_listener(reg, &gi_registryListener, null);
undefined identifier `wsi_registry_add_listener`
wl_display_roundtrip(dpy);
undefined identifier `wl_display_roundtrip`
if (gi_mgr is null) {
int core.stdc.stdio.printf(scope const(char*) format, scope const ...) nothrow @nogc
printf
("SKIP: inject: no zwlr_virtual_pointer_manager_v1\n");
wl_display_disconnect(dpy);
undefined identifier `wl_display_disconnect`
return 0; } wl_proxy*
(local variable) _error_ ptr
ptr
= wsi_vpm_create_virtual_pointer(gi_mgr, gi_seat);
undefined identifier `wl_proxy`
undefined identifier `wsi_vpm_create_virtual_pointer`
wl_display_roundtrip(dpy); // device plugged → seat gains the pointer capability
undefined identifier `wl_display_roundtrip`
foreach (
(local variable) int i
i
; 0 ..
(parameter) int steps
steps
)
{ if (
(parameter) bool wheel
wheel
)
{ // One notched-wheel click of `dx` detents: 15 axis units per // detent (the libinput convention); wlroots turns `discrete` // into wl_pointer.axis_value120 = discrete × 120 for v8+ binds. wsi_vptr_axis_source(ptr, 0 /* wheel */);
undefined identifier `wsi_vptr_axis_source`
wsi_vptr_axis_discrete(ptr, 0, 0 /* vertical */, dx * 15 * 256, dx);
undefined identifier `wsi_vptr_axis_discrete`
} else wsi_vptr_motion(ptr, 0, dx * 256, dy * 256);
undefined identifier `wsi_vptr_motion`
wsi_vptr_frame(ptr);
undefined identifier `wsi_vptr_frame`
wl_display_flush(dpy);
undefined identifier `wl_display_flush`
usleep(intervalMs * 1000);
undefined identifier `usleep`
} usleep(holdMs * 1000);
undefined identifier `usleep`
wsi_vptr_destroy(ptr); // device unplugged → capability drop on the seat
undefined identifier `wsi_vptr_destroy`
wsi_vpm_destroy(gi_mgr);
undefined identifier `wsi_vpm_destroy`
wl_display_roundtrip(dpy);
undefined identifier `wl_display_roundtrip`
wl_display_disconnect(dpy);
undefined identifier `wl_display_disconnect`
int core.stdc.stdio.fprintf(shared(core.stdc.stdio._IO_FILE)* stream, scope const(char*) format, scope const ...) nothrow @nogc
fprintf
(
(shared global) shared(core.stdc.stdio._IO_FILE*) core.stdc.stdio.stderr
stderr
, "inject: done steps=%d delta=%d,%d interval_ms=%d hold_ms=%d\n",
(parameter) int steps
steps
,
(parameter) int dx
dx
,
(parameter) int dy
dy
,
(parameter) int intervalMs
intervalMs
,
(parameter) int holdMs
holdMs
);
return 0; }