]> git.jsancho.org Git - lugaru.git/commitdiff
Fixed shift, ctrl and alt.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 10 Aug 2005 16:44:20 +0000 (16:44 +0000)
committerRyan C. Gordon <icculus@icculus.org>
Wed, 10 Aug 2005 16:44:20 +0000 (16:44 +0000)
Source/OpenGL_Windows.cpp

index 9b0dfad415062b579e7d2ea87ae9aab4160344ed..1fa7ec4d39c734ee1ac358d822c8c8ce068e526a 100644 (file)
@@ -457,6 +457,8 @@ static inline int clamp_sdl_mouse_button(Uint8 button)
 static void sdlEventProc(const SDL_Event &e, Game &game)
 {
     int val;
+    SDLMod mod;
+
     switch(e.type)
        {
         case SDL_MOUSEMOTION:
@@ -523,19 +525,20 @@ static void sdlEventProc(const SDL_Event &e, Game &game)
                     SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
             }
 
-            if (e.key.keysym.sym < SDLK_LAST)
+            else if (e.key.keysym.sym < SDLK_LAST)
             {
                 if (KeyTable[e.key.keysym.sym] != 0xffff)
                     SetKey(KeyTable[e.key.keysym.sym]);
             }
 
-            if (e.key.keysym.mod & KMOD_CTRL)
+            mod = SDL_GetModState();
+            if (mod & KMOD_CTRL)
                 SetKey(MAC_CONTROL_KEY);
-            if (e.key.keysym.mod & KMOD_ALT)
+            if (mod & KMOD_ALT)
                 SetKey(MAC_OPTION_KEY);
-            if (e.key.keysym.mod & KMOD_SHIFT)
+            if (mod & KMOD_SHIFT)
                 SetKey(MAC_SHIFT_KEY);
-            if (e.key.keysym.mod & KMOD_CAPS)
+            if (mod & KMOD_CAPS)
                 SetKey(MAC_CAPS_LOCK_KEY);
 
             return;
@@ -547,13 +550,14 @@ static void sdlEventProc(const SDL_Event &e, Game &game)
                     ClearKey(KeyTable[e.key.keysym.sym]);
             }
 
-            if (e.key.keysym.mod & KMOD_CTRL)
+            mod = SDL_GetModState();
+            if ((mod & KMOD_CTRL) == 0)
                 ClearKey(MAC_CONTROL_KEY);
-            if (e.key.keysym.mod & KMOD_ALT)
+            if ((mod & KMOD_ALT) == 0)
                 ClearKey(MAC_OPTION_KEY);
-            if (e.key.keysym.mod & KMOD_SHIFT)
+            if ((mod & KMOD_SHIFT) == 0)
                 ClearKey(MAC_SHIFT_KEY);
-            if (e.key.keysym.mod & KMOD_CAPS)
+            if ((mod & KMOD_CAPS) == 0)
                 ClearKey(MAC_CAPS_LOCK_KEY);
             return;
     }