mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-27 16:29:02 +08:00
IO: (BREAKING) moved io.PlatformLocaleDecimalPoint to platform_io.Platform_LocaleDecimalPoint. (#7389, #6719, #2278)
This commit is contained in:
parent
9ff60ae31d
commit
e54f240ea0
@ -42,8 +42,9 @@ HOW TO UPDATE?
|
||||
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
|
||||
|
@ -431,8 +431,9 @@ CODE
|
||||
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 @@ ImGuiIO::ImGuiIO()
|
||||
// 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 @@ ImGuiPlatformIO::ImGuiPlatformIO()
|
||||
{
|
||||
// Most fields are initialized with zero
|
||||
memset(this, 0, sizeof(*this));
|
||||
Platform_LocaleDecimalPoint = '.';
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
7
imgui.h
7
imgui.h
@ -2295,9 +2295,6 @@ struct ImGuiIO
|
||||
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 @@ struct ImGuiPlatformIO
|
||||
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.
|
||||
|
@ -4132,10 +4132,10 @@ static bool InputTextFilterCharacter(ImGuiContext* ctx, unsigned int* p_char, Im
|
||||
// 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;
|
||||
|
Loading…
Reference in New Issue
Block a user