Backends: SDL2, SDL3: changed GetClipboardText() handler to return NULL on error aka clipboard contents is not text. (#9168)

Consistent with other backends.
This commit is contained in:
ocornut
2026-01-15 16:07:07 +01:00
parent 9a6eb0ab25
commit d7598aa84f
5 changed files with 15 additions and 4 deletions

View File

@@ -5091,10 +5091,11 @@ void ImGui::DebugAllocHook(ImGuiDebugAllocInfo* info, int frame_count, void* ptr
}
}
// A conformant backend should return NULL on failure (e.g. clipboard data is not text).
const char* ImGui::GetClipboardText()
{
ImGuiContext& g = *GImGui;
return g.PlatformIO.Platform_GetClipboardTextFn ? g.PlatformIO.Platform_GetClipboardTextFn(&g) : "";
return g.PlatformIO.Platform_GetClipboardTextFn ? g.PlatformIO.Platform_GetClipboardTextFn(&g) : NULL;
}
void ImGui::SetClipboardText(const char* text)