[Xcb] An xcb/xtest newbie question

Josh Triplett josh at joshtriplett.org
Mon Oct 11 12:22:25 PDT 2010


On Mon, Oct 11, 2010 at 01:03:22PM -0500, Jon Shemitz wrote:
> I am trying to use xtest to fake keyboard and mouse events. My daemon seems to connect to X via xcb just fine:  xcb_connect(NULL, NULL) returns a non-NULL xcb_window_t. I can call xcb_get_setup and xcb_setup_roots_iterator and get a root window handle that agrees with xwininfo. But I am having no luck at all with xcb_test_fake_input.
> 
> I call
> 
>     xcb_void_cookie_t cookie =
>     xcb_test_fake_input(xcb,
>         /* type */      MOTION_NOTIFY, /*=6*/
>         /* detail */    0, //relative ? 1 : 0,
>         /* time */      0,//time(NULL),
>         /* root */      xcb_root_window,
>         /* rootX */     x,
>         /* rootY */     y,
>         /* deviceid */  0);
> 
> ... and nothing happens.
> 
> The same thing happens when I try to fake key input:
> 
>     xcb_test_fake_input(xcb,
>                         /* type */      press
> ? KEY_PRESS /*3*/ : KEY_RELEASE /*4*/,
>                         /* detail */    keycode,
>                         /* time */      0,
>                         /* root */      0,
>                         /* rootX */     0,
>                         /* rootY */     0,
>                         /* deviceid */  0);
> 
> I imagine there's a key concept or two that I am missing here - any help would be appreciated.

If you haven't blocked on anything in XCB, then XCB may never have
flushed the request from its buffers; you might need to call xcb_flush
explicitly.

- Josh Triplett


More information about the Xcb mailing list