Should fix the cursor until we draw our own cursor.
parent
4f7e42a905
commit
b6eb929383
|
@ -121,12 +121,12 @@ bool Steam_Overlay::ShowOverlay() const
|
||||||
void Steam_Overlay::ShowOverlay(bool state)
|
void Steam_Overlay::ShowOverlay(bool state)
|
||||||
{
|
{
|
||||||
static RECT old_clip;
|
static RECT old_clip;
|
||||||
|
static BOOL show_cursor = FALSE;
|
||||||
|
|
||||||
if (!Ready() || show_overlay == state)
|
if (!Ready() || show_overlay == state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
show_overlay = state;
|
if (state)
|
||||||
if (show_overlay)
|
|
||||||
{
|
{
|
||||||
HWND game_hwnd = Windows_Hook::Inst()->GetGameHwnd();
|
HWND game_hwnd = Windows_Hook::Inst()->GetGameHwnd();
|
||||||
RECT cliRect, wndRect, clipRect;
|
RECT cliRect, wndRect, clipRect;
|
||||||
|
@ -154,13 +154,27 @@ void Steam_Overlay::ShowOverlay(bool state)
|
||||||
clipRect.bottom -= borderWidth;
|
clipRect.bottom -= borderWidth;
|
||||||
|
|
||||||
ClipCursor(&clipRect);
|
ClipCursor(&clipRect);
|
||||||
ImGui::GetIO().MouseDrawCursor = true;
|
|
||||||
|
CURSORINFO cinfo;
|
||||||
|
cinfo.cbSize = sizeof(cinfo);
|
||||||
|
GetCursorInfo(&cinfo);
|
||||||
|
show_cursor = cinfo.flags == CURSOR_SHOWING;
|
||||||
|
|
||||||
|
POINT pos;
|
||||||
|
pos.x = cliRect.right/2;
|
||||||
|
pos.y = cliRect.bottom/2;
|
||||||
|
ClientToScreen(game_hwnd, &pos);
|
||||||
|
SetCursorPos(pos.x, pos.y);
|
||||||
|
while (ShowCursor(TRUE) < 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClipCursor(&old_clip);
|
ClipCursor(&old_clip);
|
||||||
ImGui::GetIO().MouseDrawCursor = false;
|
if (!show_cursor)
|
||||||
|
while (ShowCursor(FALSE) >= 0);
|
||||||
}
|
}
|
||||||
|
show_overlay = state;
|
||||||
|
|
||||||
overlay_state_changed = true;
|
overlay_state_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue