[Xcb] Implementing XTestFakeMotionEvent

Charlls Quarra charlls_quarra at yahoo.com.ar
Thu Apr 30 23:18:32 PDT 2009


i want to implement XTestFakeMotionEvent and XTestFakeKeyEvent -like functionality on top of xcb

looking at XTestFakeMotionEvent source in libXtst for instance, is something roughly like this;

XTestFakeMotionEvent( Display* dpy, int screen ,int x, int y, ulong delay)

XExtDisplayInfo info = find_display..
XextCheckExtension(dpy, info , 0 )
xXTestFakeInputReq *req;
GetReq(XtestFakeInput, req);
req->reqType = info->codes->major_opcode;
req->xtReqType = X_XTestFakeInput;
req->type = MotionNotify;
req->detail = False;
if (screen == -1)
 req->root = None;
 req->root = RootWindow(dpy, screen );
req->rootX = x;
req->rootY = y;
req->time = delay;
return 1;

if i had to unravel this code in something that translated into xcb, i wouldn't know where to start. I certainly could dig on each call, understand what each does, and THEN go into xcb, do the same thing, and then do some pattern matching in my (probably tired by then) mind and attempt a translation.

Certainly there HAS to be a more direct way to port apis without having to delve in each one's implementations. How is generally coped with this complexity?

on a side note, from this code only can infer a few oddities about the implementation; req seems to be allocated in GetReq but somehow deallocated (or responsability moved) in SyncHandle or UnlockDisplay, but somehow req is not being passed so one can only guess the req pointer is being stored behind the scenes.. in any case, scary code to understand

      Yahoo! Cocina
Recetas prácticas y comida saludable

More information about the Xcb mailing list