Fix: Win32 no longer hides cursor when hovering title bar, keeping in line with behaviour of other platforms.

This commit is contained in:
Benjamin Porter 2019-03-17 15:51:06 +11:00
parent 4043f71156
commit 86672a3724

View File

@ -399,14 +399,8 @@ void WindowImplWin32::setVisible(bool visible)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplWin32::setMouseCursorVisible(bool visible) void WindowImplWin32::setMouseCursorVisible(bool visible)
{ {
// Don't call twice ShowCursor with the same parameter value; m_cursorVisible = visible;
// we don't want to increment/decrement the internal counter SetCursor(m_cursorVisible ? m_lastCursor : NULL);
// more than once.
if (visible != m_cursorVisible)
{
m_cursorVisible = visible;
ShowCursor(visible);
}
} }
@ -422,7 +416,7 @@ void WindowImplWin32::setMouseCursorGrabbed(bool grabbed)
void WindowImplWin32::setMouseCursor(const CursorImpl& cursor) void WindowImplWin32::setMouseCursor(const CursorImpl& cursor)
{ {
m_lastCursor = cursor.m_cursor; m_lastCursor = cursor.m_cursor;
SetCursor(m_lastCursor); SetCursor(m_cursorVisible ? m_lastCursor : NULL);
} }
@ -586,8 +580,9 @@ void WindowImplWin32::processEvent(UINT message, WPARAM wParam, LPARAM lParam)
case WM_SETCURSOR: case WM_SETCURSOR:
{ {
// The mouse has moved, if the cursor is in our window we must refresh the cursor // The mouse has moved, if the cursor is in our window we must refresh the cursor
if (LOWORD(lParam) == HTCLIENT) if (LOWORD(lParam) == HTCLIENT) {
SetCursor(m_lastCursor); SetCursor(m_cursorVisible ? m_lastCursor : NULL);
}
break; break;
} }