Index: [thread] [date] [subject] [author]
  From: Marcus Sundberg <mackan@stacken.kth.se>
  To  : ggi-develop@eskimo.com
  Date: Sun, 02 May 1999 16:31:03 +0200

Re: heavy bug in LIBGII (?)

Denis Oliver Kropp wrote:
> 
> Hello,
> 
> we are working on a GGI impl. for ClanLib.

Oh, that's good to hear.

> We have some trouble with the event handling of LIBGII.
> 
> Every time we press a key, we get two events, one press and one release event,
> even if we dont release the key. The libgii demo proves this behaviour.

This is expected behaviour with the LibGII demo. The LibGII demo opens
the input-stdin inputlib for input. As the name suggests it reads
input from the standard input stream.

There is currently _NO_ way to know when a key is pressed or released
with this inputlib, simple because the standard input is simply a
stream of ascii characters. The best thing we can do here is generate
one press and and one immediately following release event for each
character so at least applications that only reads press and repeat
events can work.

This is however not a problem for you, because you should not use
input-stdin. Infact you should not explicitly open any inputlibs
at all, as I suspect you intend to use LibGGI for graphics output.

If you use LibGGI for graphics it will automaticly open suitable inputs
for you and associate them with each visual that is opened. You then
use the ggiEvent* functions instead of the giiEvent* functions to
read events. Users can also specify extra inputs to be associated
with visuals, using the GGI_INPUT environment variable.

Lastly, if you really want to use LibGII for input without using
LibGGI for output (Which I would actually recommend you to do, as
you can use LibGII for input with your native X11, SVGAlib and
FBDev display drivers. The advantage of that is that you get a
single API to program against, which supports virtually all
available features. For example - for in-game controls you are
probably just interrested in what physical keys are pressed and
released, so you use the "label" field of events. On the other
hand - when the user should enter a text string (like his name in
the hiscore table), you can just use the "sym" field and you get
support for upper/lower case, international keys and dead keys
without having to deal with those things in your own code.)

You should use input-linux-kbd for keyboard input on the console,
input-linux-mouse for mouse input on the console, input-xwin for
key and mouse input from an already opened X-window, and input-x
for generic key and mouse input from X (like when using Glide for
output). Note that input-xwin needs to be passed a structure with
some info, see ggi/input/xwin.h for that struct.

I should also recommend to have a look at LibGIC which gets events
from a gii_input_t handle a will automaticly handle all possible input
types in a way transparent to the application. It is however still
in pre-alpha stage.

//Marcus
-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: mackan@stacken.kth.se

Index: [thread] [date] [subject] [author]