sdlterm/src/sdlterm.cc
changeset 67 71f60bf6ebb7
parent 62 2f61931520c9
child 71 cfd3445107b4
equal deleted inserted replaced
66:824a9837bbb3 67:71f60bf6ebb7
   430                     event.key.keyname[0] = 0;
   430                     event.key.keyname[0] = 0;
   431                     event.key.unicode = sdl_event.key.keysym.unicode;
   431                     event.key.unicode = sdl_event.key.keysym.unicode;
   432                     if (!event.key.unicode)
   432                     if (!event.key.unicode)
   433                         break; // continue loop (unknown key)
   433                         break; // continue loop (unknown key)
   434                 }
   434                 }
       
   435                 event.key.mod = _translate_mod(sdl_event.key.keysym.mod);
   435                 event_ready = true;
   436                 event_ready = true;
   436                 break;
   437                 break;
   437             }
   438             }
   438 
   439 
   439             case SDL_MOUSEBUTTONDOWN:
   440             case SDL_MOUSEBUTTONDOWN:
   528         default: return NULL;
   529         default: return NULL;
   529     }
   530     }
   530 }
   531 }
   531 
   532 
   532 
   533 
       
   534 int Terminal::_translate_mod(SDLMod mod)
       
   535 {
       
   536     int res = 0;
       
   537     if (mod & KMOD_SHIFT)   res |= KeyMod::SHIFT;
       
   538     if (mod & KMOD_ALT)     res |= KeyMod::ALT;
       
   539     if (mod & KMOD_CTRL)    res |= KeyMod::CTRL;
       
   540     if (mod & KMOD_META)    res |= KeyMod::META;
       
   541     return res;
       
   542 }
       
   543 
       
   544 
   533 Uint32 Terminal::_wait_event_callback(Uint32 interval, void *param)
   545 Uint32 Terminal::_wait_event_callback(Uint32 interval, void *param)
   534 {
   546 {
   535     SDL_Event event;
   547     SDL_Event event;
   536     event.type = SDL_USEREVENT;
   548     event.type = SDL_USEREVENT;
   537     event.user.code = 1;
   549     event.user.code = 1;