|
|
@@ -59,6 +59,8 @@ Index of this file:
|
|
|
#if defined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later
|
|
|
#pragma warning (disable: 5054) // operator '|': deprecated between enumerations of different types
|
|
|
#endif
|
|
|
+#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).
|
|
|
+#pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
|
|
|
#endif
|
|
|
|
|
|
// Clang/GCC warnings with -Weverything
|
|
|
@@ -686,7 +688,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
|
|
|
if (!ItemAdd(bb, id))
|
|
|
return false;
|
|
|
|
|
|
- if (window->DC.ItemFlags & ImGuiItemFlags_ButtonRepeat)
|
|
|
+ if (g.CurrentItemFlags & ImGuiItemFlags_ButtonRepeat)
|
|
|
flags |= ImGuiButtonFlags_Repeat;
|
|
|
bool hovered, held;
|
|
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
|
|
|
@@ -762,7 +764,7 @@ bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiBu
|
|
|
if (!ItemAdd(bb, id))
|
|
|
return false;
|
|
|
|
|
|
- if (window->DC.ItemFlags & ImGuiItemFlags_ButtonRepeat)
|
|
|
+ if (g.CurrentItemFlags & ImGuiItemFlags_ButtonRepeat)
|
|
|
flags |= ImGuiButtonFlags_Repeat;
|
|
|
|
|
|
bool hovered, held;
|
|
|
@@ -1081,7 +1083,7 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
|
|
ItemSize(total_bb, style.FramePadding.y);
|
|
|
if (!ItemAdd(total_bb, id))
|
|
|
{
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -1097,7 +1099,7 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
|
|
RenderNavHighlight(total_bb, id);
|
|
|
RenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
ImU32 check_col = GetColorU32(ImGuiCol_CheckMark);
|
|
|
- bool mixed_value = (window->DC.ItemFlags & ImGuiItemFlags_MixedValue) != 0;
|
|
|
+ bool mixed_value = (g.CurrentItemFlags & ImGuiItemFlags_MixedValue) != 0;
|
|
|
if (mixed_value)
|
|
|
{
|
|
|
// Undocumented tristate/mixed/indeterminate checkbox (#2644)
|
|
|
@@ -1117,7 +1119,7 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
|
|
if (label_size.x > 0.0f)
|
|
|
RenderText(label_pos, label);
|
|
|
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
|
|
|
return pressed;
|
|
|
}
|
|
|
|
|
|
@@ -1129,11 +1131,11 @@ bool ImGui::CheckboxFlagsT(const char* label, T* flags, T flags_value)
|
|
|
bool pressed;
|
|
|
if (!all_on && any_on)
|
|
|
{
|
|
|
- ImGuiWindow* window = GetCurrentWindow();
|
|
|
- ImGuiItemFlags backup_item_flags = window->DC.ItemFlags;
|
|
|
- window->DC.ItemFlags |= ImGuiItemFlags_MixedValue;
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
+ ImGuiItemFlags backup_item_flags = g.CurrentItemFlags;
|
|
|
+ g.CurrentItemFlags |= ImGuiItemFlags_MixedValue;
|
|
|
pressed = Checkbox(label, &all_on);
|
|
|
- window->DC.ItemFlags = backup_item_flags;
|
|
|
+ g.CurrentItemFlags = backup_item_flags;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1219,7 +1221,7 @@ bool ImGui::RadioButton(const char* label, bool active)
|
|
|
if (label_size.x > 0.0f)
|
|
|
RenderText(label_pos, label);
|
|
|
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags);
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags);
|
|
|
return pressed;
|
|
|
}
|
|
|
|
|
|
@@ -1431,10 +1433,10 @@ bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
|
|
|
- const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags;
|
|
|
- window->DC.ItemFlags |= ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus;
|
|
|
+ const ImGuiItemFlags item_flags_backup = g.CurrentItemFlags;
|
|
|
+ g.CurrentItemFlags |= ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus;
|
|
|
bool item_add = ItemAdd(bb, id);
|
|
|
- window->DC.ItemFlags = item_flags_backup;
|
|
|
+ g.CurrentItemFlags = item_flags_backup;
|
|
|
if (!item_add)
|
|
|
return false;
|
|
|
|
|
|
@@ -1980,13 +1982,15 @@ bool ImGui::DataTypeApplyOpFromText(const char* buf, const char* initial_value_b
|
|
|
{
|
|
|
// All other types assign constant
|
|
|
// We don't bother handling support for legacy operators since they are a little too crappy. Instead we will later implement a proper expression evaluator in the future.
|
|
|
- sscanf(buf, format, p_data);
|
|
|
+ if (sscanf(buf, format, p_data) < 1)
|
|
|
+ return false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
// Small types need a 32-bit buffer to receive the result from scanf()
|
|
|
int v32;
|
|
|
- sscanf(buf, format, &v32);
|
|
|
+ if (sscanf(buf, format, &v32) < 1)
|
|
|
+ return false;
|
|
|
if (data_type == ImGuiDataType_S8)
|
|
|
*(ImS8*)p_data = (ImS8)ImClamp(v32, (int)IM_S8_MIN, (int)IM_S8_MAX);
|
|
|
else if (data_type == ImGuiDataType_U8)
|
|
|
@@ -2273,7 +2277,7 @@ bool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v
|
|
|
}
|
|
|
if (g.ActiveId != id)
|
|
|
return false;
|
|
|
- if ((g.CurrentWindow->DC.ItemFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
|
|
+ if ((g.CurrentItemFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
|
|
return false;
|
|
|
|
|
|
switch (data_type)
|
|
|
@@ -2311,8 +2315,9 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data,
|
|
|
const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));
|
|
|
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
|
|
|
|
|
|
+ const bool temp_input_allowed = (flags & ImGuiSliderFlags_NoInput) == 0;
|
|
|
ItemSize(total_bb, style.FramePadding.y);
|
|
|
- if (!ItemAdd(total_bb, id, &frame_bb))
|
|
|
+ if (!ItemAdd(total_bb, id, &frame_bb, temp_input_allowed ? ImGuiItemAddFlags_Focusable : 0))
|
|
|
return false;
|
|
|
|
|
|
// Default format string when passing NULL
|
|
|
@@ -2323,11 +2328,10 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data,
|
|
|
|
|
|
// Tabbing or CTRL-clicking on Drag turns it into an InputText
|
|
|
const bool hovered = ItemHoverable(frame_bb, id);
|
|
|
- const bool temp_input_allowed = (flags & ImGuiSliderFlags_NoInput) == 0;
|
|
|
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
|
|
if (!temp_input_is_active)
|
|
|
{
|
|
|
- const bool focus_requested = temp_input_allowed && FocusableItemRegister(window, id);
|
|
|
+ const bool focus_requested = temp_input_allowed && (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_Focused) != 0;
|
|
|
const bool clicked = (hovered && g.IO.MouseClicked[0]);
|
|
|
const bool double_clicked = (hovered && g.IO.MouseDoubleClicked[0]);
|
|
|
if (focus_requested || clicked || double_clicked || g.NavActivateId == id || g.NavInputId == id)
|
|
|
@@ -2337,10 +2341,7 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data,
|
|
|
FocusWindow(window);
|
|
|
g.ActiveIdUsingNavDirMask = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right);
|
|
|
if (temp_input_allowed && (focus_requested || (clicked && g.IO.KeyCtrl) || double_clicked || g.NavInputId == id))
|
|
|
- {
|
|
|
temp_input_is_active = true;
|
|
|
- FocusableItemUnregister(window);
|
|
|
- }
|
|
|
}
|
|
|
// Experimental: simple click (without moving) turns Drag into an InputText
|
|
|
// FIXME: Currently polling ImGuiConfigFlags_IsTouchScreen, may either poll an hypothetical ImGuiBackendFlags_HasKeyboard and/or an explicit drag settings.
|
|
|
@@ -2349,7 +2350,6 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data,
|
|
|
{
|
|
|
g.NavInputId = id;
|
|
|
temp_input_is_active = true;
|
|
|
- FocusableItemUnregister(window);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2380,7 +2380,7 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data,
|
|
|
if (label_size.x > 0.0f)
|
|
|
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
|
|
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags);
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags);
|
|
|
return value_changed;
|
|
|
}
|
|
|
|
|
|
@@ -2895,7 +2895,7 @@ bool ImGui::SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type
|
|
|
IM_ASSERT((flags == 1 || (flags & ImGuiSliderFlags_InvalidMask_) == 0) && "Invalid ImGuiSliderFlags flag! Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.");
|
|
|
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
- if ((g.CurrentWindow->DC.ItemFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
|
|
+ if ((g.CurrentItemFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
|
|
return false;
|
|
|
|
|
|
switch (data_type)
|
|
|
@@ -2945,8 +2945,9 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
|
|
|
const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));
|
|
|
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
|
|
|
|
|
|
+ const bool temp_input_allowed = (flags & ImGuiSliderFlags_NoInput) == 0;
|
|
|
ItemSize(total_bb, style.FramePadding.y);
|
|
|
- if (!ItemAdd(total_bb, id, &frame_bb))
|
|
|
+ if (!ItemAdd(total_bb, id, &frame_bb, temp_input_allowed ? ImGuiItemAddFlags_Focusable : 0))
|
|
|
return false;
|
|
|
|
|
|
// Default format string when passing NULL
|
|
|
@@ -2957,11 +2958,10 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
|
|
|
|
|
|
// Tabbing or CTRL-clicking on Slider turns it into an input box
|
|
|
const bool hovered = ItemHoverable(frame_bb, id);
|
|
|
- const bool temp_input_allowed = (flags & ImGuiSliderFlags_NoInput) == 0;
|
|
|
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
|
|
if (!temp_input_is_active)
|
|
|
{
|
|
|
- const bool focus_requested = temp_input_allowed && FocusableItemRegister(window, id);
|
|
|
+ const bool focus_requested = temp_input_allowed && (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_Focused) != 0;
|
|
|
const bool clicked = (hovered && g.IO.MouseClicked[0]);
|
|
|
if (focus_requested || clicked || g.NavActivateId == id || g.NavInputId == id)
|
|
|
{
|
|
|
@@ -2970,10 +2970,7 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
|
|
|
FocusWindow(window);
|
|
|
g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right);
|
|
|
if (temp_input_allowed && (focus_requested || (clicked && g.IO.KeyCtrl) || g.NavInputId == id))
|
|
|
- {
|
|
|
temp_input_is_active = true;
|
|
|
- FocusableItemUnregister(window);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -3009,7 +3006,7 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
|
|
|
if (label_size.x > 0.0f)
|
|
|
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
|
|
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags);
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags);
|
|
|
return value_changed;
|
|
|
}
|
|
|
|
|
|
@@ -3300,7 +3297,7 @@ bool ImGui::TempInputText(const ImRect& bb, ImGuiID id, const char* label, char*
|
|
|
ClearActiveID();
|
|
|
|
|
|
g.CurrentWindow->DC.CursorPos = bb.Min;
|
|
|
- bool value_changed = InputTextEx(label, NULL, buf, buf_size, bb.GetSize(), flags);
|
|
|
+ bool value_changed = InputTextEx(label, NULL, buf, buf_size, bb.GetSize(), flags | ImGuiInputTextFlags_MergedItem);
|
|
|
if (init)
|
|
|
{
|
|
|
// First frame we started displaying the InputText widget, we expect it to take the active id.
|
|
|
@@ -3912,7 +3909,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
ImVec2 inner_size = frame_size;
|
|
|
if (is_multiline)
|
|
|
{
|
|
|
- if (!ItemAdd(total_bb, id, &frame_bb))
|
|
|
+ if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemAddFlags_Focusable))
|
|
|
{
|
|
|
ItemSize(total_bb, style.FramePadding.y);
|
|
|
EndGroup();
|
|
|
@@ -3939,9 +3936,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ // Support for internal ImGuiInputTextFlags_MergedItem flag, which could be redesigned as an ItemFlags if needed (with test performed in ItemAdd)
|
|
|
ItemSize(total_bb, style.FramePadding.y);
|
|
|
- if (!ItemAdd(total_bb, id, &frame_bb))
|
|
|
- return false;
|
|
|
+ if (!(flags & ImGuiInputTextFlags_MergedItem))
|
|
|
+ if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemAddFlags_Focusable))
|
|
|
+ return false;
|
|
|
}
|
|
|
const bool hovered = ItemHoverable(frame_bb, id);
|
|
|
if (hovered)
|
|
|
@@ -3950,9 +3949,8 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
// We are only allowed to access the state if we are already the active widget.
|
|
|
ImGuiInputTextState* state = GetInputTextState(id);
|
|
|
|
|
|
- const bool focus_requested = FocusableItemRegister(window, id);
|
|
|
- const bool focus_requested_by_code = focus_requested && (g.TabFocusRequestCurrWindow == window && g.TabFocusRequestCurrCounterRegular == window->DC.FocusCounterRegular);
|
|
|
- const bool focus_requested_by_tab = focus_requested && !focus_requested_by_code;
|
|
|
+ const bool focus_requested_by_code = (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_FocusedByCode) != 0;
|
|
|
+ const bool focus_requested_by_tabbing = (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_FocusedByTabbing) != 0;
|
|
|
|
|
|
const bool user_clicked = hovered && io.MouseClicked[0];
|
|
|
const bool user_nav_input_start = (g.ActiveId != id) && ((g.NavInputId == id) || (g.NavActivateId == id && g.NavInputSource == ImGuiInputSource_Keyboard));
|
|
|
@@ -3965,7 +3963,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
float scroll_y = is_multiline ? draw_window->Scroll.y : FLT_MAX;
|
|
|
|
|
|
const bool init_changed_specs = (state != NULL && state->Stb.single_line != !is_multiline);
|
|
|
- const bool init_make_active = (focus_requested || user_clicked || user_scroll_finish || user_nav_input_start);
|
|
|
+ const bool init_make_active = (user_clicked || user_scroll_finish || user_nav_input_start || focus_requested_by_code || focus_requested_by_tabbing);
|
|
|
const bool init_state = (init_make_active || user_scroll_active);
|
|
|
if ((init_state && g.ActiveId != id) || init_changed_specs)
|
|
|
{
|
|
|
@@ -4006,7 +4004,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
}
|
|
|
if (flags & ImGuiInputTextFlags_AlwaysOverwrite)
|
|
|
state->Stb.insert_mode = 1; // stb field name is indeed incorrect (see #2863)
|
|
|
- if (!is_multiline && (focus_requested_by_tab || (user_clicked && io.KeyCtrl)))
|
|
|
+ if (!is_multiline && (focus_requested_by_tabbing || (user_clicked && io.KeyCtrl)))
|
|
|
select_all = true;
|
|
|
}
|
|
|
|
|
|
@@ -4621,7 +4619,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
{
|
|
|
state->CursorAnim += io.DeltaTime;
|
|
|
bool cursor_is_visible = (!g.IO.ConfigInputTextCursorBlink) || (state->CursorAnim <= 0.0f) || ImFmod(state->CursorAnim, 1.20f) <= 0.80f;
|
|
|
- ImVec2 cursor_screen_pos = draw_pos + cursor_offset - draw_scroll;
|
|
|
+ ImVec2 cursor_screen_pos = ImFloor(draw_pos + cursor_offset - draw_scroll);
|
|
|
ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y - g.FontSize + 0.5f, cursor_screen_pos.x + 1.0f, cursor_screen_pos.y - 1.5f);
|
|
|
if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect))
|
|
|
draw_window->DrawList->AddLine(cursor_screen_rect.Min, cursor_screen_rect.GetBL(), GetColorU32(ImGuiCol_Text));
|
|
|
@@ -4671,7 +4669,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
if (value_changed && !(flags & ImGuiInputTextFlags_NoMarkEdited))
|
|
|
MarkItemEdited(id);
|
|
|
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags);
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags);
|
|
|
if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0)
|
|
|
return enter_pressed;
|
|
|
else
|
|
|
@@ -4829,10 +4827,12 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
p++;
|
|
|
i[0] = i[1] = i[2] = 0;
|
|
|
i[3] = 0xFF; // alpha default to 255 is not parsed by scanf (e.g. inputting #FFFFFF omitting alpha)
|
|
|
+ int r;
|
|
|
if (alpha)
|
|
|
- sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned)
|
|
|
+ r = sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned)
|
|
|
else
|
|
|
- sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]);
|
|
|
+ r = sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]);
|
|
|
+ IM_UNUSED(r); // Fixes C6031: Return value ignored: 'sscanf'.
|
|
|
}
|
|
|
if (!(flags & ImGuiColorEditFlags_NoOptions))
|
|
|
OpenPopupOnItemClick("context");
|
|
|
@@ -5770,7 +5770,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|
|
{
|
|
|
if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
|
|
|
TreePushOverrideID(id);
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(window->DC.LastItemId, label, window->DC.ItemFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0));
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(window->DC.LastItemId, label, window->DC.LastItemStatusFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0));
|
|
|
return is_open;
|
|
|
}
|
|
|
|
|
|
@@ -5896,7 +5896,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|
|
|
|
|
if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
|
|
|
TreePushOverrideID(id);
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0));
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0));
|
|
|
return is_open;
|
|
|
}
|
|
|
|
|
|
@@ -6079,10 +6079,10 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
bool item_add;
|
|
|
if (flags & ImGuiSelectableFlags_Disabled)
|
|
|
{
|
|
|
- ImGuiItemFlags backup_item_flags = window->DC.ItemFlags;
|
|
|
- window->DC.ItemFlags |= ImGuiItemFlags_Disabled | ImGuiItemFlags_NoNavDefaultFocus;
|
|
|
+ ImGuiItemFlags backup_item_flags = g.CurrentItemFlags;
|
|
|
+ g.CurrentItemFlags |= ImGuiItemFlags_Disabled | ImGuiItemFlags_NoNavDefaultFocus;
|
|
|
item_add = ItemAdd(bb, id);
|
|
|
- window->DC.ItemFlags = backup_item_flags;
|
|
|
+ g.CurrentItemFlags = backup_item_flags;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -6160,10 +6160,10 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
if (flags & ImGuiSelectableFlags_Disabled) PopStyleColor();
|
|
|
|
|
|
// Automatically close popups
|
|
|
- if (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_DontClosePopups) && !(window->DC.ItemFlags & ImGuiItemFlags_SelectableDontClosePopup))
|
|
|
+ if (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_DontClosePopups) && !(g.CurrentItemFlags & ImGuiItemFlags_SelectableDontClosePopup))
|
|
|
CloseCurrentPopup();
|
|
|
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags);
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags);
|
|
|
return pressed;
|
|
|
}
|
|
|
|
|
|
@@ -6614,6 +6614,7 @@ void ImGui::EndMenuBar()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ IM_MSVC_WARNING_SUPPRESS(6011); // Static Analysis false positive "warning C6011: Dereferencing NULL pointer 'window'"
|
|
|
IM_ASSERT(window->Flags & ImGuiWindowFlags_MenuBar);
|
|
|
IM_ASSERT(window->DC.MenuBarAppending);
|
|
|
PopClipRect();
|
|
|
@@ -6836,7 +6837,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
|
|
if (want_close && IsPopupOpen(id, ImGuiPopupFlags_None))
|
|
|
ClosePopupToLevel(g.BeginPopupStack.Size, true);
|
|
|
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags | ImGuiItemStatusFlags_Openable | (menu_is_open ? ImGuiItemStatusFlags_Opened : 0));
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags | ImGuiItemStatusFlags_Openable | (menu_is_open ? ImGuiItemStatusFlags_Opened : 0));
|
|
|
|
|
|
if (!menu_is_open && want_open && g.OpenPopupStack.Size > g.BeginPopupStack.Size)
|
|
|
{
|
|
|
@@ -6923,7 +6924,7 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, boo
|
|
|
RenderCheckMark(window->DrawList, pos + ImVec2(window->DC.MenuColumns.Pos[2] + extra_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled), g.FontSize * 0.866f);
|
|
|
}
|
|
|
|
|
|
- IMGUI_TEST_ENGINE_ITEM_INFO(window->DC.LastItemId, label, window->DC.ItemFlags | ImGuiItemStatusFlags_Checkable | (selected ? ImGuiItemStatusFlags_Checked : 0));
|
|
|
+ IMGUI_TEST_ENGINE_ITEM_INFO(window->DC.LastItemId, label, window->DC.LastItemStatusFlags | ImGuiItemStatusFlags_Checkable | (selected ? ImGuiItemStatusFlags_Checked : 0));
|
|
|
return pressed;
|
|
|
}
|
|
|
|
|
|
@@ -7245,6 +7246,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
|
|
curr_section_n = section_n;
|
|
|
|
|
|
// Store data so we can build an array sorted by width if we need to shrink tabs down
|
|
|
+ IM_MSVC_WARNING_SUPPRESS(6385);
|
|
|
int shrink_buffer_index = shrink_buffer_indexes[section_n]++;
|
|
|
g.ShrinkWidthBuffer[shrink_buffer_index].Index = tab_n;
|
|
|
g.ShrinkWidthBuffer[shrink_buffer_index].Width = tab->ContentWidth;
|