Simluating Keypresses



Hello,

I'm very new to Gtk so please forgive me if this is an obvious question,
i've done a lot of digging and can't find an answer. What i've got is a Gtk
front end with other control threads running which process commands from
other ports. I need to simulate key presses on the window from these other
threads. For example a "move left" command on the serial port is received by
my serial routine and sent to the Gtk main thread, that moves the focus
left, one button, on the main window.

What i've tried so far is:

GdkEvent* manual_event;

manual_event->type = GDK_KEY_PRESS;
((GdkEventKey*)manual_event)->keyval = GDK_Tab;
((GdkEventKey*)manual_event)->send_event = TRUE;    // Which i read shows
that the event was synthesized by the application and not X windows.

gtk_widget_event (window, manual_event);

Which compiles fine, but seg faults. Is it something i'm not setting up
properly?
Could anyone point me in the right direction? I can't find any examples of
anyone else doing this - am i going about it completely the wrong way?

Thanks
Andrew




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]