I am trying to perform the following exercize the following in X event
handling:
I have an xterm window open with id = 0x300000d
Now I want to write a piece of code that simulates the keyboard by sending
keys to this xterm. The effect I am hoping is that characters will appear
in the xterm window.
Here's the jist of my code:
-----------
{
/* I have display and window available at this point */
long emask=(KeyPressMask|KeyReleaseMask);
XSelectInput (display, window, emask);
{
XKeyPressedEvent evnt;
evnt.serial = 0;
evnt.send_event = 1;
evnt.display = display;
evnt.window = window;
evnt.root = 0x25;
evnt.subwindow = 0;
evnt.time = CURRENT_TIME;
evnt.x = 0;
evnt.y = 0;
evnt.x_root = 0;
evnt.y_root = 0;
evnt.state = 0;
evnt.keycode = 40; /* I am typing an A */
evnt.same_screen = 1;
evnt.type = KeyPress;
status = XSendEvent(display, window, (Bool)1, emask, (XEvent *)&evnt);
evnt.type = KeyRelease;
status = XSendEvent(display, window, (Bool)1, emask, (XEvent *)&evnt);
}
I would appreciate hints on how to debug this problem. I basically don't getQuote:}
anythinig in my Xterm window.
Please email back if you can.
Thanks.
Si