lirc as an input device?



I am developing an application using gtk+ 2.0 on a headless machine.
Well in actuallity it has a TV as it's output device.  However it does
not have a keyboard or (will not have a) mouse.  It does have an IR
controller via LIRC (www.lirc.org) though.

I have written my application so far to use g_io_add_watch() to get
input events from the IR (via LIRC).  However this does not scale very
well in the way I have written it because in my input handler (the one
registered with g_io_add_watch()) I read the key pressed from LIRC and
then have to do something different depending on what is happening in
the app when the key is pressed.  This worked fine when my app was a
single CLIST (inside containers etc.), but now it is expanding to
multiple different widgets that will be shown at different times.

Keeping track of what widget is active and the different ways to map
IR input dependign on the widget is just getting hairy.

I am looking for suggestions on a better way to handle this.  Is it
appropriate to write a gdk input module for LIRC?  Is it more
appropriate (or even more simple) to write a generic routine in my
application (that I would register with g_io_add_watch()) that maps
keys on my IR (fortunately it has navigation type keys like up, down,
left, right, select, etc.) to generic gtk/gdk input events?  For
instance, if LIRC reports that the "right" key was pressed, generate a
"right arrow" key event for whatever widget is active, just as if I
used the right arrow key on a keyboard.

The question then becomes, being a newbie at gtk/gdk programming, how
would I go about turning LIRC input events into gtk/gdk generic
events, simulating the keyboard's input events?

Any pointers much appreciated.  Thanx,
b.

-- 
Brian J. Murrell

Attachment: pgpyXLctbaXEX.pgp
Description: PGP signature



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