[SDL] AltGr and other things

Elden Armbrust earmbrust at xero-soft.com
Wed Sep 28 22:05:32 PDT 2005


Ingo Schmidt wrote:

>>Is this on a press AND release that you get the following four events?
>>    
>>
>
>Yes, sorry, I wasnt precise.
>I press AND release the AltGr key.
>
>  
>
>>If it is a press and release of those keys, then that is how it should
>>respond, given the code:
>>    
>>
>
>The AltGr key IS supposed to send a "left ctrl" and then "right alt"
>event??
>Is it not supposed to send an AltGR event or something similar?
>
>  
>
Sorry, I wasn't particularly sure if the AltGr was an abbreviation for 
the CtlAlt combination on your keyboad or if it was a single key in and 
of itself.  What is the usual purpose for this key?  That might clear 
some things up for me.  If it does function like the Ctl + Alt key 
combinations on our keyboards here in the states, then it's likely 
that's why you're actually raising 4 events for one keys press and 
release.  I'll do a little research and see how this key works at a 
lower level.

>In the case of AltGr being pressed, I can actually make a workaround:
>If I receive a "left ctrl down" event, I check with SDL_GetModState(),
>if there was AltGr pressed, since SDL_GetModState() actually tells me
>that.
>
>But on AltGr *release* event, I am screwed. Because I receive the
>following events on AltGr release:
>
>"left ctrl released" and then "right alt released". And in
>SDL_GetModState() the bits for the AltGr key are no longer set.
>
>So releasing AltGr results in an event, that is 100% identical to the
>event "left control released".
>
>The only way to find out, that it was actually NOT a "left ctrl
>release" event would be to check, if the next event was "right alt
>released". But this is quite a hack and I dont want to do it like
>that.
>
>  
>
You could use SDL_GetModState() and check the state to see if on the 
control key is active upon the alt being released. (I hope that made 
sense, it's a bit of a word maze.)  If the control key state is not 
active, then you can safely assume that since the alt key was release, 
so was the control key. 

>>I'm sorry, I don't know much about foreign keyboards and the way SDL
>>handles their keysyms, maybe someone else would know more about this
>>problem than I do.
>>    
>>
>
>Where in the sources do I have to look, if I want to find out, how
>libSDL looks for keyboard events? Where does libSDL get its info
>from?
>
>  
>
I would start with the SDL_keyboard.c file, and move to the other files 
in the events subdirectory in the sources archive.
I'm very sorry there's not more I could explain, but like I said 
before...I have pretty much no experience with foreign keyboards or 
their layouts.  If we can determine how we can get it working properly, 
and possibly work out a patch for 1.3.0 :)
-Elden






More information about the SDL mailing list