Hide the mouse cursor until it's used

pull/303/head
scrawl 7 years ago
parent 09e93319f5
commit fce9a14986

@ -180,6 +180,7 @@ namespace MWBase
virtual void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y) = 0;
virtual void setCursorVisible(bool visible) = 0;
virtual void setCursorActive(bool active) = 0;
virtual void getMousePosition(int &x, int &y) = 0;
virtual void getMousePosition(float &x, float &y) = 0;
virtual void setDragDrop(bool dragDrop) = 0;

@ -176,6 +176,7 @@ namespace MWGui
, mWerewolfOverlayEnabled(Settings::Manager::getBool ("werewolf overlay", "GUI"))
, mHudEnabled(true)
, mCursorVisible(true)
, mCursorActive(false)
, mPlayerName()
, mPlayerRaceId()
, mPlayerAttributes()
@ -1009,7 +1010,16 @@ namespace MWGui
void WindowManager::setCursorVisible(bool visible)
{
if (visible == mCursorVisible)
return;
mCursorVisible = visible;
if (!visible)
mCursorActive = false;
}
void WindowManager::setCursorActive(bool active)
{
mCursorActive = active;
}
void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result)
@ -1518,7 +1528,7 @@ namespace MWGui
bool WindowManager::getCursorVisible()
{
return mCursorVisible;
return mCursorVisible && mCursorActive;
}
void WindowManager::trackWindow(Layout *layout, const std::string &name)

@ -320,6 +320,9 @@ namespace MWGui
virtual bool getCursorVisible();
/// Call when mouse cursor or buttons are used.
virtual void setCursorActive(bool active);
/// Clear all savegame-specific data
virtual void clear();
@ -447,6 +450,7 @@ namespace MWGui
bool mWerewolfOverlayEnabled;
bool mHudEnabled;
bool mCursorVisible;
bool mCursorActive;
void setCursorVisible(bool visible);

@ -718,6 +718,7 @@ namespace MWInput
MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
}
}
MWBase::Environment::get().getWindowManager()->setCursorActive(true);
}
setPlayerControlsEnabled(!guiMode);
@ -764,6 +765,8 @@ namespace MWInput
MyGUI::InputManager::getInstance().injectMouseMove( int(mGuiCursorX), int(mGuiCursorY), mMouseWheel);
// FIXME: inject twice to force updating focused widget states (tooltips) resulting from changing the viewport by scroll wheel
MyGUI::InputManager::getInstance().injectMouseMove( int(mGuiCursorX), int(mGuiCursorY), mMouseWheel);
MWBase::Environment::get().getWindowManager()->setCursorActive(true);
}
if (mMouseLookEnabled && !mControlsDisabled)

Loading…
Cancel
Save