I'm writing a linux application using C++ and wxWidgets.
From my application, I need to send keyboard events to the window that currently has the focus (not belonging to my application!).
My questions are:
Thanks
Daniele
XGetInputFocus(3)
.Window
is the Xlib data type). Use whatever method of sending events works. There are two methods I know of: XSendEvent(3)
and XTestFakeKeyEvent(3)
. The former method does not work with some programs that chose to ignore events coming from XSendEvent
. The latter one requires the XTest
extension, which is present in most, but not all, modern servers.InputFocus
is a valid window designator for XSendEvent
, and XTestFakeKeyEvent
is delivered to the window that has the focus anyway, so you probably don't need to call XGetInputFocus
at all.