Skip to content

Commit

Permalink
Use SK_ImGui_LastKnownCursorPos instead of GetMessagePos
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaldaien committed Dec 27, 2024
1 parent f69d91d commit b674141
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions include/imgui/imgui_user.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1077,14 +1077,17 @@ ImGui_WndProcHandler ( HWND hWnd, UINT msg,
if ( LOWORD (lParam) == HTCLIENT ||
LOWORD (lParam) == HTTRANSPARENT )
{
static POINTS lastMouse =
static POINT lastMouse =
{ SHORT_MAX, SHORT_MAX };

#if 0
auto messagePos = GetMessagePos ();
auto messageTime = GetMessageTime ();

POINTS mousePos =
MAKEPOINTS (messagePos);
#else
extern POINT SK_ImGui_LastKnownCursorPos;
POINT mousePos = SK_ImGui_LastKnownCursorPos;
#endif

bool bRawCapture =
ImGui::GetIO ().WantCaptureMouse;
Expand All @@ -1094,6 +1097,8 @@ ImGui_WndProcHandler ( HWND hWnd, UINT msg,
mousePos.y != lastMouse.y ||
bRawCapture ) )
{
auto messageTime = GetMessageTime ();

static LONG lastTime = 0;
if (std::exchange (lastTime, messageTime) != messageTime || bRawCapture)
{
Expand Down

0 comments on commit b674141

Please sign in to comment.