|
@@ -10,6 +10,7 @@
|
|
|
|
|
|
// CHANGELOG
|
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
|
+// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoSetMouseCursor flag.
|
|
|
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling).
|
|
|
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX11_RenderDrawData() in the .h file so you can call it yourself.
|
|
|
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
|
@@ -250,9 +251,12 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
|
|
|
ctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();
|
|
|
}
|
|
|
|
|
|
-static void ImGui_ImplWin32_UpdateMouseCursor()
|
|
|
+static bool ImGui_ImplWin32_UpdateMouseCursor()
|
|
|
{
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
+ if (io.ConfigFlags & ImGuiConfigFlags_NoSetMouseCursor)
|
|
|
+ return false;
|
|
|
+
|
|
|
ImGuiMouseCursor imgui_cursor = io.MouseDrawCursor ? ImGuiMouseCursor_None : ImGui::GetMouseCursor();
|
|
|
if (imgui_cursor == ImGuiMouseCursor_None)
|
|
|
{
|
|
@@ -275,6 +279,7 @@ static void ImGui_ImplWin32_UpdateMouseCursor()
|
|
|
}
|
|
|
::SetCursor(::LoadCursor(NULL, win32_cursor));
|
|
|
}
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
// Process Win32 mouse/keyboard inputs.
|
|
@@ -344,11 +349,8 @@ IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wPa
|
|
|
io.AddInputCharacter((unsigned short)wParam);
|
|
|
return 0;
|
|
|
case WM_SETCURSOR:
|
|
|
- if (LOWORD(lParam) == HTCLIENT)
|
|
|
- {
|
|
|
- ImGui_ImplWin32_UpdateMouseCursor();
|
|
|
+ if (LOWORD(lParam) == HTCLIENT && ImGui_ImplWin32_UpdateMouseCursor())
|
|
|
return 1;
|
|
|
- }
|
|
|
return 0;
|
|
|
}
|
|
|
return 0;
|
|
@@ -586,8 +588,13 @@ bool ImGui_ImplDX11_Init(void* hwnd, ID3D11Device* device, ID3D11DeviceContex
|
|
|
if (!QueryPerformanceCounter((LARGE_INTEGER *)&g_Time))
|
|
|
return false;
|
|
|
|
|
|
+ // Setup back-end capabilities flags
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
- io.KeyMap[ImGuiKey_Tab] = VK_TAB; // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array that we will update during the application lifetime.
|
|
|
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
|
|
+ io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
|
|
+
|
|
|
+ // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array that we will update during the application lifetime.
|
|
|
+ io.KeyMap[ImGuiKey_Tab] = VK_TAB;
|
|
|
io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
|
|
|
io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
|
|
|
io.KeyMap[ImGuiKey_UpArrow] = VK_UP;
|