Force windows cursor to show or hide based on cursor hidden value

This commit is contained in:
Chandler Cox
2024-05-01 13:23:56 -05:00
parent c59bce3b58
commit c1e3eaeab1
2 changed files with 13 additions and 2 deletions

View File

@@ -770,14 +770,24 @@ void WindowsWindow::CheckForWindowResize()
}
}
void WindowsWindow::UpdateCursor() const
void WindowsWindow::UpdateCursor()
{
// Don't hide cursor when window is not focused
if (_cursor == CursorType::Hidden && _focused)
{
if (!_lastCursorHidden)
{
_lastCursorHidden = true;
::ShowCursor(FALSE);
}
::SetCursor(nullptr);
return;
}
else if (_lastCursorHidden)
{
_lastCursorHidden = false;
::ShowCursor(TRUE);
}
int32 index = 0;
switch (_cursor)

View File

@@ -28,6 +28,7 @@ private:
bool _isSwitchingFullScreen = false;
bool _trackingMouse = false;
bool _clipCursorSet = false;
bool _lastCursorHidden = false;
bool _isDuringMaximize = false;
Windows::HANDLE _monitor = nullptr;
Windows::LONG _clipCursorRect[4];
@@ -90,7 +91,7 @@ public:
private:
void CheckForWindowResize();
void UpdateCursor() const;
void UpdateCursor();
void UpdateRegion();
public: