[Orxonox-commit 3181] r7874 - in code/trunk/src/libraries/core: . input
landauf at orxonox.net
landauf at orxonox.net
Sun Feb 13 01:25:46 CET 2011
Author: landauf
Date: 2011-02-13 01:25:46 +0100 (Sun, 13 Feb 2011)
New Revision: 7874
Modified:
code/trunk/src/libraries/core/GUIManager.cc
code/trunk/src/libraries/core/GUIManager.h
code/trunk/src/libraries/core/GraphicsManager.cc
code/trunk/src/libraries/core/WindowEventListener.cc
code/trunk/src/libraries/core/WindowEventListener.h
code/trunk/src/libraries/core/input/InputManager.cc
code/trunk/src/libraries/core/input/InputManager.h
Log:
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
Modified: code/trunk/src/libraries/core/GUIManager.cc
===================================================================
--- code/trunk/src/libraries/core/GUIManager.cc 2011-02-12 20:10:41 UTC (rev 7873)
+++ code/trunk/src/libraries/core/GUIManager.cc 2011-02-13 00:25:46 UTC (rev 7874)
@@ -392,6 +392,14 @@
}
/**
+ @brief Indicates that the mouse left the application's window.
+ */
+ void GUIManager::mouseLeft()
+ {
+ this->protectedCall(boost::bind(&CEGUI::System::injectMouseLeaves, _1));
+ }
+
+ /**
@brief
converts mouse event code to CEGUI event code
@param button
@@ -504,4 +512,13 @@
{
this->guiRenderer_->setDisplaySize(CEGUI::Size(newWidth, newHeight));
}
+
+ /**
+ @brief Notify CEGUI if the windows loses the focus (stops higlight of menu items, etc).
+ */
+ void GUIManager::windowFocusChanged(bool bFocus)
+ {
+ if (!bFocus)
+ this->mouseLeft();
+ }
}
Modified: code/trunk/src/libraries/core/GUIManager.h
===================================================================
--- code/trunk/src/libraries/core/GUIManager.h 2011-02-12 20:10:41 UTC (rev 7873)
+++ code/trunk/src/libraries/core/GUIManager.h 2011-02-13 00:25:46 UTC (rev 7874)
@@ -131,9 +131,11 @@
void buttonReleased(MouseButtonCode::ByEnum id);
void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
void mouseScrolled (int abs, int rel);
+ void mouseLeft ();
// window event handler
virtual void windowResized(unsigned int newWidth, unsigned int newHeight);
+ virtual void windowFocusChanged(bool bFocus);
scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_; //!< CEGUI's interface to the Ogre Engine
scoped_ptr<LuaState> luaState_; //!< LuaState, access point to the Lua engine
Modified: code/trunk/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/trunk/src/libraries/core/GraphicsManager.cc 2011-02-12 20:10:41 UTC (rev 7873)
+++ code/trunk/src/libraries/core/GraphicsManager.cc 2011-02-13 00:25:46 UTC (rev 7874)
@@ -74,7 +74,7 @@
void windowResized (Ogre::RenderWindow* rw)
{ orxonox::WindowEventListener::resizeWindow(rw->getWidth(), rw->getHeight()); }
void windowFocusChange (Ogre::RenderWindow* rw)
- { orxonox::WindowEventListener::changeWindowFocus(); }
+ { orxonox::WindowEventListener::changeWindowFocus(rw->isActive()); }
void windowClosed (Ogre::RenderWindow* rw)
{ orxonox::Game::getInstance().stop(); }
void windowMoved (Ogre::RenderWindow* rw)
Modified: code/trunk/src/libraries/core/WindowEventListener.cc
===================================================================
--- code/trunk/src/libraries/core/WindowEventListener.cc 2011-02-12 20:10:41 UTC (rev 7873)
+++ code/trunk/src/libraries/core/WindowEventListener.cc 2011-02-13 00:25:46 UTC (rev 7874)
@@ -56,9 +56,9 @@
}
//! Calls all registered objects
- /*static*/ void WindowEventListener::changeWindowFocus()
+ /*static*/ void WindowEventListener::changeWindowFocus(bool bFocus)
{
for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
- it->windowFocusChanged();
+ it->windowFocusChanged(bFocus);
}
}
Modified: code/trunk/src/libraries/core/WindowEventListener.h
===================================================================
--- code/trunk/src/libraries/core/WindowEventListener.h 2011-02-12 20:10:41 UTC (rev 7873)
+++ code/trunk/src/libraries/core/WindowEventListener.h 2011-02-13 00:25:46 UTC (rev 7874)
@@ -61,11 +61,11 @@
virtual void windowResized(unsigned int newWidth, unsigned int newHeight) { }
//! Window has lost/gained focus
- virtual void windowFocusChanged() { }
+ virtual void windowFocusChanged(bool bFocus) { }
static void moveWindow();
static void resizeWindow(unsigned int newWidth, unsigned int newHeight);
- static void changeWindowFocus();
+ static void changeWindowFocus(bool bFocus);
//! Static variable that holds the latest distributed information
static unsigned int windowWidth_s;
Modified: code/trunk/src/libraries/core/input/InputManager.cc
===================================================================
--- code/trunk/src/libraries/core/input/InputManager.cc 2011-02-12 20:10:41 UTC (rev 7873)
+++ code/trunk/src/libraries/core/input/InputManager.cc 2011-02-13 00:25:46 UTC (rev 7874)
@@ -495,7 +495,7 @@
}
//! Gets called by WindowEventListener upon focus change --> clear buffers
- void InputManager::windowFocusChanged()
+ void InputManager::windowFocusChanged(bool bFocus)
{
this->clearBuffers();
}
Modified: code/trunk/src/libraries/core/input/InputManager.h
===================================================================
--- code/trunk/src/libraries/core/input/InputManager.h 2011-02-12 20:10:41 UTC (rev 7873)
+++ code/trunk/src/libraries/core/input/InputManager.h 2011-02-13 00:25:46 UTC (rev 7874)
@@ -201,7 +201,7 @@
void updateActiveStates();
// From WindowEventListener
- void windowFocusChanged();
+ void windowFocusChanged(bool bFocus);
private: // variables
State internalState_; //!< Current internal state
More information about the Orxonox-commit
mailing list