Skip to content

Commit

Permalink
don't override gboxed_types() and make it const in generated code (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwahlstrand authored May 25, 2024
1 parent 256ccb3 commit 8648c03
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion GI/src/giexport.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ end

function struct_cache_expr!(exprs)
gboxed_types_list = quote
gboxed_types = Any[]
const gboxed_types = Any[]
end
push!(exprs,unblock(gboxed_types_list))
end
Expand Down
2 changes: 1 addition & 1 deletion gen/gen_gdkpixbuf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ first_list=[:PixbufModulePattern]

obj_constructor_skiplist=[:new_from_resource,:new_with_mime_type,:new_from_resource_at_scale]

struct_skiplist = GI.export_struct_exprs!(ns,path, "gdkpixbuf", struct_skiplist, []; doc_xml = d, expr_init = :(gboxed_types = Any[]), object_skiplist = obj_skiplist, object_constructor_skiplist = obj_constructor_skiplist, interface_skiplist = [:XdpProxyResolverIface], first_list = first_list, doc_prefix = "gdk-pixbuf")
struct_skiplist = GI.export_struct_exprs!(ns,path, "gdkpixbuf", struct_skiplist, []; doc_xml = d, object_skiplist = obj_skiplist, object_constructor_skiplist = obj_constructor_skiplist, interface_skiplist = [:XdpProxyResolverIface], first_list = first_list, doc_prefix = "gdk-pixbuf")

object_method_skiplist=[:get_iter,:advance,:get_file_info_finish,:new_from_stream_async]

Expand Down
2 changes: 1 addition & 1 deletion gen/gen_gsk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ GI.export_consts!(ns, path, "gsk4"; doc_xml = d, export_constants = false)
disguised = Symbol[]
struct_skiplist=vcat(disguised, Symbol[:ShaderArgsBuilder])

GI.export_struct_exprs!(ns,path, "gsk4", struct_skiplist, [:RoundedRect]; doc_xml = d, output_boxed_cache_init = false, output_object_cache_define = false, output_object_cache_init = false, output_callbacks = false)
GI.export_struct_exprs!(ns,path, "gsk4", struct_skiplist, [:RoundedRect]; doc_xml = d, output_boxed_cache_init = false, output_boxed_types_def = false, output_object_cache_define = false, output_object_cache_init = false, output_callbacks = false)
GI.export_methods!(ns,path,"gsk4"; struct_skiplist = struct_skiplist)
GI.export_functions!(ns,path,"gsk4")
2 changes: 1 addition & 1 deletion gen/gen_gtk4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ constructor_skiplist=[:new_first]
object_skiplist=[:CClosureExpression,:ClosureExpression,:ParamSpecExpression,:PrintUnixDialog,:PageSetupUnixDialog]
obj_constructor_skiplist=[:new_from_resource,:new_with_mnemonic,:new_with_text,:new_with_entry,:new_with_model_and_entry,:new_for_resource,:new_from_icon_name]

GI.export_struct_exprs!(ns,path, "gtk4", struct_skiplist, [:BitsetIter,:BuildableParser]; doc_xml = d, object_skiplist = object_skiplist, constructor_skiplist = constructor_skiplist, output_boxed_cache_init = false, output_object_cache_define = false, output_object_cache_init = false, object_constructor_skiplist = obj_constructor_skiplist, doc_skiplist = [:Builder], exclude_deprecated = false)
GI.export_struct_exprs!(ns,path, "gtk4", struct_skiplist, [:BitsetIter,:BuildableParser]; doc_xml = d, object_skiplist = object_skiplist, constructor_skiplist = constructor_skiplist, output_boxed_cache_init = false, output_boxed_types_def = false, output_object_cache_define = false, output_object_cache_init = false, object_constructor_skiplist = obj_constructor_skiplist, doc_skiplist = [:Builder], exclude_deprecated = false)

## object methods
skiplist=[:create_closure,:activate_cell,:event,:start_editing,:filter_keypress,:append_node,:im_context_filter_keypress,:get_backlog,:get,:get_default,:get_for_display,:get_current_event_state,:get_axes]
Expand Down
2 changes: 1 addition & 1 deletion src/gen/cairo_structs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
quote
$(Expr(:toplevel, quote
gboxed_types = Any[]
const gboxed_types = Any[]
mutable struct cairoContext <: GBoxed
handle::Ptr{cairoContext}
begin
Expand Down
2 changes: 1 addition & 1 deletion src/gen/gdk4_structs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
quote
$(Expr(:toplevel, quote
gboxed_types = Any[]
const gboxed_types = Any[]
mutable struct GdkContentFormats <: GBoxed
handle::Ptr{GdkContentFormats}
begin
Expand Down
3 changes: 1 addition & 2 deletions src/gen/gdkpixbuf_structs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
quote
$(Expr(:toplevel, quote
gboxed_types = Any[]
const gboxed_types = Any[]
begin
struct _GdkPixbufModulePattern
prefix::Cstring
Expand Down Expand Up @@ -298,7 +298,6 @@ $(Expr(:toplevel, quote
@doc "See the [GTK docs](https://docs.gtk.org/gdk-pixbuf/class.PixbufAnimationIter.html)." GdkPixbufAnimationIter
@doc "See the [GTK docs](https://docs.gtk.org/gdk-pixbuf/class.PixbufLoader.html)." GdkPixbufLoader
@doc "See the [GTK docs](https://docs.gtk.org/gdk-pixbuf/class.PixbufSimpleAnim.html)." GdkPixbufSimpleAnim
gboxed_types = Any[]
function on_area_prepared(f, object::GdkPixbufLoader, user_data = object, after = false)
GLib.signal_connect_generic(f, object, "area-prepared", Nothing, (), after, user_data)
end
Expand Down
2 changes: 1 addition & 1 deletion src/gen/graphene_structs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
quote
$(Expr(:toplevel, quote
gboxed_types = Any[]
const gboxed_types = Any[]
begin
struct _GrapheneSimd4F
x::Float32
Expand Down
1 change: 0 additions & 1 deletion src/gen/gsk4_structs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
quote
$(Expr(:toplevel, quote
gboxed_types = Any[]
begin
struct _GskColorStop
offset::Float32
Expand Down
1 change: 0 additions & 1 deletion src/gen/gtk4_structs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
quote
$(Expr(:toplevel, quote
gboxed_types = Any[]
mutable struct GtkBitset <: GBoxed
handle::Ptr{GtkBitset}
begin
Expand Down
2 changes: 1 addition & 1 deletion src/gen/pango_structs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
quote
$(Expr(:toplevel, quote
gboxed_types = Any[]
const gboxed_types = Any[]
mutable struct PangoLanguage <: GBoxed
handle::Ptr{PangoLanguage}
begin
Expand Down
5 changes: 5 additions & 0 deletions test/gui/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ end

end

@testset "GBoxed properties in Gtk4" begin
c=GtkColorButton()
@test c.rgba isa GdkRGBA
end

@testset "CssProviderLeaf(filename=\"...\")" begin
style_file = joinpath(dirname(@__FILE__), "style_test.css")

Expand Down

0 comments on commit 8648c03

Please sign in to comment.