Example #1
0
        static void ImGui_ImplGlfw_UpdateMouseCursor()
        {
            ImGuiIOPtr io = ImGui.GetIO();

            if ((io.ConfigFlags & ImGuiConfigFlags.NoMouseCursorChange) > 0 || Glfw.GetInputMode(windowHandle, InputMode.Cursor) == (int)CursorMode.Disabled)
            {
                return;
            }

            ImGuiMouseCursor imgui_cursor = ImGui.GetMouseCursor();

            if (imgui_cursor == ImGuiMouseCursor.None || io.MouseDrawCursor)
            {
                // Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
                Glfw.SetInputMode(windowHandle, InputMode.Cursor, (int)CursorMode.Hidden);
            }
            else
            {
                // Show OS mouse cursor
                // FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
                Glfw.SetCursor(windowHandle, mouseCursors[(int)imgui_cursor] != Cursor.None ? mouseCursors[(int)imgui_cursor] : mouseCursors[(int)ImGuiMouseCursor.Arrow]);
                Glfw.SetInputMode(windowHandle, InputMode.Cursor, (int)CursorMode.Normal);
            }
        }