Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitelist certain internal functions #118

Closed
wants to merge 1 commit into from

Conversation

ptxmac
Copy link
Contributor

@ptxmac ptxmac commented Apr 2, 2023

Some of the functions in imgui_internal can be useful, and sometimes the only way to archive a certain feature.

My use-case is a window that doesn't respond to hit test for a section where I'm displaying a texture. This will forward the mouse / keyboard events to the rest of my app instead.

@ptxmac
Copy link
Contributor Author

ptxmac commented Apr 2, 2023

The SetWindowHitTestHole function is mentioned in ocornut/imgui#3368 and work on creating a non-internal approach was discussed but abandoned in ocornut/imgui#1512

@gucio321
Copy link
Collaborator

gucio321 commented Apr 2, 2023

@ptxmac maybe it is possible to do this on cimgui level?
I mean if cimgui can generate json output with imgui_internal functions as ewll, imo it'd be better to do it there.

@ptxmac
Copy link
Contributor Author

ptxmac commented Apr 2, 2023

@gucio321 the functions are already in definitions.json, but the codegen ignores all functions coming from "imgui_internal".
I crated this whitelist to selectively include a few of them again (including all of them results in compile errors)

@gucio321
Copy link
Collaborator

gucio321 commented Apr 2, 2023

interessting... Why exactly did we exclude them? Maybe we'd rather focus on fixing this compilation issue? @AllenDang?

@AllenDang
Copy link
Owner

@gucio321 I'd rather focus on fixing the compilation issue...

@ptxmac
Copy link
Contributor Author

ptxmac commented Apr 3, 2023

A quick snapshot of some of the errors if we generate all internal functions:

$ go run examples/main.go
# github.com/AllenDang/cimgui-go
./cimgui_funcs.go:3785:6: ItemFlags redeclared in this block
	./cimgui_enums.go:540:6: other declaration of ItemFlags
./cimgui_funcs.go:3826:6: ItemStatusFlags redeclared in this block
	./cimgui_enums.go:557:6: other declaration of ItemStatusFlags
./cimgui_structs.go:514:6: InputTextState redeclared in this block
	./cimgui_funcs.go:3781:6: other declaration of InputTextState
./cimgui_structs.go:528:6: KeyData redeclared in this block
	./cimgui_funcs.go:3830:6: other declaration of KeyData
./cimgui_structs.go:542:6: KeyOwnerData redeclared in this block
	./cimgui_funcs.go:3857:6: other declaration of KeyOwnerData
./cimgui_funcs.go:3781:28: InputTextState (value of type func()) is not a type
./cimgui_funcs.go:3782:26: cannot use unsafe.Pointer((C.igGetInputTextState)(C.ImGuiID(id))) (value of type unsafe.Pointer) as ID value in argument to (InputTextState)
./cimgui_funcs.go:3857:28: KeyOwnerData (value of type func()) is not a type
./cimgui_funcs.go:3830:23: KeyData (value of type func()) is not a type
./cimgui_funcs.go:1024:26: cannot use unsafe.Pointer(func() *C.struct_ImGuiInputTextState {…}()) (value of type unsafe.Pointer) as ID value in argument to (InputTextState)
./cimgui_funcs.go:1024:26: too many errors

@gucio321
Copy link
Collaborator

gucio321 commented Apr 3, 2023

well, in my opinion we may rename thing coming from imgui-internal to "InternalXYZ". This way we will not have duplicates and everyone will know what is going on.

@ptxmac
Copy link
Contributor Author

ptxmac commented Apr 4, 2023

Superseded by #119

@ptxmac ptxmac closed this Apr 4, 2023
@ptxmac ptxmac deleted the export_internal branch April 16, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants