[Orxonox-commit 746] r3276 - branches/core4/src/core/input
rgrieder at orxonox.net
rgrieder at orxonox.net
Sun Jul 12 16:49:41 CEST 2009
Author: rgrieder
Date: 2009-07-12 16:49:41 +0200 (Sun, 12 Jul 2009)
New Revision: 3276
Modified:
branches/core4/src/core/input/InputManager.cc
branches/core4/src/core/input/InputManager.h
branches/core4/src/core/input/Mouse.cc
branches/core4/src/core/input/Mouse.h
Log:
Moved grab/ungrab mouse hack for Linux from InputManager to Mouse.
Modified: branches/core4/src/core/input/InputManager.cc
===================================================================
--- branches/core4/src/core/input/InputManager.cc 2009-07-12 14:44:27 UTC (rev 3275)
+++ branches/core4/src/core/input/InputManager.cc 2009-07-12 14:49:41 UTC (rev 3276)
@@ -60,19 +60,10 @@
#include "Mouse.h"
#include "Keyboard.h"
-// HACK (include this as last, X11 seems to define some macros...)
-#ifdef ORXONOX_PLATFORM_LINUX
-# include <ois/linux/LinuxMouse.h>
-#endif
-
namespace orxonox
{
SetConsoleCommand(InputManager, calibrate, true);
SetConsoleCommand(InputManager, reload, false);
-#ifdef ORXONOX_PLATFORM_LINUX
- SetConsoleCommand(InputManager, grabMouse, true);
- SetConsoleCommand(InputManager, ungrabMouse, true);
-#endif
SetCommandLineSwitch(keyboard_no_grab).information("Whether not to exclusively grab the keyboard");
InputHandler InputHandler::EMPTY;
@@ -913,26 +904,4 @@
{
getInstance().reloadInputSystem();
}
-
-
- // ############################################################
- // ##### ugly hacks #####
- // ########## ##########
- // ############################################################
-
-#ifdef ORXONOX_PLATFORM_LINUX
- void InputManager::grabMouse()
- {
- OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(singletonRef_s->mouse_);
- assert(linuxMouse);
- linuxMouse->grab(true);
- }
-
- void InputManager::ungrabMouse()
- {
- OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(singletonRef_s->mouse_);
- assert(linuxMouse);
- linuxMouse->grab(false);
- }
-#endif
}
Modified: branches/core4/src/core/input/InputManager.h
===================================================================
--- branches/core4/src/core/input/InputManager.h 2009-07-12 14:44:27 UTC (rev 3275)
+++ branches/core4/src/core/input/InputManager.h 2009-07-12 14:49:41 UTC (rev 3276)
@@ -107,12 +107,6 @@
unsigned int getJoyStickQuantity() const
{ return devices_.size() - InputDeviceEnumerator::FirstJoyStick; }
-#ifdef ORXONOX_PLATFORM_LINUX
- // HACK!
- static void grabMouse();
- static void ungrabMouse();
-#endif
-
void update(const Clock& time);
static InputManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
Modified: branches/core4/src/core/input/Mouse.cc
===================================================================
--- branches/core4/src/core/input/Mouse.cc 2009-07-12 14:44:27 UTC (rev 3275)
+++ branches/core4/src/core/input/Mouse.cc 2009-07-12 14:49:41 UTC (rev 3276)
@@ -33,12 +33,13 @@
#include "InputState.h"
#include "core/ConsoleCommand.h"
+// HACK (include this as last, X11 seems to define some macros...)
+#ifdef ORXONOX_PLATFORM_LINUX
+# include <ois/linux/LinuxMouse.h>
+#endif
+
namespace orxonox
{
- // HACK:
- SetConsoleCommand(Mouse, setMouseClipping_s, false);
- Mouse* Mouse::instancePointer_s = NULL;
-
Mouse::Mouse(unsigned int id, unsigned int windowWidth, unsigned int windowHeight)
: super(id)
{
@@ -85,4 +86,33 @@
return true;
}
+
+ // ############################################################
+ // ##### ugly hacks #####
+ // ########## ##########
+ // ############################################################
+
+ // HACK:
+ SetConsoleCommand(Mouse, setMouseClipping_s, false);
+#ifdef ORXONOX_PLATFORM_LINUX
+ SetConsoleCommand(Mouse, grabMouse, true);
+ SetConsoleCommand(Mouse, ungrabMouse, true);
+#endif
+ Mouse* Mouse::instancePointer_s = NULL;
+
+#ifdef ORXONOX_PLATFORM_LINUX
+ void Mouse::grabMouse()
+ {
+ OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(instancePointer_s->oisDevice_);
+ assert(linuxMouse);
+ linuxMouse->grab(true);
+ }
+
+ void Mouse::ungrabMouse()
+ {
+ OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(instancePointer_s->oisDevice_);
+ assert(linuxMouse);
+ linuxMouse->grab(false);
+ }
+#endif
}
Modified: branches/core4/src/core/input/Mouse.h
===================================================================
--- branches/core4/src/core/input/Mouse.h 2009-07-12 14:44:27 UTC (rev 3275)
+++ branches/core4/src/core/input/Mouse.h 2009-07-12 14:49:41 UTC (rev 3276)
@@ -61,10 +61,15 @@
unsigned int getClippingWidth() const;
unsigned int getClippingHeight() const;
- // HACK:
+ // HACK!
static void setMouseClipping_s(unsigned int width, unsigned int height)
{ instancePointer_s->setMouseClipping(width, height); }
void setConfigValues() { }
+#ifdef ORXONOX_PLATFORM_LINUX
+ // HACK!
+ static void grabMouse();
+ static void ungrabMouse();
+#endif
private:
// TODO: Do we need to reset the mouse position?
More information about the Orxonox-commit
mailing list