Closed AllenDang closed 8 months ago
@AllenDang can't say whats wrong... It works for me. Could you try debugger?
I have the same error as above
MacOS 13.6 Xcode Version 15.0 (15A240d) Go go1.21.1 darwin/arm64
i'm noob and from quick google, i found related issues
well, I see that there is something wrong with mainthread... Unfortunately I can't reproduce (as I have no access to any mac machine) and on my fedora linux everything works in both giu and cimgui-go.
@AllenDang could you take a look on this issue plz :pray:
use https://pkg.go.dev/golang.design/x/hotkey/mainthread fix the issue for me
import ("golang.design/x/hotkey/mainthread")
mainthread.Call(func() {
clean run without any issue. but i can't test on windows or linux 😅
from the readme in hotkey's repo
On macOS, due to the OS restriction (other platforms does not have this restriction), hotkey events must be handled on the "main thread". Therefore, in order to use this package properly, one must start an OS main event loop on the main thread, For self-contained applications, using golang.design/x/hotkey/mainthread is possible. It is uncessary or applications based on other GUI frameworks, such as fyne, ebiten, or Gio. See the "./examples" folder for more examples.
@voladelta thank you for your really valuale info! At the moment we use some mainthread library. I need to check its usage there...
Will try to test here in fedora now.
linux x64 fedora 39 - wayland go 1.21.1
For me its starts correctly, but in input I got a wrong key code hiting 5
2023/09/28 17:56:56 Unknown key: 325
**panic: Unknown key: 325**
goroutine 18 [running]:
log.Panicf({0x92d975?, 0xc000521c08?}, {0xc000521bf8?, 0x0?, 0x0?})
/home/jgardona/Bin/go/src/log/log.go:439 +0x65
github.com/AllenDang/giu.keyFromGLFWKey(0x0?)
/home/jgardona/Workspace/go/giu/Keycode.go:204 +0x105
github.com/AllenDang/giu.(*MasterWindow).SetInputHandler.func1(0x951f00?, 0xc000521cb8?, 0x557545?, 0x0)
/home/jgardona/Workspace/go/giu/MasterWindow.go:381 +0x38
github.com/AllenDang/cimgui-go.keyCallback(0x0?, 0x145, 0x54, 0x1, 0x0)
/home/jgardona/go/pkg/mod/github.com/!allen!dang/cimgui-go@v0.0.0-20230918114712-675654f053d9/backend.go:72 +0x67
github.com/AllenDang/cimgui-go._Cfunc_igRunLoop(0x1d009e0, 0x55ea60, 0x55eaa0, 0x55eae0, 0x55eb60)
_cgo_gotypes.go:29014 +0x45
github.com/AllenDang/cimgui-go.(*GLFWBackend).Run.func1(0x1?)
/home/jgardona/go/pkg/mod/github.com/!allen!dang/cimgui-go@v0.0.0-20230918114712-675654f053d9/glfw_backend.go:251 +0x9b
github.com/AllenDang/cimgui-go.(*GLFWBackend).Run(0x0?, 0x0?)
/home/jgardona/go/pkg/mod/github.com/!allen!dang/cimgui-go@v0.0.0-20230918114712-675654f053d9/glfw_backend.go:251 +0x32
main.main.(*MasterWindow).Run.func1()
/home/jgardona/Workspace/go/giu/MasterWindow.go:241 +0xcb
github.com/faiface/mainthread.Run.func1()
/home/jgardona/go/pkg/mod/github.com/faiface/mainthread@v0.0.0-20171120011319-8b78f0a41ae3/mainthread.go:37 +0x23
created by github.com/faiface/mainthread.Run in goroutine 1
/home/jgardona/go/pkg/mod/github.com/faiface/mainthread@v0.0.0-20171120011319-8b78f0a41ae3/mainthread.go:36 +0xae
Other way seems to be working on linux.
Another issue I found is that some keys and multiline input doesn't works
@AllenDang @voladelta could you try https://github.com/AllenDang/giu/pull/706 on macos
@AllenDang @voladelta could you try #706 on macos
still crashed if you use Init, should replace to Call
@voladelta changeing this to Init
breaks the example on linux...
@gucio321 Maybe we could use a conditional build here to distinguish macOS/windows/linux
maybe, will do that later
@AllenDang @voladelta should work now. Sorry for delay but still don't have any computer dedicated for effective development
@gucio321 I've just tried it on macOS Sonoma (14.0) with the branch from your pull request and it seems to be working - the windows and widgets open and are responding. I've tried the helloworld
and widgets
examples.
I've noticed that the window closes with the following message in the console when I try to resize the window but that's probably not related to this issue:
File: /Users/runner/work/cimgui-go/cimgui-go/cimgui/imgui/imgui.cpp, Line: 6603
yes so its #716. This is fixed.
What happend?
Failed to start with following error log.
Code example
```golang // put your code here! ```main.go
To Reproduce
go run .
Version
master
OS
macOS v13.5.2