00001 /* 00002 The zlib/libpng License 00003 00004 Copyright (c) 2006 Phillip Castaneda (pjcast -- www.wreckedgames.com) 00005 00006 This software is provided 'as-is', without any express or implied warranty. In no event will 00007 the authors be held liable for any damages arising from the use of this software. 00008 00009 Permission is granted to anyone to use this software for any purpose, including commercial 00010 applications, and to alter it and redistribute it freely, subject to the following 00011 restrictions: 00012 00013 1. The origin of this software must not be misrepresented; you must not claim that 00014 you wrote the original software. If you use this software in a product, 00015 an acknowledgment in the product documentation would be appreciated but is 00016 not required. 00017 00018 2. Altered source versions must be plainly marked as such, and must not be 00019 misrepresented as being the original software. 00020 00021 3. This notice may not be removed or altered from any source distribution. 00022 */ 00023 #ifndef _LINUX_KEYBOARD_H_EADER_ 00024 #define _LINUX_KEYBOARD_H_EADER_ 00025 00026 #include "linux/LinuxPrereqs.h" 00027 #include "OISKeyboard.h" 00028 #include <X11/Xlib.h> 00029 00030 namespace OIS 00031 { 00033 class LinuxKeyboard : public Keyboard 00034 { 00035 public: 00036 LinuxKeyboard(InputManager* creator, bool buffered, bool grab, bool useXRepeat ); 00037 virtual ~LinuxKeyboard(); 00038 00040 virtual bool isKeyDown( KeyCode key ); 00041 00043 virtual const std::string& getAsString( KeyCode kc ); 00044 00046 virtual void copyKeyStates( char keys[256] ); 00047 00049 virtual void setBuffered(bool buffered); 00050 00052 virtual void capture(); 00053 00055 virtual Interface* queryInterface(Interface::IType) {return 0;} 00056 00058 virtual void _initialize(); 00059 00060 protected: 00061 bool _injectKeyDown( KeySym key, int text ); 00062 bool _injectKeyUp( KeySym key ); 00063 00065 typedef std::map<KeySym, KeyCode> XtoOIS_KeyMap; 00066 XtoOIS_KeyMap keyConversion; 00067 00069 char KeyBuffer[256]; 00070 00072 Window window; 00073 Display *display; 00074 bool grabKeyboard; 00075 bool keyFocusLost; 00076 00077 bool xAutoRepeat; 00078 bool oldXAutoRepeat; 00079 00080 std::string mGetString; 00081 }; 00082 } 00083 00084 #endif //_LINUX_KEYBOARD_H_EADER_
1.5.4