Skip to content

Commit

Permalink
master window: correct input handler so that it passes arguments corr…
Browse files Browse the repository at this point in the history
…ectly
  • Loading branch information
gucio321 committed Sep 17, 2023
1 parent a0ec50d commit c0d9861
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions MasterWindow.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package giu

import (
"image"
"image/color"

imgui "github.com/AllenDang/cimgui-go"
"github.com/faiface/mainthread"
"golang.org/x/image/colornames"
"image"
"image/color"
)

// MasterWindowFlags implements BackendWindowFlags
Expand Down Expand Up @@ -197,9 +198,6 @@ func (w *MasterWindow) beforeRender() {
NewTextureFromRgba(request.img, request.cb)
}
}

// TODO InputHandler not re-implemented yet
// p.ProcessEvents()
}

func (w *MasterWindow) afterRender() {
Expand Down Expand Up @@ -377,13 +375,13 @@ func (w *MasterWindow) SetShouldClose(v bool) {
func (w *MasterWindow) SetInputHandler(handler InputHandler) {
Context.InputHandler = handler

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

// SetAdditionalInputHandlerCallback allows to set an input callback to handle more events (not only these from giu.inputHandler).
Expand Down

0 comments on commit c0d9861

Please sign in to comment.