Hi,

I try to send a key event to a window with input fields, I use the code
example from http://www.codase.com/search/call?name=xsendevent and change
the InputFocus oft the window handle. But my code only works if the
destination window is the one with focus. It this possible?

 



xkp.type                = KeyPress;

xkp.xkey.type           = KeyPress;

xkp.xkey.display        = display;

xkp.xkey.serial         = 0L;

xkp.xkey.send_event     = True;

xkp.xkey.display        = display;

xkp.xkey.x = xkp.xkey.y = xkp.xkey.x_root = xkp.xkey.y_root = 0;

xkp.xkey.time           = get_time();

xkp.xkey.same_screen    = True;

xkp.xkey.subwindow      = None;

xkp.xkey.window         = twin;

xkp.xkey.root           = DefaultRootWindow(display);

xkp.xkey.keycode        = XKeysymToKeycode(display, keysym);


 


 

xkp.xkey.state          = (f_shift ? ShiftMask : 0) |

                       (f_control ? ControlMask : 0) |

                       (f_alt ? Mod1Mask : 0);

XSendEvent(display, twin, True, KeyPressMask, (XEvent *)&xkp);

xkp.xkey.type          = KeyRelease;

xkp.xkey.time          = get_time();

XSendEvent(display, twin, True, KeyReleaseMask, (XEvent *)&xkp);

 

_______________________________________________
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to