inject.dhover×69 error×30all
// Virtual-pointer injector mode for the F15 demo:
//
//     f15_popup inject <menu|edge>
//
// Plugs ONE `zwlr_virtual_pointer_v1` device in and scripts a whole popup
// scenario inside that single device session (motion_absolute against the
// 1280x720 headless output). A per-gesture plug/unplug (the wlrctl model)
// would flap the seat's pointer capability mid-grab — whether THAT dismisses
// a grab popup must stay a deliberate measurement, not an accident of the
// test driver. Coordinates are baked against ./run.sh's sway layout:
//
//   menu  window wsi-f15-popup floats at (320,120) 640x480. Right-click at
//         global (500,300) = surface (180,180) opens the menu; after the
//         demo's reposition probe (+24,+16 offset) the popup's expected
//         global origin is (525,317) — the hover/click coordinates target
//         the REPOSITIONED items; a final click at (150,650) lands outside
//         the window (compositor-side dismissal → popup_done chain).
//   edge  window wsi-f15-edge floats at (632,232); right-click at global
//         (1232,682) = surface (600,450) — the 160x96 popup cannot fit
//         down-right (output is 1280x720), the compositor must constrain.
//         The device is then HELD ~4 s while ./run.sh delivers Esc via a
//         wtype virtual keyboard.
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`?
__gshared wl_display*
_error_ inject.gi_dpy
gi_dpy
;
undefined identifier `wl_display`
__gshared wl_proxy*
_error_ inject.gi_ptr
gi_ptr
;
undefined identifier `wl_proxy`
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`
enum uint
(constant) uint inject.BTN_LEFT = 272u
BTN_LEFT
= 0x110,
(constant) uint inject.BTN_RIGHT = 273u
BTN_RIGHT
= 0x111;
void
void inject.absMove(uint x, uint y) nothrow @nogc
absMove
(uint
(parameter) uint x
x
, uint
(parameter) uint y
y
) nothrow @nogc
{ wsi_vptr_motion_absolute(gi_ptr, 0, x, y, 1280, 720);
undefined identifier `wsi_vptr_motion_absolute`
wsi_vptr_frame(gi_ptr);
undefined identifier `wsi_vptr_frame`
wl_display_flush(gi_dpy);
undefined identifier `wl_display_flush`
} void
void inject.click(uint button, uint holdMs = 80u) nothrow @nogc
click
(uint
(parameter) uint button
button
, uint
(parameter) uint holdMs
holdMs
= 80) nothrow @nogc
{ wsi_vptr_button(gi_ptr, 0, button, 1);
undefined identifier `wsi_vptr_button`
wsi_vptr_frame(gi_ptr);
undefined identifier `wsi_vptr_frame`
wl_display_flush(gi_dpy);
undefined identifier `wl_display_flush`
usleep(holdMs * 1000);
undefined identifier `usleep`
wsi_vptr_button(gi_ptr, 0, button, 0);
undefined identifier `wsi_vptr_button`
wsi_vptr_frame(gi_ptr);
undefined identifier `wsi_vptr_frame`
wl_display_flush(gi_dpy);
undefined identifier `wl_display_flush`
} void
void inject.pause(uint ms) nothrow @nogc
pause
(uint
(parameter) uint ms
ms
) nothrow @nogc
{ usleep(ms * 1000);
undefined identifier `usleep`
} int
int inject.injectMain(const(char)[] scenario)
injectMain
(const(char)[]
(parameter) const(char)[] scenario
scenario
)
{ gi_dpy = wl_display_connect(null); if (gi_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(gi_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(gi_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(gi_dpy);
undefined identifier `wl_display_disconnect`
return 0; } gi_ptr = wsi_vpm_create_virtual_pointer(gi_mgr, gi_seat); wl_display_roundtrip(gi_dpy); // device plugged → seat gains the capability
undefined identifier `wl_display_roundtrip`
void inject.pause(uint ms) nothrow @nogc
pause
(400); // demo creates its wl_pointer
if (
(parameter) const(char)[] scenario
scenario
.
(field) ulong const(char)[].length
length
>= 4 &&
(parameter) const(char)[] scenario
scenario
[0 .. 4] == "edge")
{
void inject.absMove(uint x, uint y) nothrow @nogc
absMove
(1232, 682); // inside wsi-f15-edge, near the output corner
void inject.pause(uint ms) nothrow @nogc
pause
(400);
void inject.click(uint button, uint holdMs = 80u) nothrow @nogc
click
(
(constant) uint inject.BTN_RIGHT = 273u
BTN_RIGHT
); // → constrained popup + grab
void inject.pause(uint ms) nothrow @nogc
pause
(4000); // hold the device while run.sh sends Esc via wtype
} else // menu {
void inject.absMove(uint x, uint y) nothrow @nogc
absMove
(500, 300); // inside wsi-f15-popup
void inject.pause(uint ms) nothrow @nogc
pause
(400);
void inject.click(uint button, uint holdMs = 80u) nothrow @nogc
click
(
(constant) uint inject.BTN_RIGHT = 273u
BTN_RIGHT
); // → popup1 + grab(press serial)
void inject.pause(uint ms) nothrow @nogc
pause
(1700); // popup maps; demo fires the reposition probe (+24,+16)
void inject.absMove(uint x, uint y) nothrow @nogc
absMove
(595, 336); // hover item 0 (repositioned popup)
void inject.pause(uint ms) nothrow @nogc
pause
(250);
void inject.absMove(uint x, uint y) nothrow @nogc
absMove
(595, 364); // hover item 1
void inject.pause(uint ms) nothrow @nogc
pause
(250);
void inject.absMove(uint x, uint y) nothrow @nogc
absMove
(595, 392); // hover item 2 ("submenu >")
void inject.pause(uint ms) nothrow @nogc
pause
(300);
void inject.click(uint button, uint holdMs = 80u) nothrow @nogc
click
(
(constant) uint inject.BTN_LEFT = 272u
BTN_LEFT
); // → popup2 (nested, grabbed) parented on popup1
void inject.pause(uint ms) nothrow @nogc
pause
(800);
void inject.absMove(uint x, uint y) nothrow @nogc
absMove
(150, 650); // outside the window entirely
void inject.pause(uint ms) nothrow @nogc
pause
(300);
void inject.click(uint button, uint holdMs = 80u) nothrow @nogc
click
(
(constant) uint inject.BTN_LEFT = 272u
BTN_LEFT
); // → compositor dismisses: popup_done chain
void inject.pause(uint ms) nothrow @nogc
pause
(600);
} wsi_vptr_destroy(gi_ptr); // device unplugged → capability drop
undefined identifier `wsi_vptr_destroy`
wsi_vpm_destroy(gi_mgr);
undefined identifier `wsi_vpm_destroy`
wl_display_roundtrip(gi_dpy);
undefined identifier `wl_display_roundtrip`
wl_display_disconnect(gi_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 scenario=%.*s\n", cast(int)
(parameter) const(char)[] scenario
scenario
.
(field) ulong const(char)[].length
length
,
(parameter) const(char)[] scenario
scenario
.
(field) const(char)* const(char)[].ptr
ptr
);
return 0; }