diff --git a/examples/demo_window.jl b/examples/demo_window.jl index 9ec9684..8ac77ed 100644 --- a/examples/demo_window.jl +++ b/examples/demo_window.jl @@ -148,14 +148,14 @@ global function ShowJuliaDemoWindow(p_open::Ref{Bool}) if CImGui.CollapsingHeader("Configuration") io = CImGui.GetIO() if CImGui.TreeNode("Configuration##2") - CImGui.CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", io.ConfigFlags, CImGui.ImGuiConfigFlags_NavEnableKeyboard) - CImGui.CheckboxFlags("io.ConfigFlags: NavEnableGamepad", io.ConfigFlags, CImGui.ImGuiConfigFlags_NavEnableGamepad) + CImGui.CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", @ptr(io.ConfigFlags), CImGui.ImGuiConfigFlags_NavEnableKeyboard) + CImGui.CheckboxFlags("io.ConfigFlags: NavEnableGamepad", @ptr(io.ConfigFlags), CImGui.ImGuiConfigFlags_NavEnableGamepad) CImGui.SameLine() CImGui.HelpMarker("Required back-end to feed in gamepad inputs in io.NavInputs[] and set io.BackendFlags |= ImGuiBackendFlags_HasGamepad.\n\nRead instructions in imgui.cpp for details."); - CImGui.CheckboxFlags("io.ConfigFlags: NavEnableSetMousePos", io.ConfigFlags, CImGui.ImGuiConfigFlags_NavEnableSetMousePos) + CImGui.CheckboxFlags("io.ConfigFlags: NavEnableSetMousePos", @ptr(io.ConfigFlags), CImGui.ImGuiConfigFlags_NavEnableSetMousePos) CImGui.SameLine() CImGui.HelpMarker("Instruct navigation to move the mouse cursor. See comment for ImGuiConfigFlags_NavEnableSetMousePos.") - CImGui.CheckboxFlags("io.ConfigFlags: NoMouse", io.ConfigFlags, CImGui.ImGuiConfigFlags_NoMouse) + CImGui.CheckboxFlags("io.ConfigFlags: NoMouse", @ptr(io.ConfigFlags), CImGui.ImGuiConfigFlags_NoMouse) if io.ConfigFlags & CImGui.ImGuiConfigFlags_NoMouse != 0 # create a way to restore this flag otherwise we could be stuck completely! if mod(CImGui.GetTime(), 0.4) < 0.2 CImGui.SameLine() @@ -165,17 +165,17 @@ global function ShowJuliaDemoWindow(p_open::Ref{Bool}) io.ConfigFlags = io.ConfigFlags & ~Cuint(CImGui.ImGuiConfigFlags_NoMouse) end end - CImGui.CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", io.ConfigFlags, CImGui.ImGuiConfigFlags_NoMouseCursorChange) + CImGui.CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", @ptr(io.ConfigFlags), CImGui.ImGuiConfigFlags_NoMouseCursorChange) CImGui.SameLine() CImGui.HelpMarker("Instruct back-end to not alter mouse cursor shape and visibility.") - CImGui.Checkbox("io.ConfigInputTextCursorBlink", io.ConfigInputTextCursorBlink) + CImGui.Checkbox("io.ConfigInputTextCursorBlink", @ptr(io.ConfigInputTextCursorBlink)) CImGui.SameLine() CImGui.HelpMarker("Set to false to disable blinking cursor, for users who consider it distracting") - CImGui.Checkbox("io.ConfigWindowsResizeFromEdges", io.ConfigWindowsResizeFromEdges) + CImGui.Checkbox("io.ConfigWindowsResizeFromEdges", @ptr(io.ConfigWindowsResizeFromEdges)) CImGui.SameLine() CImGui.HelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback.") - CImGui.Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", io.ConfigWindowsMoveFromTitleBarOnly) - CImGui.Checkbox("io.MouseDrawCursor", io.MouseDrawCursor) + CImGui.Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", @ptr(io.ConfigWindowsMoveFromTitleBarOnly)) + CImGui.Checkbox("io.MouseDrawCursor", @ptr(io.MouseDrawCursor)) CImGui.SameLine() CImGui.HelpMarker("Instruct Dear ImGui to render a mouse cursor for you. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).") CImGui.TreePop() diff --git a/examples/makie_demo.jl b/examples/makie_demo.jl index ad94eb5..5cc7b0c 100644 --- a/examples/makie_demo.jl +++ b/examples/makie_demo.jl @@ -32,8 +32,8 @@ function makie_demo(; engine=nothing, spawn=1) ctx = ig.CreateContext() io = ig.GetIO() - io.ConfigFlags = unsafe_load(io.ConfigFlags) | ig.lib.ImGuiConfigFlags_DockingEnable - io.ConfigFlags = unsafe_load(io.ConfigFlags) | ig.lib.ImGuiConfigFlags_ViewportsEnable + io.ConfigFlags = io.ConfigFlags | ig.lib.ImGuiConfigFlags_DockingEnable + io.ConfigFlags = io.ConfigFlags | ig.lib.ImGuiConfigFlags_ViewportsEnable auto_resize_x = true auto_resize_y = false diff --git a/lib/aarch64-apple-darwin20.jl b/lib/aarch64-apple-darwin20.jl index 44b62b2..bc15a97 100644 --- a/lib/aarch64-apple-darwin20.jl +++ b/lib/aarch64-apple-darwin20.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/aarch64-linux-gnu.jl b/lib/aarch64-linux-gnu.jl index 254a057..240b788 100644 --- a/lib/aarch64-linux-gnu.jl +++ b/lib/aarch64-linux-gnu.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/aarch64-linux-musl.jl b/lib/aarch64-linux-musl.jl index bceb211..323d07a 100644 --- a/lib/aarch64-linux-musl.jl +++ b/lib/aarch64-linux-musl.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/armv7l-linux-gnueabihf.jl b/lib/armv7l-linux-gnueabihf.jl index d84e8e0..4d9525f 100644 --- a/lib/armv7l-linux-gnueabihf.jl +++ b/lib/armv7l-linux-gnueabihf.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/armv7l-linux-musleabihf.jl b/lib/armv7l-linux-musleabihf.jl index ccb8fa3..154d5ed 100644 --- a/lib/armv7l-linux-musleabihf.jl +++ b/lib/armv7l-linux-musleabihf.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/i686-linux-gnu.jl b/lib/i686-linux-gnu.jl index 0a21f9c..269ab2c 100644 --- a/lib/i686-linux-gnu.jl +++ b/lib/i686-linux-gnu.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/i686-linux-musl.jl b/lib/i686-linux-musl.jl index c6c49fe..a831e8b 100644 --- a/lib/i686-linux-musl.jl +++ b/lib/i686-linux-musl.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/i686-w64-mingw32.jl b/lib/i686-w64-mingw32.jl index 7d702b2..96d3ca8 100644 --- a/lib/i686-w64-mingw32.jl +++ b/lib/i686-w64-mingw32.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/powerpc64le-linux-gnu.jl b/lib/powerpc64le-linux-gnu.jl index 254a057..240b788 100644 --- a/lib/powerpc64le-linux-gnu.jl +++ b/lib/powerpc64le-linux-gnu.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/x86_64-apple-darwin14.jl b/lib/x86_64-apple-darwin14.jl index 44b62b2..bc15a97 100644 --- a/lib/x86_64-apple-darwin14.jl +++ b/lib/x86_64-apple-darwin14.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/x86_64-linux-gnu.jl b/lib/x86_64-linux-gnu.jl index 254a057..240b788 100644 --- a/lib/x86_64-linux-gnu.jl +++ b/lib/x86_64-linux-gnu.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/x86_64-linux-musl.jl b/lib/x86_64-linux-musl.jl index bceb211..323d07a 100644 --- a/lib/x86_64-linux-musl.jl +++ b/lib/x86_64-linux-musl.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/x86_64-unknown-freebsd13.2.jl b/lib/x86_64-unknown-freebsd13.2.jl index 36d91b7..6fe8240 100644 --- a/lib/x86_64-unknown-freebsd13.2.jl +++ b/lib/x86_64-unknown-freebsd13.2.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/lib/x86_64-w64-mingw32.jl b/lib/x86_64-w64-mingw32.jl index 75d203f..a0fe6f7 100644 --- a/lib/x86_64-w64-mingw32.jl +++ b/lib/x86_64-w64-mingw32.jl @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value) end macro ptr(expr) - if !isa(expr, Expr) || expr.head != :. - error("Expression is not a property access") + if !Meta.isexpr(expr, :.) + error("Expression is not a property access, cannot use @ptr on it.") end - + quote local penultimate_obj = $(esc(expr.args[1])) - (@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2]))) + getptr(penultimate_obj, $(esc(expr.args[2]))) end end diff --git a/src/lib.jl b/src/lib.jl index f0e729a..76ff814 100644 --- a/src/lib.jl +++ b/src/lib.jl @@ -89,7 +89,7 @@ function igLogText(text) end # exports -const PREFIXES = ["ig", "Im", "IMGUI_", "imnodes_", "ImPlot_", "ImVector_"] +const PREFIXES = ["ig", "Im", "IMGUI_", "imnodes_", "ImPlot_", "ImVector_", "@ptr"] for name in names(@__MODULE__; all=true), prefix in PREFIXES if startswith(string(name), prefix) @eval export $name