Web lists-archives.com

Re: XTestFakeKeyEvent GDK-equivalent

On Fri, 6 Jul 2018, Anarchean wrote:

On 5 July 2018 10:32 PM, Allin Cottrell <cottrell@xxxxxxx> wrote:
The context is a little different, but the attached function works,
given pointers to an existing GtkWidget and GdkEvent.

I tried your code out. It works OK, but its limited to emitting events to a GTK managed window and what I really wanted was to insert events into the X11/Wayland Display server, so that any application which has the focus could receive the events.

Maybe that is not possible within GTK and I need to access lower-level libraries like X/Wayland?

Yes, I expect so. It occurred to me after posting my variant code that it would not do what you wanted, if you're looking to send keystrokes to some arbitrary target outside of your GTK application. It seems pretty clear that if you want to send to an arbitrary X11 (or Wayland) window you'd need an API that gives you an ID for that window, at least.

Allin Cottrell
Department of Economics
Wake Forest University
gtk-list mailing list