[Xcb] Advisable in this situation to swap Xlib with Xcb?

Christian Linhart chris at DemoRecorder.com
Sun Sep 7 03:07:37 PDT 2014

Hello Dieter,

XCB will not give you any different functionality than Xlib.
XCB is just another mechanism to access the functionality 
that is provided by the XServer via the X-protocol.

If you want to emulate user-input to X-Applications you could use 
xdotool which is a commandline application for that purpose,
to be used from shellscripts.
or libxdo which is the underlying library of xdotool.

I didn't use xdotool myself but the description looks good:

If xdotool is not suitable, you may also look at the XTest extension.

In any case you cannot send keyboard-input to applications other than emulating
key-presses. xdotool makes this just more convenient.

There is an exception: If an application has an extra API for doing that... 
Maybe tcl/tk offers something in that direction. Since your receiving
app seems to use tcl/tk, you might want to look at the tcl/tk docs,
or ask in a tcl/tk forum.

Hope this helps,


On 09/07/14 11:40, H. Dieter Wilhelm wrote:
> Hello List,
> my aim is to send script snippets (i. e. ASCII text from the Emacs
> editor) to another input window (of an interpreter application called
> ANSYS Classics in an tcl/tk window frame).  I'm a beginner of X
> programming and my naive solution is to store text in Emacs into the
> clipboard and using xlib calls to send the interpreter window the
> "ctrl+v" key-combo.
> Though working in principle, it is not very practical, mainly from the
> fact, that I have to send an additional "Return" key so that the Ansys
> interpreter is finally digesting its input.  Unfortunately I couldn't
> yet solve this with one xlib program: One program has to send the
> "Ctrl+v" combination, then Emacs must wait some 150 milli seconds,
> otherwise the "Return" key is arriving before the clipboard content
> before calling my other executable for sending the "Return" key!  This
> is causing an annoying interruption and flickering, since both
> executables have to give the other window temporarily the input focus.
> 1) Do you think it would be better here to switch to XCB, would it be
> possible with XCB to receive a notification when the clipboard content
> has been pasted and thus being able to do it in one executable?
> 2) Or do you know a more elegant way of sending data to an input window
> without using simulated key-presses?  Would you do it in a totally
> different way?
> I'm totally stuck, googling since 2 weeks, enquired the Xlib and Emacs
> mailing lists -- in vain, could you please give me a hint?  Thanks for
> your help!

More information about the Xcb mailing list