mirror of
https://github.com/ocornut/imgui.git
synced 2025-02-02 12:37:20 +01:00
Backends: Allegro5: Avoid calling al_set_mouse_cursor() repeatedly since it appears to leak on on X11 (#8256).
This commit is contained in:
parent
87f3109c1a
commit
2d2c7d3f95
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2025-01-06: Avoid calling al_set_mouse_cursor() repeatedly since it appears to leak on on X11 (#8256).
|
||||||
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
|
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
|
||||||
// - io.GetClipboardTextFn -> platform_io.Platform_GetClipboardTextFn
|
// - io.GetClipboardTextFn -> platform_io.Platform_GetClipboardTextFn
|
||||||
// - io.SetClipboardTextFn -> platform_io.Platform_SetClipboardTextFn
|
// - io.SetClipboardTextFn -> platform_io.Platform_SetClipboardTextFn
|
||||||
@ -95,6 +96,7 @@ struct ImGui_ImplAllegro5_Data
|
|||||||
ALLEGRO_MOUSE_CURSOR* MouseCursorInvisible;
|
ALLEGRO_MOUSE_CURSOR* MouseCursorInvisible;
|
||||||
ALLEGRO_VERTEX_DECL* VertexDecl;
|
ALLEGRO_VERTEX_DECL* VertexDecl;
|
||||||
char* ClipboardTextData;
|
char* ClipboardTextData;
|
||||||
|
ImGuiMouseCursor LastCursor;
|
||||||
|
|
||||||
ImVector<ImDrawVertAllegro> BufVertices;
|
ImVector<ImDrawVertAllegro> BufVertices;
|
||||||
ImVector<int> BufIndices;
|
ImVector<int> BufIndices;
|
||||||
@ -438,6 +440,7 @@ bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display)
|
|||||||
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
||||||
|
|
||||||
bd->Display = display;
|
bd->Display = display;
|
||||||
|
bd->LastCursor = ALLEGRO_SYSTEM_MOUSE_CURSOR_NONE;
|
||||||
|
|
||||||
// Create custom vertex declaration.
|
// Create custom vertex declaration.
|
||||||
// Unfortunately Allegro doesn't support 32-bit packed colors so we have to convert them to 4 floats.
|
// Unfortunately Allegro doesn't support 32-bit packed colors so we have to convert them to 4 floats.
|
||||||
@ -568,9 +571,16 @@ static void ImGui_ImplAllegro5_UpdateMouseCursor()
|
|||||||
|
|
||||||
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
|
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
|
||||||
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
|
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
|
||||||
if (io.MouseDrawCursor || imgui_cursor == ImGuiMouseCursor_None)
|
|
||||||
|
// Hide OS mouse cursor if imgui is drawing it
|
||||||
|
if (io.MouseDrawCursor)
|
||||||
|
imgui_cursor = ImGuiMouseCursor_None;
|
||||||
|
|
||||||
|
if (bd->LastCursor == imgui_cursor)
|
||||||
|
return;
|
||||||
|
bd->LastCursor = imgui_cursor;
|
||||||
|
if (imgui_cursor == ImGuiMouseCursor_None)
|
||||||
{
|
{
|
||||||
// Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
|
|
||||||
al_set_mouse_cursor(bd->Display, bd->MouseCursorInvisible);
|
al_set_mouse_cursor(bd->Display, bd->MouseCursorInvisible);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -60,6 +60,8 @@ Other changes:
|
|||||||
windows with the ImGuiWindowFlags_NoNavInputs flag. (#8231)
|
windows with the ImGuiWindowFlags_NoNavInputs flag. (#8231)
|
||||||
- Debug Tools: Debug Log: hovering 0xXXXXXXXX values in log is allowed even
|
- Debug Tools: Debug Log: hovering 0xXXXXXXXX values in log is allowed even
|
||||||
if a popup is blocking mouse access to the debug log window. (#5855)
|
if a popup is blocking mouse access to the debug log window. (#5855)
|
||||||
|
- Backends: Allegro5: Avoid calling al_set_mouse_cursor() repeatedly since it appears
|
||||||
|
to leak on on X11 (#8256). [@Helodity]
|
||||||
- Backends: Vulkan: Fixed setting VkSwapchainCreateInfoKHR::preTransform for
|
- Backends: Vulkan: Fixed setting VkSwapchainCreateInfoKHR::preTransform for
|
||||||
platforms not supporting VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR. (#8222) [@Zer0xFF]
|
platforms not supporting VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR. (#8222) [@Zer0xFF]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user