Commit c4f0e9b5 authored by cutealien's avatar cutealien

Make sure setVisible for Windows cursor also works while mousebutton is pressed.

As reported in http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=25880&highlight=


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2400 dfc29bdd-3216-0410-991c-e03cc46cb475
parent cc4ff80f
...@@ -177,16 +177,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -177,16 +177,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_ERASEBKGND: case WM_ERASEBKGND:
return 0; return 0;
case WM_SETCURSOR:
{
SEnvMapper* envm = getEnvMapperFromHWnd(hWnd);
if (envm && !envm->irrDev->getWin32CursorControl()->isVisible())
{
SetCursor(NULL);
return 0;
}
} break;
case WM_KEYDOWN: case WM_KEYDOWN:
case WM_KEYUP: case WM_KEYUP:
{ {
......
...@@ -106,13 +106,34 @@ namespace irr ...@@ -106,13 +106,34 @@ namespace irr
//! Changes the visible state of the mouse cursor. //! Changes the visible state of the mouse cursor.
virtual void setVisible(bool visible) virtual void setVisible(bool visible)
{ {
if(visible != IsVisible) CURSORINFO info;
info.cbSize = sizeof(CURSORINFO);
if ( visible )
{ {
IsVisible = visible; while ( GetCursorInfo(&info) )
updateInternalCursorPosition(); {
setPosition(CursorPos.X, CursorPos.Y); if ( info.flags == CURSOR_SHOWING )
{
IsVisible = visible;
break;
}
ShowCursor(true); // this only increases an internal display counter in windows, so it might have to be called some more
}
} }
} else
{
while ( GetCursorInfo(&info) )
{
if ( info.flags == 0 ) // cursor hidden
{
IsVisible = visible;
break;
}
ShowCursor(false); // this only decreases an internal display counter in windows, so it might have to be called some more
}
}
}
//! Returns if the cursor is currently visible. //! Returns if the cursor is currently visible.
virtual bool isVisible() const virtual bool isVisible() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment