/src/ois/includes/linux/LinuxInputManager.h

https://bitbucket.org/cabalistic/ogredeps/ · C Header · 105 lines · 39 code · 19 blank · 47 comment · 0 complexity · 8391c3611e26ea7f36905ca9d775653d MD5 · raw file

  1. /*
  2. The zlib/libpng License
  3. Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
  4. This software is provided 'as-is', without any express or implied warranty. In no event will
  5. the authors be held liable for any damages arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose, including commercial
  7. applications, and to alter it and redistribute it freely, subject to the following
  8. restrictions:
  9. 1. The origin of this software must not be misrepresented; you must not claim that
  10. you wrote the original software. If you use this software in a product,
  11. an acknowledgment in the product documentation would be appreciated but is
  12. not required.
  13. 2. Altered source versions must be plainly marked as such, and must not be
  14. misrepresented as being the original software.
  15. 3. This notice may not be removed or altered from any source distribution.
  16. */
  17. #ifndef OIS_LinuxInputManager_H
  18. #define OIS_LinuxInputManager_H
  19. #include "linux/LinuxPrereqs.h"
  20. #include "OISFactoryCreator.h"
  21. #include "OISInputManager.h"
  22. #include <X11/Xlib.h>
  23. namespace OIS
  24. {
  25. /**
  26. Linux X11 InputManager specialization - Using lowlevel joys
  27. */
  28. class LinuxInputManager : public InputManager, public FactoryCreator
  29. {
  30. public:
  31. LinuxInputManager();
  32. virtual ~LinuxInputManager();
  33. //InputManager Overrides
  34. /** @copydoc InputManager::_initialize */
  35. void _initialize( ParamList &paramList );
  36. //FactoryCreator Overrides
  37. /** @copydoc FactoryCreator::deviceList */
  38. DeviceList freeDeviceList();
  39. /** @copydoc FactoryCreator::totalDevices */
  40. int totalDevices(Type iType);
  41. /** @copydoc FactoryCreator::freeDevices */
  42. int freeDevices(Type iType);
  43. /** @copydoc FactoryCreator::vendorExist */
  44. bool vendorExist(Type iType, const std::string & vendor);
  45. /** @copydoc FactoryCreator::createObject */
  46. Object* createObject(InputManager *creator, Type iType, bool bufferMode, const std::string & vendor = "");
  47. /** @copydoc FactoryCreator::destroyObject */
  48. void destroyObject(Object* obj);
  49. //Internal Items
  50. //! Method for retrieving the XWindow Handle
  51. Window _getWindow() {return window;}
  52. //! Internal method for checking if regrabbing is needed
  53. void _setGrabState(bool grab) {mGrabs = grab;}
  54. bool _getGrabState() {return mGrabs;}
  55. //! Internal method, used for flaggin keyboard as available/unavailable for creation
  56. void _setKeyboardUsed(bool used) {keyboardUsed = used; }
  57. //! Internal method, used for flaggin mouse as available/unavailable for creation
  58. void _setMouseUsed(bool used) { mouseUsed = used; }
  59. protected:
  60. //! internal class method for dealing with param list
  61. void _parseConfigSettings( ParamList &paramList );
  62. //! internal class method for finding attached devices
  63. void _enumerateDevices();
  64. //! List of unused joysticks ready to be used
  65. JoyStickInfoList unusedJoyStickList;
  66. //! Number of joysticks found
  67. char joySticks;
  68. //! Used to know if we used up keyboard
  69. bool keyboardUsed;
  70. //! Used to know if we used up mouse
  71. bool mouseUsed;
  72. //! X11 Stuff
  73. Window window;
  74. /// Keyboard, Mouse Settings
  75. bool grabMouse, grabKeyboard;
  76. bool mGrabs;
  77. bool hideMouse;
  78. };
  79. }
  80. #endif