Force windows cursor to show or hide based on cursor hidden value
This commit is contained in:
@@ -770,14 +770,24 @@ void WindowsWindow::CheckForWindowResize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowsWindow::UpdateCursor() const
|
void WindowsWindow::UpdateCursor()
|
||||||
{
|
{
|
||||||
// Don't hide cursor when window is not focused
|
// Don't hide cursor when window is not focused
|
||||||
if (_cursor == CursorType::Hidden && _focused)
|
if (_cursor == CursorType::Hidden && _focused)
|
||||||
{
|
{
|
||||||
|
if (!_lastCursorHidden)
|
||||||
|
{
|
||||||
|
_lastCursorHidden = true;
|
||||||
|
::ShowCursor(FALSE);
|
||||||
|
}
|
||||||
::SetCursor(nullptr);
|
::SetCursor(nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (_lastCursorHidden)
|
||||||
|
{
|
||||||
|
_lastCursorHidden = false;
|
||||||
|
::ShowCursor(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
switch (_cursor)
|
switch (_cursor)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ private:
|
|||||||
bool _isSwitchingFullScreen = false;
|
bool _isSwitchingFullScreen = false;
|
||||||
bool _trackingMouse = false;
|
bool _trackingMouse = false;
|
||||||
bool _clipCursorSet = false;
|
bool _clipCursorSet = false;
|
||||||
|
bool _lastCursorHidden = false;
|
||||||
bool _isDuringMaximize = false;
|
bool _isDuringMaximize = false;
|
||||||
Windows::HANDLE _monitor = nullptr;
|
Windows::HANDLE _monitor = nullptr;
|
||||||
Windows::LONG _clipCursorRect[4];
|
Windows::LONG _clipCursorRect[4];
|
||||||
@@ -90,7 +91,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
void CheckForWindowResize();
|
void CheckForWindowResize();
|
||||||
void UpdateCursor() const;
|
void UpdateCursor();
|
||||||
void UpdateRegion();
|
void UpdateRegion();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user