# HG changeset patch # User Xeli # Date 1339101628 -7200 # Node ID 65a022bf6bde6d645a32b6631c09a601ecd3532c # Parent e6c379b486d5b01d691136f9e9562ae9ae1ded81 ignore keymodifers other than ctrl/alt/shift diff -r e6c379b486d5 -r 65a022bf6bde hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Thu Jun 07 01:28:39 2012 +0200 +++ b/hedgewars/SDLh.pas Thu Jun 07 22:40:28 2012 +0200 @@ -275,8 +275,8 @@ KMOD_RSHIFT = $0002; KMOD_LCTRL = $0040; KMOD_RCTRL = $0080; - KMOD_LALT = $0100; - KMOD_RALT = $0200; + KMOD_LALT = $0400; + KMOD_RALT = $0800; KMOD_LMETA = $0400; KMOD_RMETA = $0800; KMOD_NUM = $1000; diff -r e6c379b486d5 -r 65a022bf6bde hedgewars/uInputHandler.pas --- a/hedgewars/uInputHandler.pas Thu Jun 07 01:28:39 2012 +0200 +++ b/hedgewars/uInputHandler.pas Thu Jun 07 22:40:28 2012 +0200 @@ -47,6 +47,14 @@ implementation uses uConsole, uCommands, uMisc, uVariables, uConsts, uUtils, uDebug; +const + LSHIFT = $0200; + RSHIFT = $0400; + LALT = $0800; + RALT = $1000; + LCTRL = $2000; + RCTRL = $4000; + var tkbd: array[0..cKbdMaxIndex] of boolean; quitKeyCode: Byte; KeyNames: array [0..cKeyMaxIndex] of string[15]; @@ -65,7 +73,12 @@ procedure MaskModifier(var code: LongInt; Modifier: LongWord); begin - code:= code or (modifier shl 10); + if(Modifier and KMOD_LSHIFT) <> 0 then code:= code or LSHIFT; + if(Modifier and KMOD_RSHIFT) <> 0 then code:= code or LSHIFT; + if(Modifier and KMOD_LALT) <> 0 then code:= code or LALT; + if(Modifier and KMOD_RALT) <> 0 then code:= code or LALT; + if(Modifier and KMOD_LCTRL) <> 0 then code:= code or LCTRL; + if(Modifier and KMOD_RCTRL) <> 0 then code:= code or LCTRL; end; procedure MaskModifier(Modifier: shortstring; var code: LongInt); @@ -84,12 +97,12 @@ begin mod_:= ''; SplitByChar(Modifier, mod_, ':'); - if (Modifier = 'lshift') then code:= code or (KMOD_LSHIFT shl 10); - if (Modifier = 'rshift') then code:= code or (KMOD_RSHIFT shl 10); - if (Modifier = 'lalt') then code:= code or (KMOD_LALT shl 10); - if (Modifier = 'ralt') then code:= code or (KMOD_RALT shl 10); - if (Modifier = 'lctrl') or (mod_ = 'lmeta') then code:= code or (KMOD_LCTRL shl 10); - if (Modifier = 'rctrl') or (mod_ = 'rmeta') then code:= code or (KMOD_RCTRL shl 10); + if (Modifier = 'lshift') then code:= code or LSHIFT; + if (Modifier = 'rshift') then code:= code or RSHIFT; + if (Modifier = 'lalt') then code:= code or LALT; + if (Modifier = 'ralt') then code:= code or RALT; + if (Modifier = 'lctrl') or (mod_ = 'lmeta') then code:= code or LCTRL; + if (Modifier = 'rctrl') or (mod_ = 'rmeta') then code:= code or RCTRL; Modifier:= mod_; end; end; @@ -144,7 +157,6 @@ begin code:= event.keysym.sym; MaskModifier(code, event.keysym.modifier); - ProcessKey(code, event.type_ = SDL_KEYDOWN); end;