mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Amend 13f718337
This commit is contained in:
parent
a1a7a1bc03
commit
ba1fa904a9
@ -56,6 +56,9 @@ Other changes:
|
|||||||
of individual ImDrawList's buffer sizes when a dimming/modal background is rendered. (#6716)
|
of individual ImDrawList's buffer sizes when a dimming/modal background is rendered. (#6716)
|
||||||
- ImDrawList: Fixed OOB access in _CalcCircleAutoSegmentCount when passing excessively
|
- ImDrawList: Fixed OOB access in _CalcCircleAutoSegmentCount when passing excessively
|
||||||
large radius to AddCircle(). (#6657, #5317) [@EggsyCRO, @jdpatdiscord]
|
large radius to AddCircle(). (#6657, #5317) [@EggsyCRO, @jdpatdiscord]
|
||||||
|
- IO: Exposed io.PlatformLocaleDecimalPoint to configure decimal point ('.' or ',') for
|
||||||
|
languages needing it. Should ideally be set to the value of '*localeconv()->decimal_point'
|
||||||
|
but our backends don't do it yet. (#6719, #2278)
|
||||||
- IO: Fixed io.AddMousePosEvent() and io.AddMouseButtonEvent() writing MouseSource to
|
- IO: Fixed io.AddMousePosEvent() and io.AddMouseButtonEvent() writing MouseSource to
|
||||||
wrong union section. Was semantically incorrect and accidentally had no side-effects
|
wrong union section. Was semantically incorrect and accidentally had no side-effects
|
||||||
with default compiler alignment settings. (#6727) [@RickHuang2001]
|
with default compiler alignment settings. (#6727) [@RickHuang2001]
|
||||||
|
@ -1286,6 +1286,7 @@ ImGuiIO::ImGuiIO()
|
|||||||
// Note: Initialize() will setup default clipboard/ime handlers.
|
// Note: Initialize() will setup default clipboard/ime handlers.
|
||||||
BackendPlatformName = BackendRendererName = NULL;
|
BackendPlatformName = BackendRendererName = NULL;
|
||||||
BackendPlatformUserData = BackendRendererUserData = BackendLanguageUserData = NULL;
|
BackendPlatformUserData = BackendRendererUserData = BackendLanguageUserData = NULL;
|
||||||
|
PlatformLocaleDecimalPoint = '.';
|
||||||
|
|
||||||
// Input (NB: we already have memset zero the entire structure!)
|
// Input (NB: we already have memset zero the entire structure!)
|
||||||
MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
||||||
|
3
imgui.h
3
imgui.h
@ -2044,6 +2044,9 @@ struct ImGuiIO
|
|||||||
void* _UnusedPadding; // Unused field to keep data structure the same size.
|
void* _UnusedPadding; // Unused field to keep data structure the same size.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// 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()
|
// Input - Call before calling NewFrame()
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
@ -2021,7 +2021,6 @@ struct ImGuiContext
|
|||||||
// Platform support
|
// Platform support
|
||||||
ImGuiPlatformImeData PlatformImeData; // Data updated by current frame
|
ImGuiPlatformImeData PlatformImeData; // Data updated by current frame
|
||||||
ImGuiPlatformImeData PlatformImeDataPrev; // Previous frame data (when changing we will call io.SetPlatformImeDataFn
|
ImGuiPlatformImeData PlatformImeDataPrev; // Previous frame data (when changing we will call io.SetPlatformImeDataFn
|
||||||
char PlatformLocaleDecimalPoint; // '.' or *localeconv()->decimal_point
|
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
bool SettingsLoaded;
|
bool SettingsLoaded;
|
||||||
@ -2212,7 +2211,6 @@ struct ImGuiContext
|
|||||||
|
|
||||||
PlatformImeData.InputPos = ImVec2(0.0f, 0.0f);
|
PlatformImeData.InputPos = ImVec2(0.0f, 0.0f);
|
||||||
PlatformImeDataPrev.InputPos = ImVec2(-1.0f, -1.0f); // Different to ensure initial submission
|
PlatformImeDataPrev.InputPos = ImVec2(-1.0f, -1.0f); // Different to ensure initial submission
|
||||||
PlatformLocaleDecimalPoint = '.';
|
|
||||||
|
|
||||||
SettingsLoaded = false;
|
SettingsLoaded = false;
|
||||||
SettingsDirtyTimer = 0.0f;
|
SettingsDirtyTimer = 0.0f;
|
||||||
|
@ -120,7 +120,7 @@ static const ImU64 IM_U64_MAX = (2ULL * 9223372036854775807LL + 1);
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
// For InputTextEx()
|
// For InputTextEx()
|
||||||
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source);
|
static bool InputTextFilterCharacter(ImGuiContext* ctx, unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source);
|
||||||
static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);
|
static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);
|
||||||
static ImVec2 InputTextCalcTextSizeW(ImGuiContext* ctx, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false);
|
static ImVec2 InputTextCalcTextSizeW(ImGuiContext* ctx, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false);
|
||||||
|
|
||||||
@ -3905,7 +3905,7 @@ void ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return false to discard a character.
|
// Return false to discard a character.
|
||||||
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source)
|
static bool InputTextFilterCharacter(ImGuiContext* ctx, unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source)
|
||||||
{
|
{
|
||||||
IM_ASSERT(input_source == ImGuiInputSource_Keyboard || input_source == ImGuiInputSource_Clipboard);
|
IM_ASSERT(input_source == ImGuiInputSource_Keyboard || input_source == ImGuiInputSource_Clipboard);
|
||||||
unsigned int c = *p_char;
|
unsigned int c = *p_char;
|
||||||
@ -3944,10 +3944,10 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|||||||
// The standard mandate that programs starts in the "C" locale where the decimal point is '.'.
|
// 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.
|
// 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:
|
// Change the default decimal_point with:
|
||||||
// ImGui::GetCurrentContext()->PlatformLocaleDecimalPoint = *localeconv()->decimal_point;
|
// ImGui::GetIO()->PlatformLocaleDecimalPoint = *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.
|
// 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 = *GImGui;
|
ImGuiContext& g = *ctx;
|
||||||
const unsigned c_decimal_point = (unsigned int)g.PlatformLocaleDecimalPoint;
|
const unsigned c_decimal_point = (unsigned int)g.IO.PlatformLocaleDecimalPoint;
|
||||||
if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsScientific))
|
if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsScientific))
|
||||||
if (c == '.' || c == ',')
|
if (c == '.' || c == ',')
|
||||||
c = c_decimal_point;
|
c = c_decimal_point;
|
||||||
@ -4386,7 +4386,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
if ((flags & ImGuiInputTextFlags_AllowTabInput) && Shortcut(ImGuiKey_Tab, id) && !is_readonly)
|
if ((flags & ImGuiInputTextFlags_AllowTabInput) && Shortcut(ImGuiKey_Tab, id) && !is_readonly)
|
||||||
{
|
{
|
||||||
unsigned int c = '\t'; // Insert TAB
|
unsigned int c = '\t'; // Insert TAB
|
||||||
if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
|
if (InputTextFilterCharacter(&g, &c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
|
||||||
state->OnKeyPressed((int)c);
|
state->OnKeyPressed((int)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4402,7 +4402,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
unsigned int c = (unsigned int)io.InputQueueCharacters[n];
|
unsigned int c = (unsigned int)io.InputQueueCharacters[n];
|
||||||
if (c == '\t') // Skip Tab, see above.
|
if (c == '\t') // Skip Tab, see above.
|
||||||
continue;
|
continue;
|
||||||
if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
|
if (InputTextFilterCharacter(&g, &c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
|
||||||
state->OnKeyPressed((int)c);
|
state->OnKeyPressed((int)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4485,7 +4485,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
else if (!is_readonly)
|
else if (!is_readonly)
|
||||||
{
|
{
|
||||||
unsigned int c = '\n'; // Insert new line
|
unsigned int c = '\n'; // Insert new line
|
||||||
if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
|
if (InputTextFilterCharacter(&g, &c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
|
||||||
state->OnKeyPressed((int)c);
|
state->OnKeyPressed((int)c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4552,7 +4552,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
{
|
{
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
s += ImTextCharFromUtf8(&c, s, NULL);
|
s += ImTextCharFromUtf8(&c, s, NULL);
|
||||||
if (!InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Clipboard))
|
if (!InputTextFilterCharacter(&g, &c, flags, callback, callback_user_data, ImGuiInputSource_Clipboard))
|
||||||
continue;
|
continue;
|
||||||
clipboard_filtered[clipboard_filtered_len++] = (ImWchar)c;
|
clipboard_filtered[clipboard_filtered_len++] = (ImWchar)c;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user