mirror of
https://github.com/ocornut/imgui.git
synced 2025-10-26 12:27:30 +00:00
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_dx9.cpp # backends/imgui_impl_sdl2.cpp # backends/imgui_impl_sdl3.cpp # backends/imgui_impl_vulkan.cpp # imgui.cpp
This commit is contained in:
22
imgui.cpp
22
imgui.cpp
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.90.2
|
||||
// dear imgui, v1.90.3
|
||||
// (main code and documentation)
|
||||
|
||||
// Help:
|
||||
@@ -2121,12 +2121,18 @@ ImFileHandle ImFileOpen(const char* filename, const char* mode)
|
||||
// Previously we used ImTextCountCharsFromUtf8/ImTextStrFromUtf8 here but we now need to support ImWchar16 and ImWchar32!
|
||||
const int filename_wsize = ::MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0);
|
||||
const int mode_wsize = ::MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0);
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.TempBuffer.reserve((filename_wsize + mode_wsize) * sizeof(wchar_t));
|
||||
wchar_t* buf = (wchar_t*)(void*)g.TempBuffer.Data;
|
||||
::MultiByteToWideChar(CP_UTF8, 0, filename, -1, (wchar_t*)&buf[0], filename_wsize);
|
||||
::MultiByteToWideChar(CP_UTF8, 0, mode, -1, (wchar_t*)&buf[filename_wsize], mode_wsize);
|
||||
return ::_wfopen((const wchar_t*)&buf[0], (const wchar_t*)&buf[filename_wsize]);
|
||||
|
||||
// Use stack buffer if possible, otherwise heap buffer. Sizes include zero terminator.
|
||||
// We don't rely on current ImGuiContext as this is implied to be a helper function which doesn't depend on it (see #7314).
|
||||
wchar_t local_temp_stack[FILENAME_MAX];
|
||||
ImVector<wchar_t> local_temp_heap;
|
||||
if (filename_wsize + mode_wsize > IM_ARRAYSIZE(local_temp_stack))
|
||||
local_temp_heap.resize(filename_wsize + mode_wsize);
|
||||
wchar_t* filename_wbuf = local_temp_heap.Data ? local_temp_heap.Data : local_temp_stack;
|
||||
wchar_t* mode_wbuf = filename_wbuf + filename_wsize;
|
||||
::MultiByteToWideChar(CP_UTF8, 0, filename, -1, filename_wbuf, filename_wsize);
|
||||
::MultiByteToWideChar(CP_UTF8, 0, mode, -1, mode_wbuf, mode_wsize);
|
||||
return ::_wfopen(filename_wbuf, mode_wbuf);
|
||||
#else
|
||||
return fopen(filename, mode);
|
||||
#endif
|
||||
@@ -6048,7 +6054,7 @@ static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_cont
|
||||
{
|
||||
// Maximum window size is determined by the viewport size or monitor size
|
||||
ImVec2 size_min = CalcWindowMinSize(window);
|
||||
ImVec2 size_max = (window->ViewportOwned || (window->Flags & ImGuiWindowFlags_ChildWindow)) ? ImVec2(FLT_MAX, FLT_MAX) : window->Viewport->WorkSize - style.DisplaySafeAreaPadding * 2.0f;
|
||||
ImVec2 size_max = (window->ViewportOwned || ((window->Flags & ImGuiWindowFlags_ChildWindow) && !(window->Flags & ImGuiWindowFlags_Popup))) ? ImVec2(FLT_MAX, FLT_MAX) : ImGui::GetMainViewport()->WorkSize - style.DisplaySafeAreaPadding * 2.0f;
|
||||
const int monitor_idx = window->ViewportAllowPlatformMonitorExtend;
|
||||
if (monitor_idx >= 0 && monitor_idx < g.PlatformIO.Monitors.Size && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0)
|
||||
size_max = g.PlatformIO.Monitors[monitor_idx].WorkSize - style.DisplaySafeAreaPadding * 2.0f;
|
||||
|
||||
Reference in New Issue
Block a user