|
|
|
@ -582,11 +582,10 @@ static ImGuiMouseSource GetMouseSourceFromMessageExtraInfo() |
|
|
|
|
IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
|
|
|
|
{ |
|
|
|
|
// Most backends don't have silent checks like this one, but we need it because WndProc are called early in CreateWindow().
|
|
|
|
|
if (ImGui::GetCurrentContext() == nullptr) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
// We silently allow both context or just only backend data to be nullptr.
|
|
|
|
|
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData(); |
|
|
|
|
IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplWin32_Init()?"); |
|
|
|
|
if (bd == nullptr) |
|
|
|
|
return 0; |
|
|
|
|
ImGuiIO& io = ImGui::GetIO(); |
|
|
|
|
|
|
|
|
|
switch (msg) |
|
|
|
@ -609,10 +608,10 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA |
|
|
|
|
} |
|
|
|
|
POINT mouse_pos = { (LONG)GET_X_LPARAM(lParam), (LONG)GET_Y_LPARAM(lParam) }; |
|
|
|
|
if (msg == WM_NCMOUSEMOVE && ::ScreenToClient(hwnd, &mouse_pos) == FALSE) // WM_NCMOUSEMOVE are provided in absolute coordinates.
|
|
|
|
|
break; |
|
|
|
|
return 0; |
|
|
|
|
io.AddMouseSourceEvent(mouse_source); |
|
|
|
|
io.AddMousePosEvent((float)mouse_pos.x, (float)mouse_pos.y); |
|
|
|
|
break; |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
case WM_MOUSELEAVE: |
|
|
|
|
case WM_NCMOUSELEAVE: |
|
|
|
@ -625,7 +624,7 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA |
|
|
|
|
bd->MouseTrackedArea = 0; |
|
|
|
|
io.AddMousePosEvent(-FLT_MAX, -FLT_MAX); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: |
|
|
|
|
case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: |
|
|
|
|