mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Merge branch 'master' into docking
+ fix warning fix for mingw+dx9 # Conflicts: # backends/imgui_impl_dx9.cpp # imgui.cpp
This commit is contained in:
		| @@ -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; | ||||
| @@ -1088,7 +1090,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; | ||||
|     } | ||||
|  | ||||
| @@ -1104,7 +1106,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) | ||||
| @@ -1124,7 +1126,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; | ||||
| } | ||||
|  | ||||
| @@ -1136,11 +1138,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 | ||||
|     { | ||||
| @@ -1226,7 +1228,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; | ||||
| } | ||||
|  | ||||
| @@ -1438,10 +1440,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; | ||||
|  | ||||
| @@ -1987,13 +1989,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) | ||||
| @@ -2280,7 +2284,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) | ||||
| @@ -2318,8 +2322,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 | ||||
| @@ -2330,11 +2335,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) | ||||
| @@ -2344,10 +2348,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. | ||||
| @@ -2356,7 +2357,6 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data, | ||||
|             { | ||||
|                 g.NavInputId = id; | ||||
|                 temp_input_is_active = true; | ||||
|                 FocusableItemUnregister(window); | ||||
|             } | ||||
|     } | ||||
|  | ||||
| @@ -2387,7 +2387,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; | ||||
| } | ||||
|  | ||||
| @@ -2887,7 +2887,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) | ||||
| @@ -2937,8 +2937,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 | ||||
| @@ -2949,11 +2950,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) | ||||
|         { | ||||
| @@ -2962,10 +2962,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); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -3001,7 +2998,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; | ||||
| } | ||||
|  | ||||
| @@ -3292,7 +3289,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. | ||||
| @@ -3904,7 +3901,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(); | ||||
| @@ -3925,15 +3922,17 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ | ||||
|             return false; | ||||
|         } | ||||
|         draw_window = g.CurrentWindow; // Child window | ||||
|         draw_window->DC.NavLayerActiveMaskNext |= (1 << draw_window->DC.NavLayerCurrent); // This is to ensure that EndChild() will display a navigation highlight so we can "enter" into it. | ||||
|         draw_window->DC.NavLayersActiveMaskNext |= (1 << draw_window->DC.NavLayerCurrent); // This is to ensure that EndChild() will display a navigation highlight so we can "enter" into it. | ||||
|         draw_window->DC.CursorPos += style.FramePadding; | ||||
|         inner_size.x -= draw_window->ScrollbarSizes.x; | ||||
|     } | ||||
|     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) | ||||
| @@ -3942,9 +3941,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)); | ||||
| @@ -3957,7 +3955,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) | ||||
|     { | ||||
| @@ -3998,7 +3996,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; | ||||
|     } | ||||
|  | ||||
| @@ -4613,7 +4611,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)); | ||||
| @@ -4666,7 +4664,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 | ||||
| @@ -4824,10 +4822,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"); | ||||
| @@ -5765,7 +5765,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; | ||||
|     } | ||||
|  | ||||
| @@ -5891,7 +5891,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; | ||||
| } | ||||
|  | ||||
| @@ -6074,10 +6074,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 | ||||
|     { | ||||
| @@ -6155,10 +6155,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; | ||||
| } | ||||
|  | ||||
| @@ -6599,7 +6599,7 @@ void ImGui::EndMenuBar() | ||||
|             // To do so we claim focus back, restore NavId and then process the movement request for yet another frame. | ||||
|             // This involve a one-frame delay which isn't very problematic in this situation. We could remove it by scoring in advance for multiple window (probably not worth the hassle/cost) | ||||
|             const ImGuiNavLayer layer = ImGuiNavLayer_Menu; | ||||
|             IM_ASSERT(window->DC.NavLayerActiveMaskNext & (1 << layer)); // Sanity check | ||||
|             IM_ASSERT(window->DC.NavLayersActiveMaskNext & (1 << layer)); // Sanity check | ||||
|             FocusWindow(window); | ||||
|             SetNavID(window->NavLastIds[layer], layer, 0, window->NavRectRel[layer]); | ||||
|             g.NavDisableHighlight = true; // Hide highlight for the current frame so we don't see the intermediary selection. | ||||
| @@ -6609,6 +6609,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(); | ||||
| @@ -6835,7 +6836,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) | ||||
|     { | ||||
| @@ -6922,7 +6923,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; | ||||
| } | ||||
|  | ||||
| @@ -7252,6 +7253,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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user