diff --git a/lib/girepository-1.0/ci.sh b/lib/girepository-1.0/ci.sh index 570bd99..08e7636 100755 --- a/lib/girepository-1.0/ci.sh +++ b/lib/girepository-1.0/ci.sh @@ -13,22 +13,27 @@ cd ../.. git clone https://github.com/gtk-rs/gir-files.git && cd gir-files git checkout ${gir_version} + # fetch GIRepository-3.0.gir cp /usr/share/gir-1.0/GIRepository-3.0.gir . + # utf8 sed -i 's/type name="utf8" c:type="gchar"/type name="gchar" c:type="gchar"/g' GLib-2.0.gir sed -i 's/type name="utf8" c:type="char"/type name="gchar" c:type="char"/g' HarfBuzz-0.0.gir -# introspectable="0" +# introspectable sed -i 's/field name="priority" introspectable="0"/field name="priority"/g' GLib-2.0.gir sed -i 's/enumeration name="ThreadPriority" introspectable="0" deprecated="1"/enumeration name="ThreadPriority"/g' GLib-2.0.gir +sed -i 's/function name="image_surface_create"/function name="image_surface_create" introspectable="0"/g' cairo-1.0.gir # Win32 sed -i 's/type name="GLib.Win32/type name="GLibWin32./g' GLibWin32-2.0.gir sed -i 's/type name="Gio.Win32/type name="GioWin32./g' GioWin32-2.0.gir -# gconstpointer +# misc sed -i 's/gconstpointer/gpointer/g' Pango-1.0.gir + for gir in $(ls *.gir) do typelib=$(echo ${gir} | sed 's/.gir/.typelib/') gi-compile-repository ${gir} -o ../${typelib} --includedir . done + cd .. diff --git a/src/gi-ext.zig b/src/gi-ext.zig index 98819fd..00ecc9d 100644 --- a/src/gi-ext.zig +++ b/src/gi-ext.zig @@ -174,6 +174,15 @@ pub const ArgInfoExt = struct { try writer.writeAll("[*]*gobject.Object"); return; } + // PATCH: text list + if (std.mem.eql(u8, "gdk_x11_display_text_property_to_text_list", func_symbol) and std.mem.eql(u8, "list", arg_name)) { + try writer.writeAll("*?[*:null]?[*:0]u8"); + return; + } + if (std.mem.eql(u8, "gdk_x11_free_text_list", func_symbol) and std.mem.eql(u8, "list", arg_name)) { + try writer.writeAll("[*:null]?[*:0]u8"); + return; + } } } if ((self.getDirection() != .in and !(self.isCallerAllocates() and arg_type.getTag() == .array and arg_type.getArrayType() == .c)) or option_signal_param) { diff --git a/test/abi/c_linux.patch b/test/abi/c_linux.patch index 9a758c2..3f7e125 100644 --- a/test/abi/c_linux.patch +++ b/test/abi/c_linux.patch @@ -1,6 +1,8 @@ --- a/c_linux.zig +++ b/c_linux.zig -@@ -1,3 +1,7 @@ +@@ -19456,5 +19456,8 @@ + _: u30, + }; -pub const struct__PangoGlyphVisAttr = opaque {}; +pub const struct__PangoGlyphVisAttr = packed struct(u32) { + is_cluster_start: bool, @@ -9,3 +11,10 @@ +}; pub const PangoGlyphVisAttr = struct__PangoGlyphVisAttr; pub const struct__PangoGlyphInfo = extern struct { +@@ -28908,5 +28911,5 @@ + pub extern fn gsk_text_node_has_color_glyphs(node: ?*const GskRenderNode) gboolean; + pub extern fn gsk_text_node_get_num_glyphs(node: ?*const GskRenderNode) guint; +-pub extern fn gsk_text_node_get_glyphs(node: ?*const GskRenderNode, n_glyphs: [*c]guint) ?*const PangoGlyphInfo; ++pub extern fn gsk_text_node_get_glyphs(node: ?*const GskRenderNode, n_glyphs: [*c]guint) [*]const PangoGlyphInfo; + pub extern fn gsk_text_node_get_color(node: ?*const GskRenderNode) [*c]const GdkRGBA; + pub extern fn gsk_text_node_get_offset(node: ?*const GskRenderNode) [*c]const graphene_point_t; diff --git a/test/abi/c_win.patch b/test/abi/c_win.patch index c821f22..ab9db30 100644 --- a/test/abi/c_win.patch +++ b/test/abi/c_win.patch @@ -1,6 +1,8 @@ --- a/c_win.zig +++ b/c_win.zig -@@ -1,3 +1,7 @@ +@@ -19148,5 +19148,8 @@ + _: u30, + }; -pub const struct__PangoGlyphVisAttr = opaque {}; +pub const struct__PangoGlyphVisAttr = packed struct(u32) { + is_cluster_start: bool, @@ -9,3 +11,10 @@ +}; pub const PangoGlyphVisAttr = struct__PangoGlyphVisAttr; pub const struct__PangoGlyphInfo = extern struct { +@@ -29185,5 +29188,5 @@ + pub extern fn gsk_text_node_has_color_glyphs(node: ?*const GskRenderNode) gboolean; + pub extern fn gsk_text_node_get_num_glyphs(node: ?*const GskRenderNode) guint; +-pub extern fn gsk_text_node_get_glyphs(node: ?*const GskRenderNode, n_glyphs: [*c]guint) ?*const PangoGlyphInfo; ++pub extern fn gsk_text_node_get_glyphs(node: ?*const GskRenderNode, n_glyphs: [*c]guint) [*]const PangoGlyphInfo; + pub extern fn gsk_text_node_get_color(node: ?*const GskRenderNode) [*c]const GdkRGBA; + pub extern fn gsk_text_node_get_offset(node: ?*const GskRenderNode) [*c]const graphene_point_t; diff --git a/test/abi/testing.zig b/test/abi/testing.zig index 7ffc305..2300cd4 100644 --- a/test/abi/testing.zig +++ b/test/abi/testing.zig @@ -11,13 +11,7 @@ fn isHandle(T: std.builtin.Type) bool { return fields[0].type == c_int; } -pub fn expect(ok: bool) !void { - if (true) { - try std.testing.expect(ok); - } else { - comptime std.debug.assert(ok); - } -} +pub const expect = std.testing.expect; pub fn isAbiCompatitable(comptime U: type, comptime V: type) bool { var typeinfo_u = @typeInfo(U);