meltygui-imgui 2.0.1__tar.gz → 2.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/MANIFEST.in +1 -0
  2. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/PKG-INFO +6 -6
  3. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/README.md +36 -0
  4. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/imgui.cpp +12 -11
  5. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/imgui_draw.cpp +21 -5
  6. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/imgui_tables.cpp +4 -4
  7. meltygui_imgui-2.0.3/meltygui_imgui/core.pyi +2461 -0
  8. meltygui_imgui-2.0.3/meltygui_imgui/internal.pyi +277 -0
  9. meltygui_imgui-2.0.3/meltygui_imgui/py.typed +0 -0
  10. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui.egg-info/PKG-INFO +6 -6
  11. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui.egg-info/SOURCES.txt +6 -0
  12. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/setup.py +2 -1
  13. meltygui_imgui-2.0.3/tests/test_stub_signatures.py +101 -0
  14. meltygui_imgui-2.0.3/tests/test_text_pixel_alignment.py +81 -0
  15. meltygui_imgui-2.0.3/tools/generate_stubs.py +197 -0
  16. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/tools/smoke.py +2 -2
  17. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/tools/verify.py +5 -0
  18. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/LICENSE +0 -0
  19. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/LICENSES/imgui-MIT.txt +0 -0
  20. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/LICENSES/imstb_rectpack.h.license.txt +0 -0
  21. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/LICENSES/imstb_textedit.h.license.txt +0 -0
  22. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/LICENSES/imstb_truetype.h.license.txt +0 -0
  23. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/MELTYGUI.md +0 -0
  24. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/UPSTREAM.json +0 -0
  25. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/ansifeed-cpp/AnsiTextColored.cpp +0 -0
  26. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/ansifeed-cpp/AnsiTextColored.h +0 -0
  27. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/config-cpp/py_imconfig.cpp +0 -0
  28. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/config-cpp/py_imconfig.h +0 -0
  29. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_allegro5.cpp +0 -0
  30. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_allegro5.h +0 -0
  31. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_android.cpp +0 -0
  32. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_android.h +0 -0
  33. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_dx10.cpp +0 -0
  34. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_dx10.h +0 -0
  35. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_dx11.cpp +0 -0
  36. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_dx11.h +0 -0
  37. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_dx12.cpp +0 -0
  38. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_dx12.h +0 -0
  39. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_dx9.cpp +0 -0
  40. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_dx9.h +0 -0
  41. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_glfw.cpp +0 -0
  42. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_glfw.h +0 -0
  43. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_glut.cpp +0 -0
  44. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_glut.h +0 -0
  45. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_marmalade.cpp +0 -0
  46. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_marmalade.h +0 -0
  47. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_metal.h +0 -0
  48. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_opengl2.cpp +0 -0
  49. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_opengl2.h +0 -0
  50. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_opengl3.cpp +0 -0
  51. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_opengl3.h +0 -0
  52. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_osx.h +0 -0
  53. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_sdl.cpp +0 -0
  54. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_sdl.h +0 -0
  55. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_vulkan.cpp +0 -0
  56. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_vulkan.h +0 -0
  57. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_wgpu.cpp +0 -0
  58. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_wgpu.h +0 -0
  59. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_win32.cpp +0 -0
  60. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/backends/imgui_impl_win32.h +0 -0
  61. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/imconfig.h +0 -0
  62. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/imgui.h +0 -0
  63. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/imgui_demo.cpp +0 -0
  64. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/imgui_internal.h +0 -0
  65. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/imgui_widgets.cpp +0 -0
  66. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/imstb_rectpack.h +0 -0
  67. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/imstb_textedit.h +0 -0
  68. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/imstb_truetype.h +0 -0
  69. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/misc/cpp/imgui_stdlib.cpp +0 -0
  70. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/misc/cpp/imgui_stdlib.h +0 -0
  71. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/misc/fonts/binary_to_compressed_c.cpp +0 -0
  72. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/misc/freetype/imgui_freetype.cpp +0 -0
  73. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/misc/freetype/imgui_freetype.h +0 -0
  74. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/imgui-cpp/misc/single_file/imgui_single_file.h +0 -0
  75. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/__init__.py +0 -0
  76. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/_compat.py +0 -0
  77. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/ansifeed.pxd +0 -0
  78. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/cimgui.pxd +0 -0
  79. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/common.pyx +0 -0
  80. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/core.cpp +0 -0
  81. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/core.h +0 -0
  82. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/core.pxd +0 -0
  83. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/core.pyx +0 -0
  84. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/enums.pxd +0 -0
  85. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/enums_internal.pxd +0 -0
  86. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/extra.py +0 -0
  87. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/integrations/__init__.py +0 -0
  88. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/integrations/base.py +0 -0
  89. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/integrations/cocos2d.py +0 -0
  90. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/integrations/glfw.py +0 -0
  91. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/integrations/glumpy.py +0 -0
  92. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/integrations/opengl.py +0 -0
  93. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/integrations/pygame.py +0 -0
  94. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/integrations/pyglet.py +0 -0
  95. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/integrations/sdl2.py +0 -0
  96. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/internal.cpp +0 -0
  97. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/internal.h +0 -0
  98. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/internal.pxd +0 -0
  99. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui/internal.pyx +0 -0
  100. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui.egg-info/dependency_links.txt +0 -0
  101. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui.egg-info/requires.txt +4 -4
  102. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/meltygui_imgui.egg-info/top_level.txt +0 -0
  103. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/pyproject.toml +0 -0
  104. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/setup.cfg +0 -0
  105. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/tests/test_begin_end_context_managers.py +0 -0
  106. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/tests/test_context_mem_safety.py +0 -0
  107. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/tests/test_crazy_callbacks.py +0 -0
  108. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/tests/test_graphics_mem_safety.py +0 -0
  109. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/tests/test_gui_style_initialization.py +0 -0
  110. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/tools/build.py +0 -0
  111. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/tools/build_in_container.sh +0 -0
  112. {meltygui_imgui-2.0.1 → meltygui_imgui-2.0.3}/tools/build_windows.py +0 -0
@@ -3,6 +3,7 @@ include LICENSE
3
3
 
4
4
  # Cython sources
5
5
  recursive-include meltygui_imgui *.pyx *.pxd
6
+ recursive-include meltygui_imgui *.pyi py.typed
6
7
 
7
8
  # Cython-generated C++ sources
8
9
  recursive-include meltygui_imgui *.cpp *.h
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meltygui-imgui
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: Cython-based Python bindings for dear meltygui_imgui
5
5
  Home-page: https://github.com/Attentio-AI/meltygui-imgui
6
6
  Author: Michał Jaworski
@@ -45,14 +45,14 @@ Requires-Dist: PyOpenGL; extra == "pyglet"
45
45
  Requires-Dist: pyglet; sys_platform != "darwin" and extra == "pyglet"
46
46
  Requires-Dist: pyglet>=1.5.6; sys_platform == "darwin" and extra == "pyglet"
47
47
  Provides-Extra: full
48
- Requires-Dist: cocos2d; extra == "full"
49
- Requires-Dist: PySDL2; extra == "full"
50
- Requires-Dist: pygame; extra == "full"
51
48
  Requires-Dist: PyOpenGL; extra == "full"
52
- Requires-Dist: glfw; extra == "full"
53
- Requires-Dist: pyglet; sys_platform != "darwin" and extra == "full"
49
+ Requires-Dist: cocos2d; extra == "full"
54
50
  Requires-Dist: Cython<0.30,>=0.24; extra == "full"
51
+ Requires-Dist: glfw; extra == "full"
52
+ Requires-Dist: pygame; extra == "full"
55
53
  Requires-Dist: pyglet>=1.5.6; sys_platform == "darwin" and extra == "full"
54
+ Requires-Dist: pyglet; sys_platform != "darwin" and extra == "full"
55
+ Requires-Dist: PySDL2; extra == "full"
56
56
  Dynamic: author
57
57
  Dynamic: author-email
58
58
  Dynamic: classifier
@@ -29,6 +29,42 @@ missing wheel an error rather than a compilation.
29
29
 
30
30
  The bundled Dear ImGui and font-helper license notices are included in the artifacts.
31
31
 
32
+ ## Fractional coordinates (2.0.3)
33
+
34
+ The maintained binding retains fractional mouse, window, scroll and cursor
35
+ positions. Text origins align to physical framebuffer pixels only when drawing,
36
+ restoring crisp 1x text and allowing pixel-sized steps on Retina displays without
37
+ rounding scroll offsets or interaction coordinates. Applications and font sizes
38
+ still use logical coordinates. Rebuild the native extension on
39
+ each target platform when upgrading; copying Python modules is insufficient.
40
+ Hosts that interpolate a dense font atlas can define
41
+ `IMGUI_ENABLE_FRACTIONAL_TEXT`; Hub's iOS Retina runtime does this to retain
42
+ continuous touch scrolling.
43
+
44
+ ## IntelliJ IDEA / PyCharm
45
+
46
+ The package ships `.pyi` signatures for its native extensions, including the
47
+ top-level re-exports. These give the IDE the real Python keyword names, such as
48
+ `begin(label, closable=False, flags=0)`, instead of names reconstructed from
49
+ Cython's C-style docstrings (`str_label`, `ImGuiWindowFlags_flags`). Runtime
50
+ functions and calling conventions are unchanged. Types that are not fully
51
+ modeled remain `Any` to avoid rejecting supported conversions and callbacks.
52
+ The stubs also retain the positional-only restrictions of Cython 0.29 builds on
53
+ Python 3.11/3.12; Python 3.13 builds use Cython 3's keyword support.
54
+
55
+ Install the updated package into the IDE's selected Python interpreter. If an
56
+ existing project still shows the old generated skeleton, reload the interpreter
57
+ paths or invalidate the IDE caches and restart.
58
+
59
+ After editing the Cython API, regenerate the checked-in stubs:
60
+
61
+ ```sh
62
+ uv run --no-project --with Cython==0.29.37 python tools/generate_stubs.py
63
+ ```
64
+
65
+ CI checks for stale stubs and verifies that wheels and the source archive contain
66
+ both `.pyi` files and the `py.typed` marker.
67
+
32
68
  ## Build
33
69
 
34
70
  Docker is required. The manylinux image and Python build dependencies are pinned.
@@ -772,6 +772,7 @@ CODE
772
772
  #define IMGUI_DEFINE_MATH_OPERATORS
773
773
  #endif
774
774
  #include "imgui_internal.h"
775
+ // Melty subpixel coordinates: keep logical positions fractional through rasterization.
775
776
 
776
777
  // System includes
777
778
  #include <ctype.h> // toupper
@@ -3623,7 +3624,7 @@ static void ImGui::UpdateMouseInputs()
3623
3624
 
3624
3625
  // Round mouse position to avoid spreading non-rounded position (e.g. UpdateManualResize doesn't support them well)
3625
3626
  if (IsMousePosValid(&g.IO.MousePos))
3626
- g.IO.MousePos = g.LastValidMousePos = ImFloor(g.IO.MousePos);
3627
+ g.LastValidMousePos = g.IO.MousePos;
3627
3628
 
3628
3629
  // If mouse just appeared or disappeared (usually denoted by -FLT_MAX components) we cancel out movement in MouseDelta
3629
3630
  if (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MousePosPrev))
@@ -5982,7 +5983,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
5982
5983
  if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
5983
5984
  if (viewport_rect.GetWidth() > 0.0f && viewport_rect.GetHeight() > 0.0f)
5984
5985
  ClampWindowRect(window, visibility_rect);
5985
- window->Pos = ImFloor(window->Pos);
5986
+ // Keep the fractional position of children inside a scrolling parent.
5986
5987
 
5987
5988
  // Lock window rounding for the frame (so that altering them doesn't cause inconsistencies)
5988
5989
  // Large values tend to lead to variety of artifacts and are not recommended.
@@ -6162,8 +6163,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
6162
6163
  const bool allow_scrollbar_y = !(flags & ImGuiWindowFlags_NoScrollbar);
6163
6164
  const float work_rect_size_x = (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : ImMax(allow_scrollbar_x ? window->ContentSize.x : 0.0f, window->Size.x - window->WindowPadding.x * 2.0f - window->ScrollbarSizes.x));
6164
6165
  const float work_rect_size_y = (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : ImMax(allow_scrollbar_y ? window->ContentSize.y : 0.0f, window->Size.y - window->WindowPadding.y * 2.0f - decoration_up_height - window->ScrollbarSizes.y));
6165
- window->WorkRect.Min.x = ImFloor(window->InnerRect.Min.x - window->Scroll.x + ImMax(window->WindowPadding.x, window->WindowBorderSize));
6166
- window->WorkRect.Min.y = ImFloor(window->InnerRect.Min.y - window->Scroll.y + ImMax(window->WindowPadding.y, window->WindowBorderSize));
6166
+ window->WorkRect.Min.x = window->InnerRect.Min.x - window->Scroll.x + ImMax(window->WindowPadding.x, window->WindowBorderSize);
6167
+ window->WorkRect.Min.y = window->InnerRect.Min.y - window->Scroll.y + ImMax(window->WindowPadding.y, window->WindowBorderSize);
6167
6168
  window->WorkRect.Max.x = window->WorkRect.Min.x + work_rect_size_x;
6168
6169
  window->WorkRect.Max.y = window->WorkRect.Min.y + work_rect_size_y;
6169
6170
  window->ParentWorkRect = window->WorkRect;
@@ -6671,7 +6672,7 @@ void ImGui::SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond)
6671
6672
 
6672
6673
  // Set
6673
6674
  const ImVec2 old_pos = window->Pos;
6674
- window->Pos = ImFloor(pos);
6675
+ window->Pos = pos;
6675
6676
  ImVec2 offset = window->Pos - old_pos;
6676
6677
  window->DC.CursorPos += offset; // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor
6677
6678
  window->DC.CursorMaxPos += offset; // And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected.
@@ -7307,8 +7308,8 @@ void ImGui::ItemSize(const ImVec2& size, float text_baseline_y)
7307
7308
  //if (g.IO.KeyAlt) window->DrawList->AddRect(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, line_height), IM_COL32(255,0,0,200)); // [DEBUG]
7308
7309
  window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x + size.x;
7309
7310
  window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y;
7310
- window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); // Next line
7311
- window->DC.CursorPos.y = IM_FLOOR(window->DC.CursorPos.y + line_height + g.Style.ItemSpacing.y); // Next line
7311
+ window->DC.CursorPos.x = window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x; // Next line
7312
+ window->DC.CursorPos.y = window->DC.CursorPos.y + line_height + g.Style.ItemSpacing.y; // Next line
7312
7313
  window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x);
7313
7314
  window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y - g.Style.ItemSpacing.y);
7314
7315
  //if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG]
@@ -7779,8 +7780,8 @@ static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window)
7779
7780
  scroll_target_y = CalcScrollEdgeSnap(scroll_target_y, snap_y_min, snap_y_max, window->ScrollTargetEdgeSnapDist.y, center_y_ratio);
7780
7781
  scroll.y = scroll_target_y - center_y_ratio * (window->SizeFull.y - window->ScrollbarSizes.y - decoration_up_height);
7781
7782
  }
7782
- scroll.x = IM_FLOOR(ImMax(scroll.x, 0.0f));
7783
- scroll.y = IM_FLOOR(ImMax(scroll.y, 0.0f));
7783
+ scroll.x = ImMax(scroll.x, 0.0f);
7784
+ scroll.y = ImMax(scroll.y, 0.0f);
7784
7785
  if (!window->Collapsed && !window->SkipItems)
7785
7786
  {
7786
7787
  scroll.x = ImMin(scroll.x, window->ScrollMax.x);
@@ -7882,7 +7883,7 @@ void ImGui::SetScrollY(float scroll_y)
7882
7883
  void ImGui::SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio)
7883
7884
  {
7884
7885
  IM_ASSERT(center_x_ratio >= 0.0f && center_x_ratio <= 1.0f);
7885
- window->ScrollTarget.x = IM_FLOOR(local_x + window->Scroll.x); // Convert local position to scroll offset
7886
+ window->ScrollTarget.x = local_x + window->Scroll.x; // Convert local position to scroll offset
7886
7887
  window->ScrollTargetCenterRatio.x = center_x_ratio;
7887
7888
  window->ScrollTargetEdgeSnapDist.x = 0.0f;
7888
7889
  }
@@ -7891,7 +7892,7 @@ void ImGui::SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y
7891
7892
  {
7892
7893
  IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f);
7893
7894
  local_y -= window->TitleBarHeight() + window->MenuBarHeight(); // FIXME: Would be nice to have a more standardized access to our scrollable/client rect
7894
- window->ScrollTarget.y = IM_FLOOR(local_y + window->Scroll.y); // Convert local position to scroll offset
7895
+ window->ScrollTarget.y = local_y + window->Scroll.y; // Convert local position to scroll offset
7895
7896
  window->ScrollTargetCenterRatio.y = center_y_ratio;
7896
7897
  window->ScrollTargetEdgeSnapDist.y = 0.0f;
7897
7898
  }
@@ -34,6 +34,7 @@ Index of this file:
34
34
  #endif
35
35
 
36
36
  #include "imgui_internal.h"
37
+ // Melty subpixel coordinates: keep layout/input fractional; align text at rasterization.
37
38
  #ifdef IMGUI_ENABLE_FREETYPE
38
39
  #include "misc/freetype/imgui_freetype.h"
39
40
  #endif
@@ -3469,6 +3470,23 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons
3469
3470
  return text_size;
3470
3471
  }
3471
3472
 
3473
+ // Melty text pixel alignment: quantize only the glyph origin, in framebuffer
3474
+ // pixels. Layout, scroll offsets and hit testing keep their fractional values.
3475
+ static ImVec2 ImFontSnapToPixelGrid(const ImVec2& pos)
3476
+ {
3477
+ #ifdef IMGUI_ENABLE_FRACTIONAL_TEXT
3478
+ // The iOS runtime opts into continuous motion with its dense font atlas.
3479
+ return pos;
3480
+ #else
3481
+ const ImVec2 scale = GImGui ? GImGui->IO.DisplayFramebufferScale : ImVec2(1.0f, 1.0f);
3482
+ const ImVec2 origin = GImGui ? ImGui::GetMainViewport()->Pos : ImVec2(0.0f, 0.0f);
3483
+ const float sx = scale.x > 0.0f ? scale.x : 1.0f;
3484
+ const float sy = scale.y > 0.0f ? scale.y : 1.0f;
3485
+ return ImVec2(origin.x + ImFloorStd((pos.x - origin.x) * sx) / sx,
3486
+ origin.y + ImFloorStd((pos.y - origin.y) * sy) / sy);
3487
+ #endif
3488
+ }
3489
+
3472
3490
  void ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const
3473
3491
  {
3474
3492
  const ImFontGlyph* glyph = FindGlyph(c);
@@ -3477,8 +3495,7 @@ void ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
3477
3495
  if (glyph->Colored)
3478
3496
  col |= ~IM_COL32_A_MASK;
3479
3497
  float scale = (size >= 0.0f) ? (size / FontSize) : 1.0f;
3480
- pos.x = IM_FLOOR(pos.x);
3481
- pos.y = IM_FLOOR(pos.y);
3498
+ pos = ImFontSnapToPixelGrid(pos);
3482
3499
  draw_list->PrimReserve(6, 4);
3483
3500
  draw_list->PrimRectUV(ImVec2(pos.x + glyph->X0 * scale, pos.y + glyph->Y0 * scale), ImVec2(pos.x + glyph->X1 * scale, pos.y + glyph->Y1 * scale), ImVec2(glyph->U0, glyph->V0), ImVec2(glyph->U1, glyph->V1), col);
3484
3501
  }
@@ -3488,9 +3505,8 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
3488
3505
  if (!text_end)
3489
3506
  text_end = text_begin + strlen(text_begin); // ImGui:: functions generally already provides a valid text_end, so this is merely to handle direct calls.
3490
3507
 
3491
- // Align to be pixel perfect
3492
- pos.x = IM_FLOOR(pos.x);
3493
- pos.y = IM_FLOOR(pos.y);
3508
+ // Align glyphs to physical pixels without rounding the logical cursor.
3509
+ pos = ImFontSnapToPixelGrid(pos);
3494
3510
  float x = pos.x;
3495
3511
  float y = pos.y;
3496
3512
  if (y > clip_rect.w)
@@ -3795,7 +3795,7 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiOldColumnFl
3795
3795
  float width = offset_1 - offset_0;
3796
3796
  PushItemWidth(width * 0.65f);
3797
3797
  window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);
3798
- window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
3798
+ window->DC.CursorPos.x = window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x;
3799
3799
  window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding;
3800
3800
  }
3801
3801
 
@@ -3810,7 +3810,7 @@ void ImGui::NextColumn()
3810
3810
 
3811
3811
  if (columns->Count == 1)
3812
3812
  {
3813
- window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
3813
+ window->DC.CursorPos.x = window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x;
3814
3814
  IM_ASSERT(columns->Current == 0);
3815
3815
  return;
3816
3816
  }
@@ -3841,7 +3841,7 @@ void ImGui::NextColumn()
3841
3841
  window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);
3842
3842
  columns->LineMinY = columns->LineMaxY;
3843
3843
  }
3844
- window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
3844
+ window->DC.CursorPos.x = window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x;
3845
3845
  window->DC.CursorPos.y = columns->LineMinY;
3846
3846
  window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);
3847
3847
  window->DC.CurrLineTextBaseOffset = 0.0f;
@@ -3927,7 +3927,7 @@ void ImGui::EndColumns()
3927
3927
  window->ParentWorkRect = columns->HostBackupParentWorkRect;
3928
3928
  window->DC.CurrentColumns = NULL;
3929
3929
  window->DC.ColumnsOffset.x = 0.0f;
3930
- window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
3930
+ window->DC.CursorPos.x = window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x;
3931
3931
  }
3932
3932
 
3933
3933
  void ImGui::Columns(int columns_count, const char* id, bool border)