Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 13, 2011, 1:25:46 AM (14 years ago)
Author:
landauf
Message:

WindowEventListener now declares if the window's focus is active or not.
CEGUI stops highlighting menu items if the window's focus is lost, i.e. after pressing alt+tab

Location:
code/trunk/src/libraries/core
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/GUIManager.cc

    r7873 r7874  
    393393
    394394    /**
     395        @brief Indicates that the mouse left the application's window.
     396    */
     397    void GUIManager::mouseLeft()
     398    {
     399        this->protectedCall(boost::bind(&CEGUI::System::injectMouseLeaves, _1));
     400    }
     401
     402    /**
    395403    @brief
    396404        converts mouse event code to CEGUI event code
     
    505513        this->guiRenderer_->setDisplaySize(CEGUI::Size(newWidth, newHeight));
    506514    }
     515
     516    /**
     517        @brief Notify CEGUI if the windows loses the focus (stops higlight of menu items, etc).
     518    */
     519    void GUIManager::windowFocusChanged(bool bFocus)
     520    {
     521        if (!bFocus)
     522            this->mouseLeft();
     523    }
    507524}
  • code/trunk/src/libraries/core/GUIManager.h

    r7873 r7874  
    132132        void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
    133133        void mouseScrolled (int abs, int rel);
     134        void mouseLeft     ();
    134135
    135136        // window event handler
    136137        virtual void windowResized(unsigned int newWidth, unsigned int newHeight);
     138        virtual void windowFocusChanged(bool bFocus);
    137139
    138140        scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
  • code/trunk/src/libraries/core/GraphicsManager.cc

    r7870 r7874  
    7575            { orxonox::WindowEventListener::resizeWindow(rw->getWidth(), rw->getHeight()); }
    7676        void windowFocusChange (Ogre::RenderWindow* rw)
    77             { orxonox::WindowEventListener::changeWindowFocus(); }
     77            { orxonox::WindowEventListener::changeWindowFocus(rw->isActive()); }
    7878        void windowClosed      (Ogre::RenderWindow* rw)
    7979            { orxonox::Game::getInstance().stop(); }
  • code/trunk/src/libraries/core/WindowEventListener.cc

    r5781 r7874  
    5757
    5858    //! Calls all registered objects
    59     /*static*/ void WindowEventListener::changeWindowFocus()
     59    /*static*/ void WindowEventListener::changeWindowFocus(bool bFocus)
    6060    {
    6161        for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
    62             it->windowFocusChanged();
     62            it->windowFocusChanged(bFocus);
    6363    }
    6464}
  • code/trunk/src/libraries/core/WindowEventListener.h

    r7401 r7874  
    6262
    6363            //! Window has lost/gained focus
    64             virtual void windowFocusChanged() { }
     64            virtual void windowFocusChanged(bool bFocus) { }
    6565
    6666            static void moveWindow();
    6767            static void resizeWindow(unsigned int newWidth, unsigned int newHeight);
    68             static void changeWindowFocus();
     68            static void changeWindowFocus(bool bFocus);
    6969
    7070            //! Static variable that holds the latest distributed information
  • code/trunk/src/libraries/core/input/InputManager.cc

    r7401 r7874  
    496496
    497497    //! Gets called by WindowEventListener upon focus change --> clear buffers
    498     void InputManager::windowFocusChanged()
     498    void InputManager::windowFocusChanged(bool bFocus)
    499499    {
    500500        this->clearBuffers();
  • code/trunk/src/libraries/core/input/InputManager.h

    r7401 r7874  
    202202
    203203        // From WindowEventListener
    204         void windowFocusChanged();
     204        void windowFocusChanged(bool bFocus);
    205205
    206206    private: // variables
Note: See TracChangeset for help on using the changeset viewer.