AllenDang / giu

Cross platform rapid GUI framework for golang based on Dear ImGui.
MIT License
2.11k stars 127 forks source link

## Reason #769

Closed gucio321 closed 4 months ago

gucio321 commented 4 months ago
          ## Reason

in imgui_impl_glfw.cpp:

    glfwSetKeyCallback(vd->Window, ImGui_ImplGlfw_KeyCallback);

in glfw_backend.cpp:

void igGLFWWindow_SetKeyCallback(GLFWwindow *wnd) { glfwSetKeyCallback(wnd, (GLFWkeyfun)keyCallback); }

which is wrapped in glfw_backend.go:

func (b *GLFWBackend) SetKeyCallback(cbfun KeyCallback) {
        b.keyCb = cbfun
        C.igGLFWWindow_SetKeyCallback(b.handle())
}

and in giu we do (in MasterWindow.go):

        w.backend.SetKeyCallback(func(key, scanCode, action, modifier int) {
                fmt.Println(key, scanCode, action, modifier)
                k, m, a := keyFromGLFWKey(imgui.GLFWKey(key)), Modifier(modifier), Action(action)
                handler.Handle(k, m, a)
                if w.additionalInputCallback != nil {
                        w.additionalInputCallback(k, m, a)
                }
        })

conclusion: we overwrite imgui's internal stuff. This issue should escalate to cimgui-go

Originally posted by @gucio321 in https://github.com/AllenDang/giu/issues/754#issuecomment-1954950993

gucio321 commented 4 months ago

well, idk why this is here... closing as duplicat of #754