IO: (BREAKING) moved io.PlatformLocaleDecimalPoint to platform_io.Platform_LocaleDecimalPoint. (#7389, #6719, #2278)
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index 85e3cb0..a061e71 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -42,8 +42,9 @@
Breaking changes:
- IO: moved some functions from ImGuiIO to ImGuiPlatformIO:
- - io.PlatformOpenInShellFn -> platform_io.Platform_OpenInShellFn. (#7660)
- - io.PlatformSetImeDataFn -> platform_io.Platform_SetImeDataFn.
+ - io.PlatformOpenInShellFn -> platform_io.Platform_OpenInShellFn. (#7660)
+ - io.PlatformSetImeDataFn -> platform_io.Platform_SetImeDataFn.
+ - io.PlatformLocaleDecimalPoint -> platform_io.Platform_LocaleDecimalPoint. (#7389, #6719, #2278)
- access those via GetPlatformIO() instead of GetIO().
(Because PlatformOpenInShellFn and PlatformSetImeDataFn were introduced very recently and
often automatically set by core library and backends, we are exceptionally not maintaining
diff --git a/imgui.cpp b/imgui.cpp
index e7615b1..deed853 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -431,8 +431,9 @@
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
- 2024/08/22 (1.91.1) - moved some functions from ImGuiIO to ImGuiPlatformIO structure:
- - io.PlatformOpenInShellFn -> platform_io.Platform_OpenInShellFn (#7660)
- - io.PlatformSetImeDataFn -> platform_io.Platform_SetImeDataFn
+ - io.PlatformOpenInShellFn -> platform_io.Platform_OpenInShellFn (#7660)
+ - io.PlatformSetImeDataFn -> platform_io.Platform_SetImeDataFn
+ - io.PlatformLocaleDecimalPoint -> platform_io.Platform_LocaleDecimalPoint (#7389, #6719, #2278)
- access those via GetPlatformIO() instead of GetIO().
some were introduced very recently and often automatically setup by core library and backends, so for those we are exceptionally not maintaining a legacy redirection symbol.
- 2024/07/25 (1.91.0) - obsoleted GetContentRegionMax(), GetWindowContentRegionMin() and GetWindowContentRegionMax(). (see #7838 on GitHub for more info)
@@ -1398,7 +1399,6 @@
// Note: Initialize() will setup default clipboard/ime handlers.
BackendPlatformName = BackendRendererName = NULL;
BackendPlatformUserData = BackendRendererUserData = BackendLanguageUserData = NULL;
- PlatformLocaleDecimalPoint = '.';
// Input (NB: we already have memset zero the entire structure!)
MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
@@ -1770,6 +1770,7 @@
{
// Most fields are initialized with zero
memset(this, 0, sizeof(*this));
+ Platform_LocaleDecimalPoint = '.';
}
//-----------------------------------------------------------------------------
diff --git a/imgui.h b/imgui.h
index 0400abd..a1ccfd7 100644
--- a/imgui.h
+++ b/imgui.h
@@ -2295,9 +2295,6 @@
void (*SetClipboardTextFn)(void* user_data, const char* text);
void* ClipboardUserData;
- // Optional: Platform locale
- ImWchar PlatformLocaleDecimalPoint; // '.' // [Experimental] Configure decimal point e.g. '.' or ',' useful for some languages (e.g. German), generally pulled from *localeconv()->decimal_point
-
//------------------------------------------------------------------
// Input - Call before calling NewFrame()
//------------------------------------------------------------------
@@ -3496,6 +3493,10 @@
void (*Platform_SetImeDataFn)(ImGuiContext* ctx, ImGuiViewport* viewport, ImGuiPlatformImeData* data);
void* Platform_ImeUserData;
//void (*SetPlatformImeDataFn)(ImGuiViewport* viewport, ImGuiPlatformImeData* data); // [Renamed to platform_io.PlatformSetImeDataFn in 1.91.1]
+
+ // Optional: Platform locale
+ // [Experimental] Configure decimal point e.g. '.' or ',' useful for some languages (e.g. German), generally pulled from *localeconv()->decimal_point
+ ImWchar Platform_LocaleDecimalPoint; // '.'
};
// (Optional) Support for IME (Input Method Editor) via the platform_io.Platform_SetImeDataFn() function.
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index f064a5d..f4625f2 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -4132,10 +4132,10 @@
// The standard mandate that programs starts in the "C" locale where the decimal point is '.'.
// We don't really intend to provide widespread support for it, but out of empathy for people stuck with using odd API, we support the bare minimum aka overriding the decimal point.
// Change the default decimal_point with:
- // ImGui::GetIO()->PlatformLocaleDecimalPoint = *localeconv()->decimal_point;
+ // ImGui::GetPlatformIO()->Platform_LocaleDecimalPoint = *localeconv()->decimal_point;
// Users of non-default decimal point (in particular ',') may be affected by word-selection logic (is_word_boundary_from_right/is_word_boundary_from_left) functions.
ImGuiContext& g = *ctx;
- const unsigned c_decimal_point = (unsigned int)g.IO.PlatformLocaleDecimalPoint;
+ const unsigned c_decimal_point = (unsigned int)g.PlatformIO.Platform_LocaleDecimalPoint;
if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsScientific | (ImGuiInputTextFlags)ImGuiInputTextFlags_LocalizeDecimalPoint))
if (c == '.' || c == ',')
c = c_decimal_point;