bugGlobulation 2 - Bugs: bug #19602, using “+” to adjust requested...

 
 

bug #19602: using “+” to adjust requested workers fails on many keyboards

Submitted by:  Joe Wells <jbw>
Submitted on:  Mon 16 Apr 2007 06:39:24 AM UTC
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  None Open/Closed:  Closed
Release:  None Operating System:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Fri 27 Jul 2007 07:01:40 AM UTC, comment #6: 

Bradley Arsenault writes:

> The new keyboard shortcut system uses unicode-mapped characters for
> all but the special keys (like enter and backspace etc..)


Hurray!  Thanks for fixing this!

Joe Wells <jbw>
Fri 27 Jul 2007 05:10:07 AM UTC, comment #5: 

This bug is closed. The new keyboard shortcut system uses unicode-mapped characters for all but the special keys (like enter and backspace etc..)

Bradley Arsenault <genixpro>
Project Administrator
Fri 27 Apr 2007 06:34:28 PM UTC, comment #4: 

Thanks for fixing things so that "+" works on my keyboard.  Of course, the core problem still remains: the code is inspecting keycodes instead of characters, and therefore will fail for some commands on some keyboards.  So is this bug really "fixed"?  I think it should remain as a reminder of a long-term issue to be fixed.

Joe Wells <jbw>
Tue 17 Apr 2007 02:17:39 AM UTC, comment #3: 

I have done a partial fix, SDLK_PLUS and SDLK_KP_PLUS both work on my system. The problem seems to be that SDLK_KP_PLUS doesn't work on some keyboard layouts.

I've solved it bassically by adding in SDLK_EQUALS to do the same thing, so that one doesn't have to click shift to get to the plus key.

Bradley Arsenault <genixpro>
Project Administrator
Mon 16 Apr 2007 09:09:39 AM UTC, comment #2: 

Stephane Magnenat writes:

> The correct patch is to use unicode value of key, after translation
> by SDL, not putting all possibnle keymaps into glob2 sources.

Yes, of course.  That is what I wrote.

However, if 0.8.23 is about to be released, and the correct patch has
not been written, it would help hundreds of millions of people if the
stupid patch were put in place.  ☺

Joe Wells <jbw>
Mon 16 Apr 2007 07:59:49 AM UTC, comment #1: 

The correct patch is to use unicode value of key, after translation by SDL, not putting all possibnle keymaps into glob2 sources.

Stephane Magnenat <nct>
Project Administrator
Mon 16 Apr 2007 06:39:24 AM UTC, original submission:  

Typing “+” (on my keyboard this is the Shift key together with “=”)
doesn't work.  I can only use the keypad “+”.  This is a bigger
problem for me because my particular keyboard (which is on my portable
computer) doesn't actually have a keypad and simulates one by using
the num-lock key to temporarily turn many ordinary keys (7, 8, 9, 0,
u, i, o, p, [, j, k, l, ;, m, “,”, ., and /) into keypad keys.

The problem is that glob2 is expecting to get just the SDLK_PLUS key
event (and is ignoring the state of the modifiers).  On my keyboard,
the SDL key events glob2 gets for “+” are:

  SDLK_LSHIFT (key down)       (this could also be SDLK_RSHIFT)
  SDLK_EQUALS (key down)
  SDLK_EQUALS (key up)
  SDLK_LSHIFT (key up)

Although some European keyboards have “+” as the base character for a
key, many European keyboards do not and most non-European keyboards do
not.  Possible key layouts worldwide include (unshifted/shifted) =/+,
+/?, +/±, +/*, 3/+, 1/+, */+, and ;/+.  I assume this situation arose
because the main Globulation 2 developers use a keyboard where “+” is
not a shifted key.

I'm currently happily using this patch:

----------------------------------------------------------------------
--- GameGUI.cpp.~1.4350.~        2007-04-04 02:38:33.000000000 +0100
+++ GameGUI.cpp        2007-04-07 02:08:10.000000000 +0100
@@ -1181,6 +1181,7 @@
                                 }
                                 break;
                         case SDLK_PLUS:
+                        case SDLK_EQUALS:
                         case SDLK_KP_PLUS:
                                 {
                                         if ((pressed) && (selectionMode==BUILDING_SELECTION))
----------------------------------------------------------------------

This makes “=” do the same thing as “+”.  This solution handles most
North American and Asian keyboards and some European keyboards,
because on these keyboards “+” is merely Shift-“=”.  It is also
advantageous, because one can skip actually pressing the Shift key.

The correct solution is to use the SDL library properly.  A quick look
at the libsdl documentation installed on my computer at

file:///usr/share/doc/libsdl1.2-dev/docs/html/guideinputkeyboard.html

makes me think that the “unicode” field of the key event will hold the
right information provided the SDL_EnableUNICODE function is called at
initialization time to ask SDL to convert key events into characters.

I thank Steph and Martin Voelkle for feedback on this bug.

Joe Wells <jbw>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by genixpro (Posted a comment)
  • -email is unavailable- added by nct (Posted a comment)
  • -email is unavailable- added by jbw (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-07-27 genixpro Open/ClosedOpen => Closed
    2007-04-17 genixpro StatusNone => Fixed

    Back to the top


    Powered by Savane 3.9