Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3276


Ignore:
Timestamp:
Jul 12, 2009, 4:49:41 PM (15 years ago)
Author:
rgrieder
Message:

Moved grab/ungrab mouse hack for Linux from InputManager to Mouse.

Location:
code/branches/core4/src/core/input
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core4/src/core/input/InputManager.cc

    r3274 r3276  
    6161#include "Keyboard.h"
    6262
    63 // HACK (include this as last, X11 seems to define some macros...)
    64 #ifdef ORXONOX_PLATFORM_LINUX
    65 #  include <ois/linux/LinuxMouse.h>
    66 #endif
    67 
    6863namespace orxonox
    6964{
    7065    SetConsoleCommand(InputManager, calibrate, true);
    7166    SetConsoleCommand(InputManager, reload, false);
    72 #ifdef ORXONOX_PLATFORM_LINUX
    73     SetConsoleCommand(InputManager, grabMouse, true);
    74     SetConsoleCommand(InputManager, ungrabMouse, true);
    75 #endif
    7667    SetCommandLineSwitch(keyboard_no_grab).information("Whether not to exclusively grab the keyboard");
    7768
     
    914905        getInstance().reloadInputSystem();
    915906    }
    916 
    917 
    918     // ############################################################
    919     // #####                   ugly hacks                     #####
    920     // ##########                                        ##########
    921     // ############################################################
    922 
    923 #ifdef ORXONOX_PLATFORM_LINUX
    924     void InputManager::grabMouse()
    925     {
    926         OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(singletonRef_s->mouse_);
    927         assert(linuxMouse);
    928         linuxMouse->grab(true);
    929     }
    930 
    931     void InputManager::ungrabMouse()
    932     {
    933         OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(singletonRef_s->mouse_);
    934         assert(linuxMouse);
    935         linuxMouse->grab(false);
    936     }
    937 #endif
    938907}
  • code/branches/core4/src/core/input/InputManager.h

    r3274 r3276  
    108108            { return devices_.size() - InputDeviceEnumerator::FirstJoyStick; }
    109109
    110 #ifdef ORXONOX_PLATFORM_LINUX
    111         // HACK!
    112         static void grabMouse();
    113         static void ungrabMouse();
    114 #endif
    115 
    116110        void update(const Clock& time);
    117111
  • code/branches/core4/src/core/input/Mouse.cc

    r3274 r3276  
    3434#include "core/ConsoleCommand.h"
    3535
     36// HACK (include this as last, X11 seems to define some macros...)
     37#ifdef ORXONOX_PLATFORM_LINUX
     38#  include <ois/linux/LinuxMouse.h>
     39#endif
     40
    3641namespace orxonox
    3742{
    38     // HACK:
    39     SetConsoleCommand(Mouse, setMouseClipping_s, false);
    40     Mouse* Mouse::instancePointer_s = NULL;
    41 
    4243    Mouse::Mouse(unsigned int id, unsigned int windowWidth, unsigned int windowHeight)
    4344        : super(id)
     
    8687        return true;
    8788    }
     89
     90    // ############################################################
     91    // #####                   ugly hacks                     #####
     92    // ##########                                        ##########
     93    // ############################################################
     94
     95    // HACK:
     96    SetConsoleCommand(Mouse, setMouseClipping_s, false);
     97#ifdef ORXONOX_PLATFORM_LINUX
     98    SetConsoleCommand(Mouse, grabMouse, true);
     99    SetConsoleCommand(Mouse, ungrabMouse, true);
     100#endif
     101    Mouse* Mouse::instancePointer_s = NULL;
     102
     103#ifdef ORXONOX_PLATFORM_LINUX
     104    void Mouse::grabMouse()
     105    {
     106        OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(instancePointer_s->oisDevice_);
     107        assert(linuxMouse);
     108        linuxMouse->grab(true);
     109    }
     110
     111    void Mouse::ungrabMouse()
     112    {
     113        OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(instancePointer_s->oisDevice_);
     114        assert(linuxMouse);
     115        linuxMouse->grab(false);
     116    }
     117#endif
    88118}
  • code/branches/core4/src/core/input/Mouse.h

    r3275 r3276  
    6262        unsigned int getClippingHeight() const;
    6363
    64         // HACK:
     64        // HACK!
    6565        static void setMouseClipping_s(unsigned int width, unsigned int height)
    6666            { instancePointer_s->setMouseClipping(width, height); }
    6767        void setConfigValues() { }
     68#ifdef ORXONOX_PLATFORM_LINUX
     69        // HACK!
     70        static void grabMouse();
     71        static void ungrabMouse();
     72#endif
    6873
    6974    private:
Note: See TracChangeset for help on using the changeset viewer.