|
|
@@ -3041,9 +3041,12 @@ void ImGui::SetCurrentContext(ImGuiContext* ctx)
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
-// Helper function to verify that the type sizes are matching between the calling file's compilation unit and imgui.cpp's compilation unit
|
|
|
-// If the user has inconsistent compilation settings, imgui configuration #define, packing pragma, etc. you may see different structures from what imgui.cpp sees which is highly problematic.
|
|
|
-bool ImGui::DebugCheckVersionAndDataLayout(const char* version, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_vert)
|
|
|
+// Helper function to verify ABI compatibility between caller code and compiled version of Dear ImGui.
|
|
|
+// Verify that the type sizes are matching between the calling file's compilation unit and imgui.cpp's compilation unit
|
|
|
+// If the user has inconsistent compilation settings, imgui configuration #define, packing pragma, etc. your user code
|
|
|
+// may see different structures thanwhat imgui.cpp sees, which is problematic.
|
|
|
+// We usually require settings to be in imconfig.h to make sure that they are accessible to all compilation units involved with Dear ImGui.
|
|
|
+bool ImGui::DebugCheckVersionAndDataLayout(const char* version, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_vert, size_t sz_idx)
|
|
|
{
|
|
|
bool error = false;
|
|
|
if (strcmp(version, IMGUI_VERSION)!=0) { error = true; IM_ASSERT(strcmp(version,IMGUI_VERSION)==0 && "Mismatched version string!"); }
|
|
|
@@ -3052,6 +3055,7 @@ bool ImGui::DebugCheckVersionAndDataLayout(const char* version, size_t sz_io, si
|
|
|
if (sz_vec2 != sizeof(ImVec2)) { error = true; IM_ASSERT(sz_vec2 == sizeof(ImVec2) && "Mismatched struct layout!"); }
|
|
|
if (sz_vec4 != sizeof(ImVec4)) { error = true; IM_ASSERT(sz_vec4 == sizeof(ImVec4) && "Mismatched struct layout!"); }
|
|
|
if (sz_vert != sizeof(ImDrawVert)) { error = true; IM_ASSERT(sz_vert == sizeof(ImDrawVert) && "Mismatched struct layout!"); }
|
|
|
+ if (sz_idx != sizeof(ImDrawIdx)) { error = true; IM_ASSERT(sz_idx == sizeof(ImDrawIdx) && "Mismatched struct layout!"); }
|
|
|
return !error;
|
|
|
}
|
|
|
|
|
|
@@ -3284,6 +3288,7 @@ static void ImGui::UpdateMouseInputs()
|
|
|
g.IO.MouseClickedTime[i] = g.Time;
|
|
|
}
|
|
|
g.IO.MouseClickedPos[i] = g.IO.MousePos;
|
|
|
+ g.IO.MouseDownWasDoubleClick[i] = g.IO.MouseDoubleClicked[i];
|
|
|
g.IO.MouseDragMaxDistanceAbs[i] = ImVec2(0.0f, 0.0f);
|
|
|
g.IO.MouseDragMaxDistanceSqr[i] = 0.0f;
|
|
|
}
|
|
|
@@ -3295,6 +3300,8 @@ static void ImGui::UpdateMouseInputs()
|
|
|
g.IO.MouseDragMaxDistanceAbs[i].x = ImMax(g.IO.MouseDragMaxDistanceAbs[i].x, delta_from_click_pos.x < 0.0f ? -delta_from_click_pos.x : delta_from_click_pos.x);
|
|
|
g.IO.MouseDragMaxDistanceAbs[i].y = ImMax(g.IO.MouseDragMaxDistanceAbs[i].y, delta_from_click_pos.y < 0.0f ? -delta_from_click_pos.y : delta_from_click_pos.y);
|
|
|
}
|
|
|
+ if (!g.IO.MouseDown[i] && !g.IO.MouseReleased[i])
|
|
|
+ g.IO.MouseDownWasDoubleClick[i] = false;
|
|
|
if (g.IO.MouseClicked[i]) // Clicking any mouse button reactivate mouse hovering which may have been deactivated by gamepad/keyboard navigation
|
|
|
g.NavDisableMouseHover = false;
|
|
|
}
|
|
|
@@ -4194,8 +4201,9 @@ bool ImGui::IsMouseClicked(int button, bool repeat)
|
|
|
|
|
|
if (repeat && t > g.IO.KeyRepeatDelay)
|
|
|
{
|
|
|
- float delay = g.IO.KeyRepeatDelay, rate = g.IO.KeyRepeatRate;
|
|
|
- if ((ImFmod(t - delay, rate) > rate*0.5f) != (ImFmod(t - delay - g.IO.DeltaTime, rate) > rate*0.5f))
|
|
|
+ // FIXME: 2019/05/03: Our old repeat code was wrong here and led to doubling the repeat rate, which made it an ok rate for repeat on mouse hold.
|
|
|
+ int amount = CalcTypematicPressedRepeatAmount(t, t - g.IO.DeltaTime, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate * 0.5f);
|
|
|
+ if (amount > 0)
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -4642,6 +4650,8 @@ static ImVec2 CalcSizeAfterConstraint(ImGuiWindow* window, ImVec2 new_size)
|
|
|
g.NextWindowData.SizeCallback(&data);
|
|
|
new_size = data.DesiredSize;
|
|
|
}
|
|
|
+ new_size.x = ImFloor(new_size.x);
|
|
|
+ new_size.y = ImFloor(new_size.y);
|
|
|
}
|
|
|
|
|
|
// Minimum size
|