inject.dhover×91 error×26all
// Virtual-pointer injector mode for the F16 demo:
//
//     f16_clipboard_dnd inject click <x> <y> <btn>      one click (btn is the
//                                                       evdev code: 272 left,
//                                                       273 right)
//     f16_clipboard_dnd inject drag  <x1> <y1> <x2> <y2>
//
// `drag` plugs ONE `zwlr_virtual_pointer_v1` device in, presses BTN_LEFT at
// (x1,y1) and HOLDS it through an 8-step motion_absolute sweep to (x2,y2)
// before releasing — wl_data_device.start_drag is only valid against the
// serial of an implicit (button-down) grab, so the press, the demo's
// start_drag, the sweep and the drop all have to live inside one device
// session. Coordinates are global against ./run.sh's 1280x720 sway layout
// (window A at (0,120), window B at (640,120), both 640x480).
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;
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.btn(uint button, uint state) nothrow @nogc
btn
(uint
(parameter) uint button
button
, uint
(parameter) uint state
state
) nothrow @nogc
{ wsi_vptr_button(gi_ptr, 0, button, state);
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.devicePlug()
devicePlug
() // returns 0 on success
{ 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 1; } 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 1; } 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 (re)creates its wl_pointer
return 0; } void
void inject.deviceUnplug()
deviceUnplug
()
{ wsi_vptr_destroy(gi_ptr);
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
int inject.injectClick(int x, int y, int button)
injectClick
(int
(parameter) int x
x
, int
(parameter) int y
y
, int
(parameter) int button
button
)
{ if (
int inject.devicePlug()
devicePlug
() != 0)
return 0;
void inject.absMove(uint x, uint y) nothrow @nogc
absMove
(
(parameter) int x
x
,
(parameter) int y
y
);
void inject.pause(uint ms) nothrow @nogc
pause
(250);
void inject.btn(uint button, uint state) nothrow @nogc
btn
(
(parameter) int button
button
, 1);
void inject.pause(uint ms) nothrow @nogc
pause
(100);
void inject.btn(uint button, uint state) nothrow @nogc
btn
(
(parameter) int button
button
, 0);
void inject.pause(uint ms) nothrow @nogc
pause
(400);
void inject.deviceUnplug()
deviceUnplug
();
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: click done x=%d y=%d btn=0x%x\n",
(parameter) int x
x
,
(parameter) int y
y
,
(parameter) int button
button
);
return 0; } int
int inject.injectDrag(int x1, int y1, int x2, int y2)
injectDrag
(int
(parameter) int x1
x1
, int
(parameter) int y1
y1
, int
(parameter) int x2
x2
, int
(parameter) int y2
y2
)
{ if (
int inject.devicePlug()
devicePlug
() != 0)
return 0;
void inject.absMove(uint x, uint y) nothrow @nogc
absMove
(
(parameter) int x1
x1
,
(parameter) int y1
y1
);
void inject.pause(uint ms) nothrow @nogc
pause
(300);
void inject.btn(uint button, uint state) nothrow @nogc
btn
(
(constant) uint inject.BTN_LEFT = 272u
BTN_LEFT
, 1); // implicit grab — the demo's start_drag serial
void inject.pause(uint ms) nothrow @nogc
pause
(400); // the demo calls start_drag inside this hold
foreach (
(local variable) int i
i
; 1 .. 9)
{
void inject.absMove(uint x, uint y) nothrow @nogc
absMove
(
(parameter) int x1
x1
+ (
(parameter) int x2
x2
-
(parameter) int x1
x1
) *
(local variable) int i
i
/ 8,
(parameter) int y1
y1
+ (
(parameter) int y2
y2
-
(parameter) int y1
y1
) *
(local variable) int i
i
/ 8);
void inject.pause(uint ms) nothrow @nogc
pause
(90);
}
void inject.pause(uint ms) nothrow @nogc
pause
(300);
void inject.btn(uint button, uint state) nothrow @nogc
btn
(
(constant) uint inject.BTN_LEFT = 272u
BTN_LEFT
, 0); // drop
void inject.pause(uint ms) nothrow @nogc
pause
(800); // receive pipe + finish round-trips
void inject.deviceUnplug()
deviceUnplug
();
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: drag done %d,%d -> %d,%d\n",
(parameter) int x1
x1
,
(parameter) int y1
y1
,
(parameter) int x2
x2
,
(parameter) int y2
y2
);
return 0; }