Re: GTK app with no keyboard/mouse



Am Mi, den 23.02.2005 schrieb Mike Rosenlof um 21:23:
Hello,

I'm starting design work on an application which will run on a system
with no keyboard or mouse.  I'm not an experienced GTK programmer, I'm
very experienced in embedded systems development FWIW.


This system will have a display, and a remote control device.  I'm
planning on a separate thread from the GUI which receives the remote
codes, interprets them, and injects appropriate events into the GUI.

Let's assume for the moment that the remote has just six buttons.  Menu,
up, down, left, right, select.  Any thoughts on the best way to inject
events?  So far I have found that a "move-focus" signal on the window
containing a bunch of button and slider widgets is not the answer (for
direction navigation).  Neither does gtk_window_propagate_key_event()
seem to be what I want.  I, of course, want to use the GTK
infrastructure instead of rolling my own.  Any suggestions?

According to some postings on this list, some people tried to synthesize
GDK events from their code and failed.

In my own GTK+1.2 application without mouse and with some keyboard-type
messages sending controller board I use the XTest-extension of X11 and
I'm satisfied with that.

For doing so it is enough to call "XTestFakeKeyEvent" two times (once
for each up and down event) with the parameters set at your will. This
is connected by using "gdk_input_add" right after initializing gtk.

This way the app will not notice any difference between a real keyboard
and this events. The only thing getting somewhat complicated is using
accelerator keys, but it is possible.

HTH,
Marc





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