sdlterm/src/sdlterm.cc
changeset 67 71f60bf6ebb7
parent 62 2f61931520c9
child 71 cfd3445107b4
--- a/sdlterm/src/sdlterm.cc	Wed Jan 23 00:59:21 2013 +0100
+++ b/sdlterm/src/sdlterm.cc	Wed Jan 23 21:49:40 2013 +0100
@@ -432,6 +432,7 @@
                     if (!event.key.unicode)
                         break; // continue loop (unknown key)
                 }
+                event.key.mod = _translate_mod(sdl_event.key.keysym.mod);
                 event_ready = true;
                 break;
             }
@@ -530,6 +531,17 @@
 }
 
 
+int Terminal::_translate_mod(SDLMod mod)
+{
+    int res = 0;
+    if (mod & KMOD_SHIFT)   res |= KeyMod::SHIFT;
+    if (mod & KMOD_ALT)     res |= KeyMod::ALT;
+    if (mod & KMOD_CTRL)    res |= KeyMod::CTRL;
+    if (mod & KMOD_META)    res |= KeyMod::META;
+    return res;
+}
+
+
 Uint32 Terminal::_wait_event_callback(Uint32 interval, void *param)
 {
     SDL_Event event;