resend key event in Linux

Milan Babuskov milanb at panonnet.net
Thu May 3 07:22:44 PDT 2007


Vadim Zeitlin wrote:
> AM> > Andreas Micheler wrote:
> AM> >> I'd like to use the wx event system rather than SendMessage,
> AM> >> but it doesn't seem to work.
> AM> >> What's the Linux equivalent to SendMessage?
> AM> > 
> AM> > It doesn't exist. You cannot just send a newly constructed
> AM> > key event back to the control under Linux (GTK+),
> 
>  You can use EmulateKeyPress() method of wxTextCtrl. For the other controls
> there is no way to do what you want.

At least, not with wxWidgets. However, you could use Xlib and make it 
send a key to the focused window. It would go something like this:

Use XOpenDisplay to get connection to display, then use XGetInputFocus 
to find the focused window (which is probably some Gtk control), and 
setup XKeyEvent structure and send it with XSendEvent.



-- 
Milan Babuskov
http://www.guacosoft.com
http://www.flamerobin.org





More information about the wx-users mailing list