[Xcb] Implementing XTestFakeMotionEvent

Ian Osgood iano at quirkster.com
Fri May 1 06:54:13 PDT 2009


XTest is one of the few extensions that has sample XCB code in the  
xcb/demo repository. You might check there for ideas as well.

Ian

On Apr 30, 2009, at 11:18 PM, Charlls Quarra wrote:

>
>
> Hi,
>
> 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;
> LockDisplay(dpy);
> 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;
> else
>  req->root = RootWindow(dpy, screen );
> req->rootX = x;
> req->rootY = y;
> req->time = delay;
> UnlockDisplay(dpy);
> SyncHandle();
> 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
> http://ar.mujer.yahoo.com/cocina/
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb




More information about the Xcb mailing list