[AD] [ alleg-Bugs-2889063 ] Keyboard behaviour differs

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Bugs item #2889063, was opened at 2009-10-29 21:31
Message generated for change (Comment added) made by chrisan
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105665&aid=2889063&group_id=5665

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: 4.3.10plus
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Christer Sandberg (chrisan)
Assigned to: Nobody/Anonymous (nobody)
Summary: Keyboard behaviour differs

Initial Comment:
The attached program gives different output on different platforms when typing the AltGr-key combined with some other key. My windows laptop (old) prints 6 for the key_shifts (i.e. ctrl + alt) while a Linux desktop prints 20 (i.e. "KB_MENU_FLAG" (is that "KB_ALT_GR"?)).
I have Swedish keyboard on both.

----------------------------------------------------------------------

>Comment By: Christer Sandberg (chrisan)
Date: 2009-10-30 16:14

Message:
If  key_shifts  is unreliable but the key array is reliable, then I'm fine
with that. The problem was on the windows side: control was reported down
when it wasn't (only altgr was down). In that case I drop this issue. Note
that even for simple inputs you probably want to provide some basic editing
facilities. I don't know how to carry out that with unicode keys. Currently
I use the control key to conform to the standard way of edit text in
windowed environments.

----------------------------------------------------------------------

Comment By: Elias Pschernig (allefant)
Date: 2009-10-30 13:45

Message:
The relevant code for X11 is in src/x/xkeyboard.c:

/* Table of: Allegro's modifier flag, associated X11 flag, toggle method.
*/
static int modifier_flags[8][3] = {
   {KB_SHIFT_FLAG, ShiftMask, 0},
   {KB_CAPSLOCK_FLAG, LockMask, 1},
   {KB_CTRL_FLAG, ControlMask, 0},
   {KB_ALT_FLAG, Mod1Mask, 0},
   {KB_NUMLOCK_FLAG, Mod2Mask, 1},
   {KB_SCROLOCK_FLAG, Mod3Mask, 1},
   {KB_LWIN_FLAG | KB_RWIN_FLAG, Mod4Mask, 0}, /* Should we use only one?
*/
   {KB_MENU_FLAG, Mod5Mask, 0} /* AltGr */
};

X11 only knows about  ShiftMask, LockMask, ControlMask, Mod[12345]Mask -
in the above table we map the X11 control key masks to the Allegro one. I
wouldn't mind a patch which makes Mod5Mask instead trigger CTRL and ALT as
in Windows if you think that's better - however Mod5Mask does not always
correspond to AltGr.

In general, for a game, it's best to only use the key[] array (or better
the keyboard callback) for controls. And in text applications, only use the
unicode symbols. Relying on key_shifts just asks for troubled users.

----------------------------------------------------------------------

Comment By: Christer Sandberg (chrisan)
Date: 2009-10-30 07:01

Message:
- The Windows system on the laptop is XP
- In case the AltGr key is not present on all kinds of keyboard layouts:
This is the key immediately to the right of the space bar.
- The complete output when running on the Windows machine is: 6 0 ffffffff
0 0, i.e. the key array reflects the state correctly while key_shifts
doesn't.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105665&aid=2889063&group_id=5665




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/