|
@@ -3702,7 +3702,8 @@ void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFl
|
|
|
void ImGui::RenderMouseCursor(ImVec2 base_pos, float base_scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
- IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT);
|
|
|
+ if (mouse_cursor <= ImGuiMouseCursor_None || mouse_cursor >= ImGuiMouseCursor_COUNT) // We intentionally accept out of bound values.
|
|
|
+ mouse_cursor = ImGuiMouseCursor_Arrow;
|
|
|
ImFontAtlas* font_atlas = g.DrawListSharedData.Font->ContainerAtlas;
|
|
|
for (ImGuiViewportP* viewport : g.Viewports)
|
|
|
{
|
|
@@ -6198,7 +6199,7 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& si
|
|
|
ButtonBehavior(resize_rect, resize_grip_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus);
|
|
|
//GetForegroundDrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255));
|
|
|
if (hovered || held)
|
|
|
- g.MouseCursor = (resize_grip_n & 1) ? ImGuiMouseCursor_ResizeNESW : ImGuiMouseCursor_ResizeNWSE;
|
|
|
+ SetMouseCursor((resize_grip_n & 1) ? ImGuiMouseCursor_ResizeNESW : ImGuiMouseCursor_ResizeNWSE);
|
|
|
|
|
|
if (held && g.IO.MouseDoubleClicked[0])
|
|
|
{
|
|
@@ -6244,7 +6245,7 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& si
|
|
|
if (hovered && g.HoveredIdTimer <= WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER)
|
|
|
hovered = false;
|
|
|
if (hovered || held)
|
|
|
- g.MouseCursor = (axis == ImGuiAxis_X) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS;
|
|
|
+ SetMouseCursor((axis == ImGuiAxis_X) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS);
|
|
|
if (held && g.IO.MouseDoubleClicked[0])
|
|
|
{
|
|
|
// Double-clicking bottom or right border auto-fit on this axis
|
|
@@ -9296,6 +9297,9 @@ ImGuiMouseCursor ImGui::GetMouseCursor()
|
|
|
return g.MouseCursor;
|
|
|
}
|
|
|
|
|
|
+// We intentionally accept values of ImGuiMouseCursor that are outside our bounds, in case users needs to hack-in a custom cursor value.
|
|
|
+// Custom cursors may be handled by custom backends. If you are using a standard backend and want to hack in a custom cursor, you may
|
|
|
+// handle it before the backend _NewFrame() call and temporarily set ImGuiConfigFlags_NoMouseCursorChange during the backend _NewFrame() call.
|
|
|
void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|