Re: Simulation of key presses and skins/engines



On Tue, 2007-05-15 at 18:24 +0200, Joaquim Duran wrote:
> En/na Murray Cumming ha escrit:
> > On Tue, 2007-05-15 at 17:36 +0200, Joaquim Duran wrote:
> >> Dear all,
> >>
> >> I've two questions about gtk/gtkmm:
> >>
> >> 1 - In the application that we've developing, we use a customized keypad
> >> for used input. We haven't any kernel drive, so we have developed
> >> functions to read the key presses from user space. I would like to know
> >> if it is possible to generate key-pressed events in GTKmm, as if they
> >> have been received from X server.
> > 
> > Maybe you could mention more about how this keypad should look or
> > behave. I suspect that you really need a custom "GTK+ Input Method".
> > 
> > If it's a multi-press keypad then you might just be able to use the
> > multipress input method that I mention here:
> > http://www.murrayc.com/blog/permalink/2006/12/22/creating-gtk-input-methods/
> 
> The keyboard it is a capacitive keyboard consisting of 20 keys. I've
> adapted a very simple SPI driver to access to him,

Sorry, this doesn't mean much to me.
>  but the driver
> (management commands, et al ) are implemented in user space.

That does seem strange, but I'm not sure what you mean by "management
commands".

>  The access
> to keymap is doing polling (so threads of timers in input method should
> be used).
> 
> The keyboard is a multikey and the client is interested in use short key
> press and long key presses.

So, I think you really do need a custom input method. Otherwise you have
these problems:
- No visual indication that you are in compose mode.
- No ability for GTK+ widgets to respond to only actual characters
rather than all the intermediate key presses.
- You need to implement keyboard entry in every application.  

> The keymap returns a bitmap with the keys pressed, from here I create a
> vector<uint8_t> with the key pressed ordered. I was thinking to create a
> map of pair<vector of keys, pressed_time> to 'X11 key code'.

This is much like what we have in the multipress method that I
mentioned. I strongly suggest that you take a look. It doesn't yet
distinguish between short key press and long key press, but it could.

This multipress input method is already in the svn trunk version of GTK
+, as well as being available as a standalone tarball for older versions
of GTK+. It would be nice to make useful improvements to it.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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