Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CImGui"
uuid = "5d785b6c-b76f-510e-a07c-3070796c7e87"
authors = ["Yupei Qi <qiyupei@gmail.com>"]
version = "6.2.1"
version = "7.0.0"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand All @@ -23,7 +23,7 @@ MakieIntegration = ["GLFW", "ModernGL", "GLMakie"]

[compat]
CEnum = "0.4, 0.5"
CImGuiPack_jll = "0.10.0"
CImGuiPack_jll = "0.11.0"
CSyntax = "0.4"
DocStringExtensions = "0.9.3"
GLFW = "3"
Expand Down
7 changes: 6 additions & 1 deletion docs/src/_changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ CurrentModule = CImGui
This documents notable changes in CImGui.jl. The format is based on [Keep a
Changelog](https://keepachangelog.com).

## Unreleased
## [v7.0.0] - 2026-01-05

### Changed
- **Breaking**: We updated to [Dear ImGui
1.92.5](https://github.com/ocornut/imgui/releases/tag/v1.92.5) ([#189]). All
the changes from 1.92.2 - 1.92.5 apply to this release.

### Fixed
- Fixed a typo in `destroy_image_texture()` ([#185]).
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_layout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function ShowDemoWindowLayout()
if (tab_bar_flags & CImGui.ImGuiTabBarFlags_FittingPolicyMask_) == 0
tab_bar_flags |= CImGui.ImGuiTabBarFlags_FittingPolicyDefault_
end
result = @c CImGui.CheckboxFlags("ImGuiTabBarFlags_FittingPolicyResizeDown", &tab_bar_flags, CImGui.ImGuiTabBarFlags_FittingPolicyResizeDown)
result = @c CImGui.CheckboxFlags("ImGuiTabBarFlags_FittingPolicyShrink", &tab_bar_flags, CImGui.ImGuiTabBarFlags_FittingPolicyShrink)
if result != 0
tab_bar_flags &= ~(CImGui.ImGuiTabBarFlags_FittingPolicyMask_ ⊻ CImGui.ImGuiTabBarFlags_FittingPolicyResizeDown)
end
Expand Down
72 changes: 34 additions & 38 deletions gen/generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import JSON3
using Clang.Generators
using Clang.JLLEnvs
using CImGuiPack_jll
import JuliaFormatter: format_file, format_text
import MacroTools: @capture, splitdef, prettify
using JuliaFormatter: format_file, format_text
using MacroTools: @capture, splitdef, prettify, postwalk


"""
Expand Down Expand Up @@ -319,15 +319,8 @@ function wrap_function!(methods, func_name, func_def, overloads; with_arg_types=
arg_types_strs = [func_metadata[:argsT][i][:type] for i in eachindex(arg_names)]

args = copy(arg_names)
is_pOut = false

for i in eachindex(args)
# pOut arguments are part of cimgui and are a pointer to a return value,
# to be filled in by the cimgui function.
if arg_names[i] == :pOut
is_pOut = true
end

arg_type_str = arg_types_strs[i]

# If this is the `self` argument and this function belongs to a struct,
Expand Down Expand Up @@ -384,35 +377,11 @@ function wrap_function!(methods, func_name, func_def, overloads; with_arg_types=
arg_names[i] = :(length($(arg_names[i - 1])))
end

func_expr = if is_pOut
ccall_info = split_ccall(func_def[:body])
local pOut_type
if !@capture(ccall_info.argtypes[1], Ptr{pOut_type_})
@warn "Skipping '$func_name', couldn't get type of the `pOut` argument"
return
end

popfirst!(args)
popfirst!(arg_names)

# Special-case HSV() because it should return an ImVec4 instead of an ImColor
return_expr = if func_name === :ImColor_HSV
:(pOut[].Value)
else
:(pOut[])
end

quote
function $new_identifier($(args...))
pOut = Ref{$pOut_type}()
$func_name(pOut, $(arg_names...))
return $return_expr
end
end
# Special-case HSV() because it should return an ImVec4 instead of an ImColor
func_expr = if func_name === :ImColor_HSV
:($new_identifier($(args...)) = $func_name($(arg_names...)).Value)
else
quote
$new_identifier($(args...)) = $func_name($(arg_names...))
end
:($new_identifier($(args...)) = $func_name($(arg_names...)))
end

docstring = create_docstring(func_name, func_metadata)
Expand Down Expand Up @@ -511,6 +480,31 @@ function get_wrappers(dag::ExprDAG)
return methods
end

function rewrite!(dag)
# In newer versions of the cimgui bindings non-POD-types-that-look-like-POD-types-but-actually-aren't
# are renamed to have a '_c' underscore. In the generated Julia bindings we
# rename these back to their old names for the sake of convenience.
# See: https://github.com/cimgui/cimgui/issues/309
new2old_names = Dict{Symbol, Symbol}()
for file in (:cimgui_structs_and_enums, :cimplot_structs_and_enums, :cimnodes_structs_and_enums)
structs_and_enums = JSON3.read(getproperty(CImGuiPack_jll, file))
nonpod_used = structs_and_enums[:nonPOD_used]
merge!(new2old_names, Dict([Symbol(x, "_c") => x for x in keys(nonpod_used)]))
end

for node in dag.nodes
for i in eachindex(node.exprs)
node.exprs[i] = postwalk(node.exprs[i]) do x
if x isa Symbol && x in keys(new2old_names)
new2old_names[x]
else
x
end
end
end
end
end

function generate()
cd(@__DIR__) do
include_dir = joinpath(CImGuiPack_jll.artifact_dir, "include")
Expand Down Expand Up @@ -541,7 +535,9 @@ function generate()
"-includestdbool.h")

ctx = create_context([cimgui_h, cimplot_h, cimnodes_h, cimgui_impl_h], args, options)
build!(ctx)
build!(ctx, BUILDSTAGE_NO_PRINTING)
rewrite!(ctx.dag)
build!(ctx, BUILDSTAGE_PRINTING_ONLY)
end

println()
Expand Down
4 changes: 2 additions & 2 deletions gen/generator.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ field_access_method_list = [
"ImFontConfig",
"ImGuiPlatformIO",
"ImGuiViewport",
"ImVec2",
"ImVec4",
"ImVec2_c",
"ImVec4_c",
"ImGuiPlatformMonitor",
"ImGuiStyle",
"ImGuiListClipper",
Expand Down
Loading
Loading