X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fkeys.cpp;h=38d94807b03fcc0d982f641a433f8aa98e4ae513;hb=a50eef72fac4b253bd014a32ec43b90e990b5784;hp=062b9be8e6b74ef9887901ba2859c45aba0ed9db;hpb=ad98112ecfb8898cff23e7a4c8dbd919135d7ae2;p=libs%2Fgui.git diff --git a/source/input/keys.cpp b/source/input/keys.cpp index 062b9be..38d9480 100644 --- a/source/input/keys.cpp +++ b/source/input/keys.cpp @@ -1,18 +1,11 @@ -/* $Id$ - -This file is part of libmspgbase -Copyright © 2008, 2010 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include +#include #ifdef WIN32 #include #else #include #include #endif -#include #include "keys.h" using namespace std; @@ -104,15 +97,6 @@ unsigned keymap[Msp::Input::N_KEYS_]= #endif }; -unsigned modmap[Msp::Input::N_MODS_]= -{ -#ifndef WIN32 - ShiftMask, ControlMask, Mod1Mask, Mod4Mask -#else - 1, 2, 4, 8 -#endif -}; - } namespace Msp { @@ -120,19 +104,19 @@ namespace Input { unsigned key_from_sys(unsigned code) { - static bool init_done=false; + static bool init_done = false; static map reverse_map; if(!init_done) { for(unsigned i=0; i::const_iterator i=reverse_map.find(code); + map::const_iterator i = reverse_map.find(code); if(i!=reverse_map.end()) return i->second; @@ -142,18 +126,9 @@ unsigned key_from_sys(unsigned code) unsigned key_to_sys(unsigned key) { if(key>=N_KEYS_) - throw InvalidParameterValue("Key out of range"); + throw invalid_argument("key_to_sys"); return keymap[key]; } -unsigned mod_from_sys(unsigned mod) -{ - unsigned result = 0; - for(unsigned i=0; i