WebKitGTK 2.31.1 for GTK4, gir file shows no Gdk dependency

I was going to offer webkit2 Nim bindings also for GTK4, so I installed

WebKitGTK 2.31.1

following these instructions:

Of course v2.31.1 is still unstable, but v2.30.5 does not work with latest GTK4.

The problem is that the gir file uses Gdk functions, but has it not as a dependency. I can fix that manually. Is this a bug, or should we just assume that Gtk dependency always includes Gdk dependency?

$ grep -i Gdk  /opt/gtk/share/gir-1.0/WebKit2-5.0.gir 
                 line="200">a #GdkRectangle to fill in with the element area</doc>
            <type name="Gdk.Rectangle" c:type="GdkRectangle*"/>
             line="180">Gets the current #GdkRGBA color of @request</doc>
                 line="183">a #GdkRGBA to fill in with the current color.</doc>
            <type name="Gdk.RGBA" c:type="GdkRGBA*"/>
             line="159">Sets the current #GdkRGBA color of @request</doc>
                 line="162">a pointer #GdkRGBA</doc>
            <type name="Gdk.RGBA" c:type="const GdkRGBA*"/>
        <type name="Gdk.RGBA"/>
            <type name="Gdk.Event" c:type="GdkEvent*"/>
            <type name="Gdk.Event" c:type="GdkEvent*"/>
              <type name="Gdk.Event" c:type="GdkEvent*"/>
                 line="31">a #GdkRGBA or %NULL</doc>
            <type name="Gdk.RGBA" c:type="const GdkRGBA*"/>
             line="106">Return a bitmask of #GdkModifierType values describing the modifier keys that were in effect
#GdkModifierType values describing the modifiers used for that click.
of the button triggering that event. The button numbers match those from GDK.
        GdkRectangle geometry;
            <type name="Gdk.Event" c:type="GdkEvent*"/>
            <type name="Gdk.Rectangle" c:type="GdkRectangle*"/>
                 line="452">a #GdkRGBA to fill in with the background color</doc>
            <type name="Gdk.RGBA" c:type="GdkRGBA*"/>
                                                 const GdkRGBA *rgba)
    GdkScreen *screen = gtk_window_get_screen (GTK_WINDOW (window));
    GdkVisual *rgba_visual = gdk_screen_get_rgba_visual (screen);
                 line="410">a #GdkRGBA</doc>
            <type name="Gdk.RGBA" c:type="const GdkRGBA*"/>
a #GdkEventButton of type %GDK_BUTTON_PRESS when the context menu
a #GdkEventKey of type %GDK_KEY_PRESS if the keyboard was used to show
a generic #GdkEvent of type %GDK_NOTHING when the #GtkWidget::popup-menu
                 line="1897">the #GdkEvent that triggered the context menu</doc>
            <type name="Gdk.Event"/>
#GdkModifierType flags indicating the state of modifier keys.
                 line="1742">a bitmask of #GdkModifierType</doc>
            <type name="Gdk.Event"/>
            <type name="Gdk.Rectangle"/>
              <type name="Gdk.Event" c:type="GdkEvent*"/>
              <type name="Gdk.Rectangle" c:type="GdkRectangle*"/>
            <type name="Gdk.Rectangle" c:type="GdkRectangle*"/>
        <type name="Gdk.Rectangle"/>

Well, it seems to be more an issue with

dev-libs/gobject-introspection-1.66.1::gentoo

Works fine for all libs but not for latest webkitgtk2. For latest GtkSourceView installed from git I get

$ head -40  ~/.nimble/pkgs/gintro-#head/gintro/gtksource5.nim 
# dependencies:
# Gtk-4.0
# GLib-2.0
# GdkPixbuf-2.0
# HarfBuzz-0.0
# GModule-2.0
# cairo-1.0
# Graphene-1.0
# Gsk-4.0
# GObject-2.0
# Pango-1.0
# Gio-2.0
# Gdk-4.0
# immediate dependencies:
# Gtk-4.0
# libraries:
# libgtksourceview-5.so.0
{.warning[UnusedImport]: off.}
import gtk4, glib, gdkpixbuf, harfbuzz, gmodule, cairo, graphene, gsk, gobject, pango, gio, gdk4

So gobject-introspection adds the gdk dependency automatically, while gdk may be not directly included in the C headers. But for latest webkitgtk2 that seems not to work, so I have to add it manually.

Sorry, was a bug in my bindings generator this time :slight_smile:

Four years ago when I started with the bindings generator I assumed that number of dependencies is always smaller than 12. But recent webkit2 has 14:

$ head -40 nim_gi/webkit25.nim 
# dependencies:
# Pango-1.0
# Gtk-4.0
# GModule-2.0
# GLib-2.0
# Soup-2.4
# HarfBuzz-0.0
# GdkPixbuf-2.0
# Graphene-1.0
# cairo-1.0
# GObject-2.0
# Gsk-4.0
# Gio-2.0
# JavaScriptCore-5.0
# Gdk-4.0
# immediate dependencies:
# Soup-2.4
# JavaScriptCore-5.0
# Gtk-4.0
# GObject-2.0
# libraries:
# libwebkit2gtk-5.0.so.0,libjavascriptcoregtk-5.0.so.18
{.warning[UnusedImport]: off.}
import pango, gtk4, gmodule, glib, soup, harfbuzz, gdkpixbuf, graphene, cairo, gobject, gsk, gio, javascriptcore5, gdk4
const Lib = "libwebkit2gtk-5.0.so.0"

Admin, please delete this thread when possible.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.