From de1f0f012b86a483f3ce1abc65965012a2bd086d Mon Sep 17 00:00:00 2001 From: Jared Wahlstrand Date: Sat, 9 Nov 2024 17:17:11 -0500 Subject: [PATCH] fix methods that return non-opaque structs --- GI/src/giimport.jl | 1 + src/gen/cairo_structs | 6 ++++ src/gen/gdk4_structs | 9 +++++ src/gen/gdkpixbuf_structs | 6 ++++ src/gen/gio_structs | 15 ++++++++ src/gen/glib_structs | 24 +++++++++++++ src/gen/gobject_structs | 45 +++++++++++++++++++++++ src/gen/graphene_structs | 51 ++++++++++++++++++++++++++ src/gen/gsk4_structs | 9 +++++ src/gen/gtk4_structs | 27 ++++++++++++++ src/gen/pango_structs | 75 +++++++++++++++++++++++++++++++++++++++ test/graphene.jl | 10 ++++++ test/runtests.jl | 4 +++ 13 files changed, 282 insertions(+) create mode 100644 test/graphene.jl diff --git a/GI/src/giimport.jl b/GI/src/giimport.jl index 7fdc0a48..499de495 100644 --- a/GI/src/giimport.jl +++ b/GI/src/giimport.jl @@ -127,6 +127,7 @@ function decl(structinfo::GIStructInfo,force_opaque=false) unsafe_convert(::Type{Ptr{$ustructname}}, box::$gstructname) = convert(Ptr{$ustructname}, box.handle) convert(::Type{$gstructname}, p::Ptr{$ustructname}, owns = false) = $gstructname(p, owns) const $structlike = Union{Ref{$ustructname},$gstructname} + convert(::Type{$structlike}, p, owns) = convert($gstructname, p, owns) end else conv = quote diff --git a/src/gen/cairo_structs b/src/gen/cairo_structs index c3c80e2e..6fbe6070 100644 --- a/src/gen/cairo_structs +++ b/src/gen/cairo_structs @@ -214,6 +214,9 @@ $(Expr(:toplevel, quote cairoRectangle(p, owns) end const cairoRectangleLike = Union{Ref{_cairoRectangle}, cairoRectangle} + convert(::Type{cairoRectangleLike}, p, owns) = begin + convert(cairoRectangle, p, owns) + end end end begin @@ -249,6 +252,9 @@ $(Expr(:toplevel, quote cairoRectangleInt(p, owns) end const cairoRectangleIntLike = Union{Ref{_cairoRectangleInt}, cairoRectangleInt} + convert(::Type{cairoRectangleIntLike}, p, owns) = begin + convert(cairoRectangleInt, p, owns) + end end end gboxed_cache_init() = begin diff --git a/src/gen/gdk4_structs b/src/gen/gdk4_structs index ed161c07..ebaaa1c7 100644 --- a/src/gen/gdk4_structs +++ b/src/gen/gdk4_structs @@ -150,6 +150,9 @@ $(Expr(:toplevel, quote GdkKeymapKey(p, owns) end const GdkKeymapKeyLike = Union{Ref{_GdkKeymapKey}, GdkKeymapKey} + convert(::Type{GdkKeymapKeyLike}, p, owns) = begin + convert(GdkKeymapKey, p, owns) + end end end begin @@ -206,6 +209,9 @@ $(Expr(:toplevel, quote GdkRGBA(p, owns) end const GdkRGBALike = Union{Ref{_GdkRGBA}, GdkRGBA} + convert(::Type{GdkRGBALike}, p, owns) = begin + convert(GdkRGBA, p, owns) + end end end begin @@ -241,6 +247,9 @@ $(Expr(:toplevel, quote GdkRectangle(p, owns) end const GdkRectangleLike = Union{Ref{_GdkRectangle}, GdkRectangle} + convert(::Type{GdkRectangleLike}, p, owns) = begin + convert(GdkRectangle, p, owns) + end end end begin diff --git a/src/gen/gdkpixbuf_structs b/src/gen/gdkpixbuf_structs index ca1716ca..b6291dd3 100644 --- a/src/gen/gdkpixbuf_structs +++ b/src/gen/gdkpixbuf_structs @@ -18,6 +18,9 @@ $(Expr(:toplevel, quote GdkPixbufModulePattern(p, owns) end const GdkPixbufModulePatternLike = Union{Ref{_GdkPixbufModulePattern}, GdkPixbufModulePattern} + convert(::Type{GdkPixbufModulePatternLike}, p, owns) = begin + convert(GdkPixbufModulePattern, p, owns) + end end end begin @@ -58,6 +61,9 @@ $(Expr(:toplevel, quote GdkPixbufFormat(p, owns) end const GdkPixbufFormatLike = Union{Ref{_GdkPixbufFormat}, GdkPixbufFormat} + convert(::Type{GdkPixbufFormatLike}, p, owns) = begin + convert(GdkPixbufFormat, p, owns) + end end end gboxed_cache_init() = begin diff --git a/src/gen/gio_structs b/src/gen/gio_structs index 56185696..646cc38b 100644 --- a/src/gen/gio_structs +++ b/src/gen/gio_structs @@ -16,6 +16,9 @@ $(Expr(:toplevel, quote GDBusErrorEntry(p, owns) end const GDBusErrorEntryLike = Union{Ref{_GDBusErrorEntry}, GDBusErrorEntry} + convert(::Type{GDBusErrorEntryLike}, p, owns) = begin + convert(GDBusErrorEntry, p, owns) + end end end begin @@ -35,6 +38,9 @@ $(Expr(:toplevel, quote GFileAttributeInfo(p, owns) end const GFileAttributeInfoLike = Union{Ref{_GFileAttributeInfo}, GFileAttributeInfo} + convert(::Type{GFileAttributeInfoLike}, p, owns) = begin + convert(GFileAttributeInfo, p, owns) + end end end begin @@ -68,6 +74,9 @@ $(Expr(:toplevel, quote GFileAttributeInfoList(p, owns) end const GFileAttributeInfoListLike = Union{Ref{_GFileAttributeInfoList}, GFileAttributeInfoList} + convert(::Type{GFileAttributeInfoListLike}, p, owns) = begin + convert(GFileAttributeInfoList, p, owns) + end end end begin @@ -107,6 +116,9 @@ $(Expr(:toplevel, quote GInputVector(p, owns) end const GInputVectorLike = Union{Ref{_GInputVector}, GInputVector} + convert(::Type{GInputVectorLike}, p, owns) = begin + convert(GInputVector, p, owns) + end end end begin @@ -125,6 +137,9 @@ $(Expr(:toplevel, quote GOutputVector(p, owns) end const GOutputVectorLike = Union{Ref{_GOutputVector}, GOutputVector} + convert(::Type{GOutputVectorLike}, p, owns) = begin + convert(GOutputVector, p, owns) + end end end begin diff --git a/src/gen/glib_structs b/src/gen/glib_structs index 9449978d..670b90e7 100644 --- a/src/gen/glib_structs +++ b/src/gen/glib_structs @@ -122,6 +122,9 @@ $(Expr(:toplevel, quote GDebugKey(p, owns) end const GDebugKeyLike = Union{Ref{_GDebugKey}, GDebugKey} + convert(::Type{GDebugKeyLike}, p, owns) = begin + convert(GDebugKey, p, owns) + end end end begin @@ -204,6 +207,9 @@ $(Expr(:toplevel, quote GLogField(p, owns) end const GLogFieldLike = Union{Ref{_GLogField}, GLogField} + convert(::Type{GLogFieldLike}, p, owns) = begin + convert(GLogField, p, owns) + end end end begin @@ -332,6 +338,9 @@ $(Expr(:toplevel, quote GOptionEntry(p, owns) end const GOptionEntryLike = Union{Ref{_GOptionEntry}, GOptionEntry} + convert(::Type{GOptionEntryLike}, p, owns) = begin + convert(GOptionEntry, p, owns) + end end end begin @@ -438,6 +447,9 @@ $(Expr(:toplevel, quote GScannerConfig(p, owns) end const GScannerConfigLike = Union{Ref{_GScannerConfig}, GScannerConfig} + convert(::Type{GScannerConfigLike}, p, owns) = begin + convert(GScannerConfig, p, owns) + end end end begin @@ -479,6 +491,9 @@ $(Expr(:toplevel, quote GSourceCallbackFuncs(p, owns) end const GSourceCallbackFuncsLike = Union{Ref{_GSourceCallbackFuncs}, GSourceCallbackFuncs} + convert(::Type{GSourceCallbackFuncsLike}, p, owns) = begin + convert(GSourceCallbackFuncs, p, owns) + end end end begin @@ -513,6 +528,9 @@ $(Expr(:toplevel, quote GString(p, owns) end const GStringLike = Union{Ref{_GString}, GString} + convert(::Type{GStringLike}, p, owns) = begin + convert(GString, p, owns) + end end end begin @@ -556,6 +574,9 @@ $(Expr(:toplevel, quote GTestConfig(p, owns) end const GTestConfigLike = Union{Ref{_GTestConfig}, GTestConfig} + convert(::Type{GTestConfigLike}, p, owns) = begin + convert(GTestConfig, p, owns) + end end end begin @@ -594,6 +615,9 @@ $(Expr(:toplevel, quote GUnixPipe(p, owns) end const GUnixPipeLike = Union{Ref{_GUnixPipe}, GUnixPipe} + convert(::Type{GUnixPipeLike}, p, owns) = begin + convert(GUnixPipe, p, owns) + end end end begin diff --git a/src/gen/gobject_structs b/src/gen/gobject_structs index 761c996f..09132db1 100644 --- a/src/gen/gobject_structs +++ b/src/gen/gobject_structs @@ -17,6 +17,9 @@ $(Expr(:toplevel, quote GEnumValue(p, owns) end const GEnumValueLike = Union{Ref{_GEnumValue}, GEnumValue} + convert(::Type{GEnumValueLike}, p, owns) = begin + convert(GEnumValue, p, owns) + end end end begin @@ -34,6 +37,9 @@ $(Expr(:toplevel, quote GTypeClass(p, owns) end const GTypeClassLike = Union{Ref{_GTypeClass}, GTypeClass} + convert(::Type{GTypeClassLike}, p, owns) = begin + convert(GTypeClass, p, owns) + end end end begin @@ -52,6 +58,9 @@ $(Expr(:toplevel, quote GTypeInterface(p, owns) end const GTypeInterfaceLike = Union{Ref{_GTypeInterface}, GTypeInterface} + convert(::Type{GTypeInterfaceLike}, p, owns) = begin + convert(GTypeInterface, p, owns) + end end end begin @@ -71,6 +80,9 @@ $(Expr(:toplevel, quote GFlagsValue(p, owns) end const GFlagsValueLike = Union{Ref{_GFlagsValue}, GFlagsValue} + convert(::Type{GFlagsValueLike}, p, owns) = begin + convert(GFlagsValue, p, owns) + end end end begin @@ -95,6 +107,9 @@ $(Expr(:toplevel, quote GTypeValueTable(p, owns) end const GTypeValueTableLike = Union{Ref{_GTypeValueTable}, GTypeValueTable} + convert(::Type{GTypeValueTableLike}, p, owns) = begin + convert(GTypeValueTable, p, owns) + end end end begin @@ -116,6 +131,9 @@ $(Expr(:toplevel, quote GEnumClass(p, owns) end const GEnumClassLike = Union{Ref{_GEnumClass}, GEnumClass} + convert(::Type{GEnumClassLike}, p, owns) = begin + convert(GEnumClass, p, owns) + end end end begin @@ -136,6 +154,9 @@ $(Expr(:toplevel, quote GFlagsClass(p, owns) end const GFlagsClassLike = Union{Ref{_GFlagsClass}, GFlagsClass} + convert(::Type{GFlagsClassLike}, p, owns) = begin + convert(GFlagsClass, p, owns) + end end end begin @@ -155,6 +176,9 @@ $(Expr(:toplevel, quote GInterfaceInfo(p, owns) end const GInterfaceInfoLike = Union{Ref{_GInterfaceInfo}, GInterfaceInfo} + convert(::Type{GInterfaceInfoLike}, p, owns) = begin + convert(GInterfaceInfo, p, owns) + end end end begin @@ -179,6 +203,9 @@ $(Expr(:toplevel, quote GParamSpecTypeInfo(p, owns) end const GParamSpecTypeInfoLike = Union{Ref{_GParamSpecTypeInfo}, GParamSpecTypeInfo} + convert(::Type{GParamSpecTypeInfoLike}, p, owns) = begin + convert(GParamSpecTypeInfo, p, owns) + end end end begin @@ -198,6 +225,9 @@ $(Expr(:toplevel, quote GSignalInvocationHint(p, owns) end const GSignalInvocationHintLike = Union{Ref{_GSignalInvocationHint}, GSignalInvocationHint} + convert(::Type{GSignalInvocationHintLike}, p, owns) = begin + convert(GSignalInvocationHint, p, owns) + end end end begin @@ -221,6 +251,9 @@ $(Expr(:toplevel, quote GSignalQuery(p, owns) end const GSignalQueryLike = Union{Ref{_GSignalQuery}, GSignalQuery} + convert(::Type{GSignalQueryLike}, p, owns) = begin + convert(GSignalQuery, p, owns) + end end end begin @@ -238,6 +271,9 @@ $(Expr(:toplevel, quote GTypeFundamentalInfo(p, owns) end const GTypeFundamentalInfoLike = Union{Ref{_GTypeFundamentalInfo}, GTypeFundamentalInfo} + convert(::Type{GTypeFundamentalInfoLike}, p, owns) = begin + convert(GTypeFundamentalInfo, p, owns) + end end end begin @@ -264,6 +300,9 @@ $(Expr(:toplevel, quote GTypeInfo(p, owns) end const GTypeInfoLike = Union{Ref{_GTypeInfo}, GTypeInfo} + convert(::Type{GTypeInfoLike}, p, owns) = begin + convert(GTypeInfo, p, owns) + end end end begin @@ -285,6 +324,9 @@ $(Expr(:toplevel, quote GTypePluginClass(p, owns) end const GTypePluginClassLike = Union{Ref{_GTypePluginClass}, GTypePluginClass} + convert(::Type{GTypePluginClassLike}, p, owns) = begin + convert(GTypePluginClass, p, owns) + end end end begin @@ -305,6 +347,9 @@ $(Expr(:toplevel, quote GTypeQuery(p, owns) end const GTypeQueryLike = Union{Ref{_GTypeQuery}, GTypeQuery} + convert(::Type{GTypeQueryLike}, p, owns) = begin + convert(GTypeQuery, p, owns) + end end end @doc "See the [GTK docs](https://docs.gtk.org/gobject/struct.EnumClass.html)." GEnumClass diff --git a/src/gen/graphene_structs b/src/gen/graphene_structs index baaf0466..11d3c27a 100644 --- a/src/gen/graphene_structs +++ b/src/gen/graphene_structs @@ -19,6 +19,9 @@ $(Expr(:toplevel, quote GrapheneSimd4F(p, owns) end const GrapheneSimd4FLike = Union{Ref{_GrapheneSimd4F}, GrapheneSimd4F} + convert(::Type{GrapheneSimd4FLike}, p, owns) = begin + convert(GrapheneSimd4F, p, owns) + end end end begin @@ -51,6 +54,9 @@ $(Expr(:toplevel, quote GrapheneVec3(p, owns) end const GrapheneVec3Like = Union{Ref{_GrapheneVec3}, GrapheneVec3} + convert(::Type{GrapheneVec3Like}, p, owns) = begin + convert(GrapheneVec3, p, owns) + end end end begin @@ -71,6 +77,9 @@ $(Expr(:toplevel, quote GrapheneSimd4X4F(p, owns) end const GrapheneSimd4X4FLike = Union{Ref{_GrapheneSimd4X4F}, GrapheneSimd4X4F} + convert(::Type{GrapheneSimd4X4FLike}, p, owns) = begin + convert(GrapheneSimd4X4F, p, owns) + end end end begin @@ -104,6 +113,9 @@ $(Expr(:toplevel, quote GrapheneSize(p, owns) end const GrapheneSizeLike = Union{Ref{_GrapheneSize}, GrapheneSize} + convert(::Type{GrapheneSizeLike}, p, owns) = begin + convert(GrapheneSize, p, owns) + end end end begin @@ -137,6 +149,9 @@ $(Expr(:toplevel, quote GrapheneBox(p, owns) end const GrapheneBoxLike = Union{Ref{_GrapheneBox}, GrapheneBox} + convert(::Type{GrapheneBoxLike}, p, owns) = begin + convert(GrapheneBox, p, owns) + end end end begin @@ -170,6 +185,9 @@ $(Expr(:toplevel, quote GrapheneEuler(p, owns) end const GrapheneEulerLike = Union{Ref{_GrapheneEuler}, GrapheneEuler} + convert(::Type{GrapheneEulerLike}, p, owns) = begin + convert(GrapheneEuler, p, owns) + end end end begin @@ -224,6 +242,9 @@ $(Expr(:toplevel, quote GrapheneMatrix(p, owns) end const GrapheneMatrixLike = Union{Ref{_GrapheneMatrix}, GrapheneMatrix} + convert(::Type{GrapheneMatrixLike}, p, owns) = begin + convert(GrapheneMatrix, p, owns) + end end end begin @@ -257,6 +278,9 @@ $(Expr(:toplevel, quote GraphenePlane(p, owns) end const GraphenePlaneLike = Union{Ref{_GraphenePlane}, GraphenePlane} + convert(::Type{GraphenePlaneLike}, p, owns) = begin + convert(GraphenePlane, p, owns) + end end end begin @@ -290,6 +314,9 @@ $(Expr(:toplevel, quote GraphenePoint(p, owns) end const GraphenePointLike = Union{Ref{_GraphenePoint}, GraphenePoint} + convert(::Type{GraphenePointLike}, p, owns) = begin + convert(GraphenePoint, p, owns) + end end end begin @@ -324,6 +351,9 @@ $(Expr(:toplevel, quote GraphenePoint3D(p, owns) end const GraphenePoint3DLike = Union{Ref{_GraphenePoint3D}, GraphenePoint3D} + convert(::Type{GraphenePoint3DLike}, p, owns) = begin + convert(GraphenePoint3D, p, owns) + end end end begin @@ -381,6 +411,9 @@ $(Expr(:toplevel, quote GrapheneQuaternion(p, owns) end const GrapheneQuaternionLike = Union{Ref{_GrapheneQuaternion}, GrapheneQuaternion} + convert(::Type{GrapheneQuaternionLike}, p, owns) = begin + convert(GrapheneQuaternion, p, owns) + end end end begin @@ -414,6 +447,9 @@ $(Expr(:toplevel, quote GrapheneRay(p, owns) end const GrapheneRayLike = Union{Ref{_GrapheneRay}, GrapheneRay} + convert(::Type{GrapheneRayLike}, p, owns) = begin + convert(GrapheneRay, p, owns) + end end end begin @@ -447,6 +483,9 @@ $(Expr(:toplevel, quote GrapheneRect(p, owns) end const GrapheneRectLike = Union{Ref{_GrapheneRect}, GrapheneRect} + convert(::Type{GrapheneRectLike}, p, owns) = begin + convert(GrapheneRect, p, owns) + end end end begin @@ -480,6 +519,9 @@ $(Expr(:toplevel, quote GrapheneSphere(p, owns) end const GrapheneSphereLike = Union{Ref{_GrapheneSphere}, GrapheneSphere} + convert(::Type{GrapheneSphereLike}, p, owns) = begin + convert(GrapheneSphere, p, owns) + end end end begin @@ -514,6 +556,9 @@ $(Expr(:toplevel, quote GrapheneTriangle(p, owns) end const GrapheneTriangleLike = Union{Ref{_GrapheneTriangle}, GrapheneTriangle} + convert(::Type{GrapheneTriangleLike}, p, owns) = begin + convert(GrapheneTriangle, p, owns) + end end end begin @@ -546,6 +591,9 @@ $(Expr(:toplevel, quote GrapheneVec2(p, owns) end const GrapheneVec2Like = Union{Ref{_GrapheneVec2}, GrapheneVec2} + convert(::Type{GrapheneVec2Like}, p, owns) = begin + convert(GrapheneVec2, p, owns) + end end end begin @@ -578,6 +626,9 @@ $(Expr(:toplevel, quote GrapheneVec4(p, owns) end const GrapheneVec4Like = Union{Ref{_GrapheneVec4}, GrapheneVec4} + convert(::Type{GrapheneVec4Like}, p, owns) = begin + convert(GrapheneVec4, p, owns) + end end end gboxed_cache_init() = begin diff --git a/src/gen/gsk4_structs b/src/gen/gsk4_structs index def413bf..aca6a8a1 100644 --- a/src/gen/gsk4_structs +++ b/src/gen/gsk4_structs @@ -16,6 +16,9 @@ $(Expr(:toplevel, quote GskColorStop(p, owns) end const GskColorStopLike = Union{Ref{_GskColorStop}, GskColorStop} + convert(::Type{GskColorStopLike}, p, owns) = begin + convert(GskColorStop, p, owns) + end end end begin @@ -37,6 +40,9 @@ $(Expr(:toplevel, quote GskParseLocation(p, owns) end const GskParseLocationLike = Union{Ref{_GskParseLocation}, GskParseLocation} + convert(::Type{GskParseLocationLike}, p, owns) = begin + convert(GskParseLocation, p, owns) + end end end begin @@ -85,6 +91,9 @@ $(Expr(:toplevel, quote GskShadow(p, owns) end const GskShadowLike = Union{Ref{_GskShadow}, GskShadow} + convert(::Type{GskShadowLike}, p, owns) = begin + convert(GskShadow, p, owns) + end end end begin diff --git a/src/gen/gtk4_structs b/src/gen/gtk4_structs index a77f03b7..d3fed9a3 100644 --- a/src/gen/gtk4_structs +++ b/src/gen/gtk4_structs @@ -37,6 +37,9 @@ $(Expr(:toplevel, quote GtkAccessibleTextRange(p, owns) end const GtkAccessibleTextRangeLike = Union{Ref{_GtkAccessibleTextRange}, GtkAccessibleTextRange} + convert(::Type{GtkAccessibleTextRangeLike}, p, owns) = begin + convert(GtkAccessibleTextRange, p, owns) + end end end begin @@ -115,6 +118,9 @@ $(Expr(:toplevel, quote GtkBorder(p, owns) end const GtkBorderLike = Union{Ref{_GtkBorder}, GtkBorder} + convert(::Type{GtkBorderLike}, p, owns) = begin + convert(GtkBorder, p, owns) + end end end begin @@ -149,6 +155,9 @@ $(Expr(:toplevel, quote GtkCssLocation(p, owns) end const GtkCssLocationLike = Union{Ref{_GtkCssLocation}, GtkCssLocation} + convert(::Type{GtkCssLocationLike}, p, owns) = begin + convert(GtkCssLocation, p, owns) + end end end begin @@ -218,6 +227,9 @@ $(Expr(:toplevel, quote GtkPadActionEntry(p, owns) end const GtkPadActionEntryLike = Union{Ref{_GtkPadActionEntry}, GtkPadActionEntry} + convert(::Type{GtkPadActionEntryLike}, p, owns) = begin + convert(GtkPadActionEntry, p, owns) + end end end begin @@ -289,6 +301,9 @@ $(Expr(:toplevel, quote GtkRecentData(p, owns) end const GtkRecentDataLike = Union{Ref{_GtkRecentData}, GtkRecentData} + convert(::Type{GtkRecentDataLike}, p, owns) = begin + convert(GtkRecentData, p, owns) + end end end begin @@ -329,6 +344,9 @@ $(Expr(:toplevel, quote GtkRequestedSize(p, owns) end const GtkRequestedSizeLike = Union{Ref{_GtkRequestedSize}, GtkRequestedSize} + convert(::Type{GtkRequestedSizeLike}, p, owns) = begin + convert(GtkRequestedSize, p, owns) + end end end begin @@ -362,6 +380,9 @@ $(Expr(:toplevel, quote GtkRequisition(p, owns) end const GtkRequisitionLike = Union{Ref{_GtkRequisition}, GtkRequisition} + convert(::Type{GtkRequisitionLike}, p, owns) = begin + convert(GtkRequisition, p, owns) + end end end begin @@ -428,6 +449,9 @@ $(Expr(:toplevel, quote GtkTextIter(p, owns) end const GtkTextIterLike = Union{Ref{_GtkTextIter}, GtkTextIter} + convert(::Type{GtkTextIterLike}, p, owns) = begin + convert(GtkTextIter, p, owns) + end end end begin @@ -463,6 +487,9 @@ $(Expr(:toplevel, quote GtkTreeIter(p, owns) end const GtkTreeIterLike = Union{Ref{_GtkTreeIter}, GtkTreeIter} + convert(::Type{GtkTreeIterLike}, p, owns) = begin + convert(GtkTreeIter, p, owns) + end end end begin diff --git a/src/gen/pango_structs b/src/gen/pango_structs index 961b2d13..b492ad8a 100644 --- a/src/gen/pango_structs +++ b/src/gen/pango_structs @@ -54,6 +54,9 @@ $(Expr(:toplevel, quote PangoColor(p, owns) end const PangoColorLike = Union{Ref{_PangoColor}, PangoColor} + convert(::Type{PangoColorLike}, p, owns) = begin + convert(PangoColor, p, owns) + end end end begin @@ -74,6 +77,9 @@ $(Expr(:toplevel, quote PangoAttrClass(p, owns) end const PangoAttrClassLike = Union{Ref{_PangoAttrClass}, PangoAttrClass} + convert(::Type{PangoAttrClassLike}, p, owns) = begin + convert(PangoAttrClass, p, owns) + end end end begin @@ -94,6 +100,9 @@ $(Expr(:toplevel, quote PangoRectangle(p, owns) end const PangoRectangleLike = Union{Ref{_PangoRectangle}, PangoRectangle} + convert(::Type{PangoRectangleLike}, p, owns) = begin + convert(PangoRectangle, p, owns) + end end end begin @@ -149,6 +158,9 @@ $(Expr(:toplevel, quote PangoAttribute(p, owns) end const PangoAttributeLike = Union{Ref{_PangoAttribute}, PangoAttribute} + convert(::Type{PangoAttributeLike}, p, owns) = begin + convert(PangoAttribute, p, owns) + end end end begin @@ -174,6 +186,9 @@ $(Expr(:toplevel, quote PangoAnalysis(p, owns) end const PangoAnalysisLike = Union{Ref{_PangoAnalysis}, PangoAnalysis} + convert(::Type{PangoAnalysisLike}, p, owns) = begin + convert(PangoAnalysis, p, owns) + end end end begin @@ -209,6 +224,9 @@ $(Expr(:toplevel, quote PangoItem(p, owns) end const PangoItemLike = Union{Ref{_PangoItem}, PangoItem} + convert(::Type{PangoItemLike}, p, owns) = begin + convert(PangoItem, p, owns) + end end end begin @@ -227,6 +245,9 @@ $(Expr(:toplevel, quote PangoGlyphVisAttr(p, owns) end const PangoGlyphVisAttrLike = Union{Ref{_PangoGlyphVisAttr}, PangoGlyphVisAttr} + convert(::Type{PangoGlyphVisAttrLike}, p, owns) = begin + convert(PangoGlyphVisAttr, p, owns) + end end end begin @@ -246,6 +267,9 @@ $(Expr(:toplevel, quote PangoGlyphGeometry(p, owns) end const PangoGlyphGeometryLike = Union{Ref{_PangoGlyphGeometry}, PangoGlyphGeometry} + convert(::Type{PangoGlyphGeometryLike}, p, owns) = begin + convert(PangoGlyphGeometry, p, owns) + end end end begin @@ -265,6 +289,9 @@ $(Expr(:toplevel, quote PangoGlyphInfo(p, owns) end const PangoGlyphInfoLike = Union{Ref{_PangoGlyphInfo}, PangoGlyphInfo} + convert(::Type{PangoGlyphInfoLike}, p, owns) = begin + convert(PangoGlyphInfo, p, owns) + end end end begin @@ -300,6 +327,9 @@ $(Expr(:toplevel, quote PangoGlyphString(p, owns) end const PangoGlyphStringLike = Union{Ref{_PangoGlyphString}, PangoGlyphString} + convert(::Type{PangoGlyphStringLike}, p, owns) = begin + convert(PangoGlyphString, p, owns) + end end end begin @@ -336,6 +366,9 @@ $(Expr(:toplevel, quote PangoGlyphItem(p, owns) end const PangoGlyphItemLike = Union{Ref{_PangoGlyphItem}, PangoGlyphItem} + convert(::Type{PangoGlyphItemLike}, p, owns) = begin + convert(PangoGlyphItem, p, owns) + end end end begin @@ -354,6 +387,9 @@ $(Expr(:toplevel, quote PangoAttrColor(p, owns) end const PangoAttrColorLike = Union{Ref{_PangoAttrColor}, PangoAttrColor} + convert(::Type{PangoAttrColorLike}, p, owns) = begin + convert(PangoAttrColor, p, owns) + end end end begin @@ -372,6 +408,9 @@ $(Expr(:toplevel, quote PangoAttrFloat(p, owns) end const PangoAttrFloatLike = Union{Ref{_PangoAttrFloat}, PangoAttrFloat} + convert(::Type{PangoAttrFloatLike}, p, owns) = begin + convert(PangoAttrFloat, p, owns) + end end end begin @@ -390,6 +429,9 @@ $(Expr(:toplevel, quote PangoAttrFontDesc(p, owns) end const PangoAttrFontDescLike = Union{Ref{_PangoAttrFontDesc}, PangoAttrFontDesc} + convert(::Type{PangoAttrFontDescLike}, p, owns) = begin + convert(PangoAttrFontDesc, p, owns) + end end end begin @@ -408,6 +450,9 @@ $(Expr(:toplevel, quote PangoAttrFontFeatures(p, owns) end const PangoAttrFontFeaturesLike = Union{Ref{_PangoAttrFontFeatures}, PangoAttrFontFeatures} + convert(::Type{PangoAttrFontFeaturesLike}, p, owns) = begin + convert(PangoAttrFontFeatures, p, owns) + end end end begin @@ -426,6 +471,9 @@ $(Expr(:toplevel, quote PangoAttrInt(p, owns) end const PangoAttrIntLike = Union{Ref{_PangoAttrInt}, PangoAttrInt} + convert(::Type{PangoAttrIntLike}, p, owns) = begin + convert(PangoAttrInt, p, owns) + end end end begin @@ -465,6 +513,9 @@ $(Expr(:toplevel, quote PangoAttrLanguage(p, owns) end const PangoAttrLanguageLike = Union{Ref{_PangoAttrLanguage}, PangoAttrLanguage} + convert(::Type{PangoAttrLanguageLike}, p, owns) = begin + convert(PangoAttrLanguage, p, owns) + end end end begin @@ -508,6 +559,9 @@ $(Expr(:toplevel, quote PangoAttrShape(p, owns) end const PangoAttrShapeLike = Union{Ref{_PangoAttrShape}, PangoAttrShape} + convert(::Type{PangoAttrShapeLike}, p, owns) = begin + convert(PangoAttrShape, p, owns) + end end end begin @@ -527,6 +581,9 @@ $(Expr(:toplevel, quote PangoAttrSize(p, owns) end const PangoAttrSizeLike = Union{Ref{_PangoAttrSize}, PangoAttrSize} + convert(::Type{PangoAttrSizeLike}, p, owns) = begin + convert(PangoAttrSize, p, owns) + end end end begin @@ -545,6 +602,9 @@ $(Expr(:toplevel, quote PangoAttrString(p, owns) end const PangoAttrStringLike = Union{Ref{_PangoAttrString}, PangoAttrString} + convert(::Type{PangoAttrStringLike}, p, owns) = begin + convert(PangoAttrString, p, owns) + end end end begin @@ -586,6 +646,9 @@ $(Expr(:toplevel, quote PangoFontMetrics(p, owns) end const PangoFontMetricsLike = Union{Ref{_PangoFontMetrics}, PangoFontMetrics} + convert(::Type{PangoFontMetricsLike}, p, owns) = begin + convert(PangoFontMetrics, p, owns) + end end end begin @@ -625,6 +688,9 @@ $(Expr(:toplevel, quote PangoGlyphItemIter(p, owns) end const PangoGlyphItemIterLike = Union{Ref{_PangoGlyphItemIter}, PangoGlyphItemIter} + convert(::Type{PangoGlyphItemIterLike}, p, owns) = begin + convert(PangoGlyphItemIter, p, owns) + end end end begin @@ -683,6 +749,9 @@ $(Expr(:toplevel, quote PangoLayoutLine(p, owns) end const PangoLayoutLineLike = Union{Ref{_PangoLayoutLine}, PangoLayoutLine} + convert(::Type{PangoLayoutLineLike}, p, owns) = begin + convert(PangoLayoutLine, p, owns) + end end end begin @@ -715,6 +784,9 @@ $(Expr(:toplevel, quote PangoLogAttr(p, owns) end const PangoLogAttrLike = Union{Ref{_PangoLogAttr}, PangoLogAttr} + convert(::Type{PangoLogAttrLike}, p, owns) = begin + convert(PangoLogAttr, p, owns) + end end end begin @@ -752,6 +824,9 @@ $(Expr(:toplevel, quote PangoMatrix(p, owns) end const PangoMatrixLike = Union{Ref{_PangoMatrix}, PangoMatrix} + convert(::Type{PangoMatrixLike}, p, owns) = begin + convert(PangoMatrix, p, owns) + end end end begin diff --git a/test/graphene.jl b/test/graphene.jl new file mode 100644 index 00000000..43b498b1 --- /dev/null +++ b/test/graphene.jl @@ -0,0 +1,10 @@ +using Test, Gtk4.Graphene + +@testset "point" begin +point = GraphenePoint() +Graphene.G_.init(point, 1.0, 2.0) +point2 = GraphenePoint() +Graphene.G_.init(point2, 1.0, 2.0) +@test Graphene.G_.equal(point,point2) +end + diff --git a/test/runtests.jl b/test/runtests.jl index 7e5189b7..3c293778 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -29,6 +29,10 @@ end include("gdkpixbuf.jl") end +@testset "Graphene" begin +include("graphene.jl") +end + @testset "Gtk" begin include("gui.jl") include("comboboxtext.jl")