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

H. Dieter Wilhelm dieter at duenenhof-wilhelm.de
Sun Sep 7 02:40:29 PDT 2014

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!
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany

More information about the Xcb mailing list