Skip to content

Commit 75c3793

Browse files
committed
IO: Added ImGuiConfigFlags_NoSetMouseCursors. Added ImGuiBackendFlags_HasMouseCursors, ImGuiBackendFlags_HasSetMousePos. (#787, #1495, #1202)
1 parent dcf7c3d commit 75c3793

File tree

13 files changed

+146
-72
lines changed

13 files changed

+146
-72
lines changed

CHANGELOG.txt

+3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ Other Changes:
9191
- Context: Removed allocator parameters from CreateContext(), they are now setup with SetAllocatorFunctions() and shared by all contexts. (#1565, #586, #992, #1007, #1558)
9292
- Context: You may pass a ImFontAtlas to CreateContext() to specify a font atlas to share. Shared font atlas are not owned by the context and not destroyed along with it.
9393
- Context: Added IMGUI_DISABLE_DEFAULT_ALLOCATORS to disable linking with malloc/free. (#1565, #586, #992, #1007, #1558)
94+
- IO: Added io.ConfigFlags for user application to store settings for imgui and for the back-end (currently: _NavEnableKeyboard, _NavEnableGamepad, _NavEnableSetMousePos, _NoSetMouseCursor).
95+
- IO: Added io.BackendFlags for back-end to store its capabilities (currently: _HasGamepad, _HasMouseCursors, _HasSetMousePos). This will be used more in the next version.
9496
- IO: Added ImGuiKey_Insert, ImGuiKey_Space keys. Setup in all example bindings. (#1541)
9597
- IO: Added Horizontal Mouse Wheel support for horizontal scrolling. (#1463) [@tseeker]
9698
- IO: Added IsAnyMouseDown() helper which is helpful for bindings to handle mouse capturing.
@@ -159,6 +161,7 @@ Other Changes:
159161
- Examples: Files in examples/ now include their own changelog so it is easier to occasionally update your bindings if needed.
160162
- Examples: Using Dark theme by default. (#707). Tweaked demo code.
161163
- Examples: Added support for horizontal mouse wheel for API that allows it. (#1463) [@tseeker]
164+
- Examples: All examples now setup the io.BackendFlags to signify they can honor mouse cursors, gamepad, etc.
162165
- Examples: DirectX12: Added DirectX 12 example. (#301) [@jdm3]
163166
- Examples: OpenGL3+GLFW,SDL: Changed GLSL shader version from 330 to 150. (#1466, #1504)
164167
- Examples: OpenGL3+GLFW,SDL: Added a way to override the GLSL version string in the Init function. (#1466, #1504).

examples/directx10_example/imgui_impl_dx10.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// CHANGELOG
1212
// (minor and older changes stripped away, please see git history for details)
13+
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoSetMouseCursor flag.
1314
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling).
1415
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX10_RenderDrawData() in the .h file so you can call it yourself.
1516
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
@@ -243,9 +244,12 @@ void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data)
243244
ctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();
244245
}
245246

246-
static void ImGui_ImplWin32_UpdateMouseCursor()
247+
static bool ImGui_ImplWin32_UpdateMouseCursor()
247248
{
248249
ImGuiIO& io = ImGui::GetIO();
250+
if (io.ConfigFlags & ImGuiConfigFlags_NoSetMouseCursor)
251+
return false;
252+
249253
ImGuiMouseCursor imgui_cursor = io.MouseDrawCursor ? ImGuiMouseCursor_None : ImGui::GetMouseCursor();
250254
if (imgui_cursor == ImGuiMouseCursor_None)
251255
{
@@ -268,6 +272,7 @@ static void ImGui_ImplWin32_UpdateMouseCursor()
268272
}
269273
::SetCursor(::LoadCursor(NULL, win32_cursor));
270274
}
275+
return true;
271276
}
272277

273278
// Process Win32 mouse/keyboard inputs.
@@ -337,11 +342,8 @@ IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wPa
337342
io.AddInputCharacter((unsigned short)wParam);
338343
return 0;
339344
case WM_SETCURSOR:
340-
if (LOWORD(lParam) == HTCLIENT)
341-
{
342-
ImGui_ImplWin32_UpdateMouseCursor();
345+
if (LOWORD(lParam) == HTCLIENT && ImGui_ImplWin32_UpdateMouseCursor())
343346
return 1;
344-
}
345347
return 0;
346348
}
347349
return 0;
@@ -584,8 +586,13 @@ bool ImGui_ImplDX10_Init(void* hwnd, ID3D10Device* device)
584586
if (!QueryPerformanceCounter((LARGE_INTEGER *)&g_Time))
585587
return false;
586588

589+
// Setup back-end capabilities flags
587590
ImGuiIO& io = ImGui::GetIO();
588-
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.
591+
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values
592+
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
593+
594+
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array that we will update during the application lifetime.
595+
io.KeyMap[ImGuiKey_Tab] = VK_TAB;
589596
io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
590597
io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
591598
io.KeyMap[ImGuiKey_UpArrow] = VK_UP;

examples/directx11_example/imgui_impl_dx11.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// CHANGELOG
1212
// (minor and older changes stripped away, please see git history for details)
13+
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoSetMouseCursor flag.
1314
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling).
1415
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX11_RenderDrawData() in the .h file so you can call it yourself.
1516
// 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)
250251
ctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();
251252
}
252253

253-
static void ImGui_ImplWin32_UpdateMouseCursor()
254+
static bool ImGui_ImplWin32_UpdateMouseCursor()
254255
{
255256
ImGuiIO& io = ImGui::GetIO();
257+
if (io.ConfigFlags & ImGuiConfigFlags_NoSetMouseCursor)
258+
return false;
259+
256260
ImGuiMouseCursor imgui_cursor = io.MouseDrawCursor ? ImGuiMouseCursor_None : ImGui::GetMouseCursor();
257261
if (imgui_cursor == ImGuiMouseCursor_None)
258262
{
@@ -275,6 +279,7 @@ static void ImGui_ImplWin32_UpdateMouseCursor()
275279
}
276280
::SetCursor(::LoadCursor(NULL, win32_cursor));
277281
}
282+
return true;
278283
}
279284

280285
// Process Win32 mouse/keyboard inputs.
@@ -344,11 +349,8 @@ IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wPa
344349
io.AddInputCharacter((unsigned short)wParam);
345350
return 0;
346351
case WM_SETCURSOR:
347-
if (LOWORD(lParam) == HTCLIENT)
348-
{
349-
ImGui_ImplWin32_UpdateMouseCursor();
352+
if (LOWORD(lParam) == HTCLIENT && ImGui_ImplWin32_UpdateMouseCursor())
350353
return 1;
351-
}
352354
return 0;
353355
}
354356
return 0;
@@ -586,8 +588,13 @@ bool ImGui_ImplDX11_Init(void* hwnd, ID3D11Device* device, ID3D11DeviceContex
586588
if (!QueryPerformanceCounter((LARGE_INTEGER *)&g_Time))
587589
return false;
588590

591+
// Setup back-end capabilities flags
589592
ImGuiIO& io = ImGui::GetIO();
590-
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.
593+
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
594+
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
595+
596+
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array that we will update during the application lifetime.
597+
io.KeyMap[ImGuiKey_Tab] = VK_TAB;
591598
io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
592599
io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
593600
io.KeyMap[ImGuiKey_UpArrow] = VK_UP;

examples/directx12_example/imgui_impl_dx12.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
// CHANGELOG
1313
// (minor and older changes stripped away, please see git history for details)
14+
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoSetMouseCursor flag.
1415
// 2018-02-22: Merged into master with all Win32 code synchronized to other examples.
1516

1617
#include "imgui.h"
@@ -221,9 +222,12 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data)
221222
}
222223
}
223224

224-
static void ImGui_ImplWin32_UpdateMouseCursor()
225+
static bool ImGui_ImplWin32_UpdateMouseCursor()
225226
{
226227
ImGuiIO& io = ImGui::GetIO();
228+
if (io.ConfigFlags & ImGuiConfigFlags_NoSetMouseCursor)
229+
return false;
230+
227231
ImGuiMouseCursor imgui_cursor = io.MouseDrawCursor ? ImGuiMouseCursor_None : ImGui::GetMouseCursor();
228232
if (imgui_cursor == ImGuiMouseCursor_None)
229233
{
@@ -246,6 +250,7 @@ static void ImGui_ImplWin32_UpdateMouseCursor()
246250
}
247251
::SetCursor(::LoadCursor(NULL, win32_cursor));
248252
}
253+
return true;
249254
}
250255

251256
// Process Win32 mouse/keyboard inputs.
@@ -315,11 +320,8 @@ IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wPa
315320
io.AddInputCharacter((unsigned short)wParam);
316321
return 0;
317322
case WM_SETCURSOR:
318-
if (LOWORD(lParam) == HTCLIENT)
319-
{
320-
ImGui_ImplWin32_UpdateMouseCursor();
323+
if (LOWORD(lParam) == HTCLIENT && ImGui_ImplWin32_UpdateMouseCursor())
321324
return 1;
322-
}
323325
return 0;
324326
}
325327
return 0;
@@ -718,8 +720,13 @@ bool ImGui_ImplDX12_Init(void* hwnd, int num_frames_in_flight,
718720
if (!QueryPerformanceCounter((LARGE_INTEGER *)&g_Time))
719721
return false;
720722

723+
// Setup back-end capabilities flags
721724
ImGuiIO& io = ImGui::GetIO();
722-
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.
725+
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
726+
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
727+
728+
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array that we will update during the application lifetime.
729+
io.KeyMap[ImGuiKey_Tab] = VK_TAB;
723730
io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
724731
io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
725732
io.KeyMap[ImGuiKey_UpArrow] = VK_UP;

examples/directx9_example/imgui_impl_dx9.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// CHANGELOG
1212
// (minor and older changes stripped away, please see git history for details)
13+
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoSetMouseCursor flag.
1314
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling).
1415
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX9_RenderDrawData() in the .h file so you can call it yourself.
1516
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
@@ -183,9 +184,12 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
183184
d3d9_state_block->Release();
184185
}
185186

186-
static void ImGui_ImplWin32_UpdateMouseCursor()
187+
static bool ImGui_ImplWin32_UpdateMouseCursor()
187188
{
188189
ImGuiIO& io = ImGui::GetIO();
190+
if (io.ConfigFlags & ImGuiConfigFlags_NoSetMouseCursor)
191+
return false;
192+
189193
ImGuiMouseCursor imgui_cursor = io.MouseDrawCursor ? ImGuiMouseCursor_None : ImGui::GetMouseCursor();
190194
if (imgui_cursor == ImGuiMouseCursor_None)
191195
{
@@ -208,6 +212,7 @@ static void ImGui_ImplWin32_UpdateMouseCursor()
208212
}
209213
::SetCursor(::LoadCursor(NULL, win32_cursor));
210214
}
215+
return true;
211216
}
212217

213218
// Process Win32 mouse/keyboard inputs.
@@ -277,11 +282,8 @@ IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wPa
277282
io.AddInputCharacter((unsigned short)wParam);
278283
return 0;
279284
case WM_SETCURSOR:
280-
if (LOWORD(lParam) == HTCLIENT)
281-
{
282-
ImGui_ImplWin32_UpdateMouseCursor();
285+
if (LOWORD(lParam) == HTCLIENT && ImGui_ImplWin32_UpdateMouseCursor())
283286
return 1;
284-
}
285287
return 0;
286288
}
287289
return 0;
@@ -297,8 +299,13 @@ bool ImGui_ImplDX9_Init(void* hwnd, IDirect3DDevice9* device)
297299
if (!QueryPerformanceCounter((LARGE_INTEGER *)&g_Time))
298300
return false;
299301

302+
// Setup back-end capabilities flags
300303
ImGuiIO& io = ImGui::GetIO();
301-
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.
304+
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
305+
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
306+
307+
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array that we will update during the application lifetime.
308+
io.KeyMap[ImGuiKey_Tab] = VK_TAB;
302309
io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
303310
io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
304311
io.KeyMap[ImGuiKey_UpArrow] = VK_UP;

examples/opengl2_example/imgui_impl_glfw_gl2.cpp

+18-9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
// CHANGELOG
2121
// (minor and older changes stripped away, please see git history for details)
22+
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoSetMouseCursor flag.
2223
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling).
2324
// 2018-02-20: Inputs: Renamed GLFW callbacks exposed in .h to not include GL2 in their name.
2425
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplGlfwGL2_RenderDrawData() in the .h file so you can call it yourself.
@@ -233,8 +234,13 @@ bool ImGui_ImplGlfwGL2_Init(GLFWwindow* window, bool install_callbacks)
233234
{
234235
g_Window = window;
235236

237+
// Setup back-end capabilities flags
236238
ImGuiIO& io = ImGui::GetIO();
237-
io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB; // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
239+
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
240+
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
241+
242+
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
243+
io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB;
238244
io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT;
239245
io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT;
240246
io.KeyMap[ImGuiKey_UpArrow] = GLFW_KEY_UP;
@@ -339,15 +345,18 @@ void ImGui_ImplGlfwGL2_NewFrame()
339345
}
340346

341347
// Update OS/hardware mouse cursor if imgui isn't drawing a software cursor
342-
ImGuiMouseCursor cursor = ImGui::GetMouseCursor();
343-
if (io.MouseDrawCursor || cursor == ImGuiMouseCursor_None)
348+
if ((io.ConfigFlags & ImGuiConfigFlags_NoSetMouseCursor) == 0)
344349
{
345-
glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
346-
}
347-
else
348-
{
349-
glfwSetCursor(g_Window, g_MouseCursors[cursor] ? g_MouseCursors[cursor] : g_MouseCursors[ImGuiMouseCursor_Arrow]);
350-
glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
350+
ImGuiMouseCursor cursor = ImGui::GetMouseCursor();
351+
if (io.MouseDrawCursor || cursor == ImGuiMouseCursor_None)
352+
{
353+
glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
354+
}
355+
else
356+
{
357+
glfwSetCursor(g_Window, g_MouseCursors[cursor] ? g_MouseCursors[cursor] : g_MouseCursors[ImGuiMouseCursor_Arrow]);
358+
glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
359+
}
351360
}
352361

353362
// Start the frame. This call will update the io.WantCaptureMouse, io.WantCaptureKeyboard flag that you can use to dispatch inputs (or not) to your application.

examples/opengl3_example/imgui_impl_glfw_gl3.cpp

+17-9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
// CHANGELOG
1515
// (minor and older changes stripped away, please see git history for details)
16+
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoSetMouseCursor flag.
1617
// 2018-03-06: OpenGL: Added const char* glsl_version parameter to ImGui_ImplGlfwGL3_Init() so user can override the GLSL version e.g. "#version 150".
1718
// 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context.
1819
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling).
@@ -365,8 +366,12 @@ bool ImGui_ImplGlfwGL3_Init(GLFWwindow* window, bool install_callbacks, const
365366
strcpy(g_GlslVersion, glsl_version);
366367
strcat(g_GlslVersion, "\n");
367368

368-
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
369+
// Setup back-end capabilities flags
369370
ImGuiIO& io = ImGui::GetIO();
371+
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
372+
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
373+
374+
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
370375
io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB;
371376
io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT;
372377
io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT;
@@ -472,15 +477,18 @@ void ImGui_ImplGlfwGL3_NewFrame()
472477
}
473478

474479
// Update OS/hardware mouse cursor if imgui isn't drawing a software cursor
475-
ImGuiMouseCursor cursor = ImGui::GetMouseCursor();
476-
if (io.MouseDrawCursor || cursor == ImGuiMouseCursor_None)
477-
{
478-
glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
479-
}
480-
else
480+
if ((io.ConfigFlags & ImGuiConfigFlags_NoSetMouseCursor) == 0)
481481
{
482-
glfwSetCursor(g_Window, g_MouseCursors[cursor] ? g_MouseCursors[cursor] : g_MouseCursors[ImGuiMouseCursor_Arrow]);
483-
glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
482+
ImGuiMouseCursor cursor = ImGui::GetMouseCursor();
483+
if (io.MouseDrawCursor || cursor == ImGuiMouseCursor_None)
484+
{
485+
glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
486+
}
487+
else
488+
{
489+
glfwSetCursor(g_Window, g_MouseCursors[cursor] ? g_MouseCursors[cursor] : g_MouseCursors[ImGuiMouseCursor_Arrow]);
490+
glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
491+
}
484492
}
485493

486494
// Gamepad navigation mapping [BETA]

0 commit comments

Comments
 (0)