-
Notifications
You must be signed in to change notification settings - Fork 62
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
Macos backend needs a window delegate to capture events. #100
Comments
What's not working in your code? Also if you have any question for how Capy works, you can just ask me on capy's Matrix channel or on my Discord (although I'm more active on Discord) |
I was getting garbage data in the window size. I think the I think Capy uses native apis in both gtk and win32 apis for attaching custom data to widgets, but I'm not aware of something similar in macos. Perhaps we could just have a global hashmap, with the peer as key? Or would that leak? |
Yea that's what
You can absolutely use a global hashmap for this usecase. Although, for the WebAssembly backend, when I faced the same problem, I ended up replacing the peer object by a manually allocated So for the macOS backend, this would be equivalent to replacing, in const GuiWidget = struct {
object: objc.Object,
// Either include EventUserData or just copy its fields. Although including
// it might be better.
data: EventUserData,
}; Then in |
I don't really see how the GuiWidget struct helps. in https://github.com/geon/capy/blob/1a22e734cb0fdd4504b388f11bf675a80dc40b29/src/backends/macos/CapyWindowDelegate.zig#L20 , I get access to the NSWindow, , but in the windowDidResize callback I can't use any kind of closure to access the GuiWidget outside the callback. |
I have some code halfway working in a branch, but I'm not sure how Capy works internally.
https://github.com/geon/capy/tree/window-delegate
The text was updated successfully, but these errors were encountered: