18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-27 21:45:16 +01:00
Files
maszyna/docs/imgui_patches.md
jerrrrycho df95395ded docs/build: track_uneven_doc.md to docs/, the local ImGui changes listed, the audio license texts kept in ref/licenses (#495)
* docs: track_uneven_doc.md from the root of the repository to docs/ (#237)

The tool that grades the tracks points to its new place; directoryDescription.md
names docs/.

* docs: the local changes of the bundled ImGui (#236)

docs/imgui_patches.md lists what imgui/ changes against upstream
v1.91.9b-docking (io.ConfigViewportsNoAutoDetach, io.ConfigTooltipsWrapWidth,
BufferingBar/Spinner, the glad loader, the main-window origin of the GLFW
backend, the gamma of the OpenGL 3 backend) and in ImGuizmo, with the commits
that brought them, so an update of ImGui carries them over.

* build: the license texts of the audio DLLs from ref/licenses instead of downloads (#405)

The Windows build downloaded 14 license texts on every run without a cache
hit, from raw.githubusercontent.com, scm.orgis.org (mpg123) and
sources.debian.org (LAME). They are now in ref/licenses, byte for byte as at
the pinned URLs (-text in .gitattributes, so a checkout with CRLF doesn't
change them), and the step copies them from there, still checked by their
SHA-256. ref/licenses/README.md names the URL of each. The two release zips
are still downloaded and cached as before.

* docs: the ImAbs shim of ImGuizmo listed, stale comments of the DLL step, a plain docs/ row
2026-11-25 05:24:58 +01:00

5.4 KiB

Local changes of the bundled ImGui

imgui/ holds Dear ImGui v1.91.9b-docking (IMGUI_VERSION "1.91.9b", the docking branch: upstream tag v1.91.9b-docking), the GLFW, OpenGL 2 and OpenGL 3 backends of the same tag, and ImGuizmo. The changes below are ours: an update of ImGui has to carry them over, or drop them on purpose. Most of them are marked in the code with a MaSzyna comment (grep -n MaSzyna imgui/*), but not every changed line is.

Compared with the upstream tag, these files are unchanged: imgui_demo.cpp, imgui_draw.cpp, imgui_internal.h, imgui_tables.cpp, imstb_rectpack.h, imstb_textedit.h, imstb_truetype.h, LICENSE.txt and the backend headers (imgui_impl_glfw.h, imgui_impl_opengl2.h, imgui_impl_opengl3.h). The backends are in backends/ upstream, here next to the rest.

ImGui itself

Change Files Since Used by
io.ConfigViewportsNoAutoDetach (default false): a floating window stays inside its host viewport. A resize stops at the viewport's edge, a window left past the edge or too big for it is moved back and shrunk, and it gets a viewport (an OS window) of its own only when dragged with the cursor outside the host viewport. Tooltips and popups over the main viewport, or begun outside any window, stay in the main viewport. Upstream has no such option (#236; the closest upstream report is ocornut/imgui#9594) imgui.h (ImGuiIO field), imgui.cpp: its default in ImGuiIO::ImGuiIO(); WindowStaysInHostViewport(), IsWindowBeingMoved(), KeepWindowInsideRect(); the resize limit in UpdateWindowManualResize(); two places in Begin() (no late viewport, window kept inside the work rect); the fallback and ViewportAllowPlatformMonitorExtend in UpdateSelectWindowViewport() 5fa03304e (#236), be4000880, d0ca44cd6 application/uilayer.cpp, with the viewports on
io.ConfigTooltipsWrapWidth (default 0, no wrapping): the text of SetTooltip() / SetItemTooltip() wraps at that width. BeginTooltip() is not affected imgui.h (ImGuiIO field), imgui.cpp (default, SetTooltipV()) be4000880 application/uilayer.cpp (40 font sizes)
ImGui::BufferingBar() and ImGui::Spinner(), by zfedoran from ocornut/imgui#1901 imgui.h, end of imgui_widgets.cpp ae3cecfa4 (2019, for the progress bar of the loading screen of the time), carried over in 344034ec7 nothing at present: can be dropped
#define IMGUI_IMPL_OPENGL_LOADER_CUSTOM: the OpenGL 3 backend uses glad, loaded by the simulator, instead of its own loader imconfig.h 344034ec7 the OpenGL 3 backend

Backends

Change File Since
With multi-viewports, ImGui positions are relative to the simulator's main window instead of the desktop, so the main viewport stays at (0,0) and the overlays, picking and editor gizmo work in window coordinates as without viewports. MainWindowOrigin in the backend data, ImGui_ImplGlfw_UpdateMainWindowOrigin() called from NewFrame(); the origin is subtracted from the mouse position (callback and UpdateMouseData()), the monitors' MainPos / WorkPos and GetWindowPos(), and added back in CreateWindow() and SetWindowPos() imgui_impl_glfw.cpp 476f3bf1b
GL functions from glad (<glad/glad.h>) instead of the system's GL/gl.h imgui_impl_opengl2.cpp 344034ec7
GL functions from glad, with stdafx.h and utilities/Globals.h included for the renderer's settings imgui_impl_opengl3.cpp 344034ec7
GlslVersionString is 128 bytes instead of 32, for the longer GLES version string the simulator passes imgui_impl_opengl3.cpp 344034ec7
Gamma of the UI follows the renderer: the vertex shaders linearise the vertex colour (pow(Color.rgb, 2.2)); each fragment shader's output goes through FBOUT(), which applies 1/2.2 when Global.gfx_shadergamma is set and passes it through otherwise; with desktop GL and no shader gamma GL_FRAMEBUFFER_SRGB is enabled while the UI is drawn and restored after imgui_impl_opengl3.cpp (RenderDrawData(), the shader sources, CreateDeviceObjects()) 344034ec7

ImGuizmo

From CedricGuillemet/ImGuizmo, added in 5a39ed519; the upstream commit it was taken from isn't recorded. Changed in 344034ec7 for the ImGui API of 1.91:

  • IMGUI_DEFINE_MATH_OPERATORS is defined before the first #include "imgui.h" (ImGui 1.86 and later want it so).
  • ImGui::CaptureMouseFromApp() is replaced by ImGui::SetNextFrameWantCaptureMouse(true) (six places).

And since 5a39ed519, for the ImGui of the time:

  • A compatibility shim, #define ImAbs(X) when ImAbs isn't a macro (ImGuizmo.cpp:42-44). ImGui 1.91 has ImAbs as an inline function in imgui_internal.h, so the macro is always defined now and hides that function in ImGuizmo.cpp. It can be dropped.

Checking an update

Download the files of the new tag (imgui*.cpp, imgui*.h, imstb_*.h, imconfig.h, and from backends/ imgui_impl_glfw.*, imgui_impl_opengl2.*, imgui_impl_opengl3.*), diff the files here against the tag listed at the top, and apply that diff to the new files. The diff of the files here against v1.91.9b-docking is exactly the list above.