Index: [thread] [date] [subject] [author]
  From: Andrew Apted <ajapted@netspace.net.au>
  To  : ggi-develop@eskimo.com
  Date: Mon, 17 Aug 1998 20:09:35 +1000

Re: keyboard.h changes

In keyboard.h :

>  #define GGI_KEY_CAPSLOCK        GGI_KEY_STICKY_SHIFT

This is surely wrong.  Capslock is not a sticky shift -- if it were,
then pressing '12345' with capslock on would give '!@#$%'.

What I had planned was making capslock & numlock into modifiers (which
is what they really are), as follows :

    #define GGI_KM_CAPS   0x08
    #define GGI_KM_NUM    0x09

and thus 

    #defube GGI_KEY_CAPSLOCK    GGI_KEY_STICKY_CAPS
    #defube GGI_KEY_NUMLOCK     GGI_KEY_STICKY_NUM

----

Another thing is the left/right versions of the modifier keys.  This is
what I had in mind :

     #define GGI_KM_SHIFT    0
     #define GGI_KM_ALT      1
     #define GGI_KM_CTRL     2
     #define GGI_KM_TOP      3      [note 1]
     #define GGI_KM_SUPER    4
     #define GGI_KM_HYPER    5

     #define GGI_KM_MASK     0x07

-->  #define GGI_KM_RIGHT    0x08    /* additive */
     #define GGI_KM_STICKY   0x10    /* additive */
     #define GGI_KM_LOCKED   0x20    /* additive */

where the left/right distinction is given by the GGI_KM_RIGHT flag being
set or not.  Key *syms* would not distinguish between left/right -- both
have the same "meaning" (e.g. shift), whereas the key *labels* do
distinguish between left/right (e.g. for games that care about the exact
key).  Under this scheme, we'd have :

    /* key syms */
    
    #define GGI_KEY_SHIFT   GGI_KEY(GGI_KT_SHIFT, GGI_KM_SHIFT)
    #define GGI_KEY_ALT     GGI_KEY(GGI_KT_SHIFT, GGI_KM_ALT)
    #define GGI_KEY_CTRL    GGI_KEY(GGI_KT_SHIFT, GGI_KM_CTRL)
    ...etc...
    
    #define GGI_KEY_STICKY_SHIFT  (GGI_KEY_SHIFT | GGI_KM_STICKY)
    #define GGI_KEY_STICKY_ALT    (GGI_KEY_ALT   | GGI_KM_STICKY)
    ...etc...

    #define GGI_KEY_LOCKED_SHIFT  (GGI_KEY_SHIFT | GGI_KM_LOCKED)
    #define GGI_KEY_LOCKED_ALT    (GGI_KEY_ALT   | GGI_KM_LOCKED)
    ...etc...

    /* key labels */

    #define GGI_KEY_SHIFTL   (GGI_KEY_SHIFT)
    #define GGI_KEY_SHIFTR   (GGI_KEY_SHIFT | GGI_KM_RIGHT)
    #define GGI_KEY_ALTL     (GGI_KEY_ALT)
    #define GGI_KEY_ALTR     (GGI_KEY_ALT   | GGI_KM_RIGHT)
    #define GGI_KEY_CTRLL    (GGI_KEY_CTRL)
    #define GGI_KEY_CTRLR    (GGI_KEY_CTRL  | GGI_KM_RIGHT)
    ...etc...

I find the current key modifiers (inherited from Linux), with three
versions of shift (KG_SHIFT, KG_SHIFTL, KG_SHIFTR) and three versions of
control (KG_CTRL, KG_CTRLL, KG_CTRLR) to be pretty confused.  In
keytables(5) it says :

    "The keyboard driver supports 8  modifiers.  These modifiers  are
    labeled  (completely  arbitrarily)  Shift, AltGr, Control, Alt,
    ShiftL,  ShiftR,  CtrlL  and CtrlR."

The "completely arbitrarily" bit is what I find so crazy, yet the same
thing is said in include/ggi/events.h :

  /*      We allow for up to eight modifier keys, the names below have
   *      no meaning at all, but it is recommended to map them according
   *      to their names. They are unlikely to be extended, just because
   *      you normally have only ten fingers.
   */
    typedef enum ggi_modifier_keys {
        mkShift,        mkCtrl,         mkAlt,       mkAltGr,
        mkShiftL,       mkShiftR,       mkCtrlL,     mkCtrlR
    } ggi_modifier_keys;

Note the "no meaning at all" bit.  IMHO we *should* have modifiers that
have meaning, which the what my above scheme is mainly about.  Six
modifiers (shift,ctrl,alt,top,super,hyper) with corresponding bits in
the _effect_ field of key events, and some key _labels_ which can
differentiate left and right actual keys.

What do you think ?

Cheers,
_____________________________________________  ____
                                               \  /
  Andrew Apted   <andrew@ggi-project.org>       \/
  
  
[note 1]  The name "top" is from the "Debian Keyboard Cconfiguration"
specification, and refers to the ALTGR modifier for folks who want ALTGR
key to act differently from the ALT key.

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