This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch main
in repository ego.
View the commit online.
commit 050a5696b0abeac25bd996ebd4c4b72a09211370
Author: [email protected] <[email protected]>
AuthorDate: Mon Mar 9 13:00:40 2026 -0600
feat: add Object wrapper API for generated bindings
Generated bindings need to work with Eo object pointers from the C API. This adds
an Objecter interface that abstracts pointer access, allowing bindings to call
Eo() and SetEo() on any wrapper type. The SetEo method properly initializes the
wrapper with a C pointer and registers GC finalizers to manage object lifetime.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
efl/object.go | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/efl/object.go b/efl/object.go
index 09a540c..8d38233 100644
--- a/efl/object.go
+++ b/efl/object.go
@@ -83,6 +83,11 @@ func WrapObject(ptr unsafe.Pointer) *Object {
return o
}
+// Objecter is implemented by any type that wraps an EFL Eo object.
+type Objecter interface {
+ Eo() unsafe.Pointer
+}
+
// Ptr returns the underlying raw Eo pointer. It is nil-safe: calling Ptr on a
// nil *Object returns nil.
func (o *Object) Ptr() unsafe.Pointer {
@@ -92,6 +97,26 @@ func (o *Object) Ptr() unsafe.Pointer {
return o.ptr
}
+// Eo returns the underlying raw Eo pointer. It is an alias for Ptr that
+// satisfies the Objecter interface, used by generated bindings.
+func (o *Object) Eo() unsafe.Pointer {
+ return o.Ptr()
+}
+
+// SetEo sets the underlying raw Eo pointer and registers a GC finalizer.
+// Used by generated bindings to initialise wrapper structs.
+func (o *Object) SetEo(ptr unsafe.Pointer) {
+ o.ptr = ptr
+ if ptr != nil {
+ runtime.SetFinalizer(o, func(obj *Object) {
+ p := obj.ptr
+ Post(func() {
+ C._ego_efl_unref((*C.Eo)(p))
+ })
+ })
+ }
+}
+
// IsNil reports whether the Object has no underlying Eo pointer. It is
// nil-safe: calling IsNil on a nil *Object returns true.
func (o *Object) IsNil() bool {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.