mrjbq7 · GitHub

Initial draft of a gtk4 vocab.

Summary

  • Added cairo_rectangle_int_t and cairo_region_t types to cairo.ffi, as they're required for parsing some GIR.
  • Added cairo.gobject.ffi and freetype2.gobject.ffi vocab which processes their respective GIR files to load the type-infos required by some of the other GIR.
  • Added new GIR files required by gtk4, and updated old ones.
  • Removed some manually declared definitions from glib.ffi since they're now generated by the new GIR.
  • Updated gobject-introspection to be able to process new GIR files.
  • Added the gtk4, along with necessary dependents, gsk, graphene, and the aforementioned .gobject.ffis.
  • Added a simple GTK4 + OpenGL sample in extras/gtk4-samples/opengl to test the bare minimum.

.gobject.ffi

Some GIR files aren't meant to be used for actually generating bindings for the libraries they describe, only for supporting GIR files that are meant for generating bindings. In these cases, I added a .gobject.ffi vocab to the root vocab for the library. These vocabs process the GIR files to generate the type-info required for processing other GIR files. This might need altered, since it currently still generates definitions. I'm unclear on the precise implications here.

gobject-introspection

I added a SKIP-DEFINITIONS: parsing word (similar to IMPLEMENT-STRUCTS:) which takes a list of definitions to be skipped when parsing the GIR. This helps with workarounds for definitions which gobject-introspection fails to parse. A manual definition can then be written. I used it for GObject.G_TYPE_FLAG_RESERVED_ID_BIT, which is a constant of type GType and value 1. GType does typedef to gulong, so it's probably feasible to get it to parse correctly, but I wasn't sure how to best approach that, so for now, it's using a workaround.

I moved def-consts to happen later in def-namespace, since otherwise some definitions haven't defined/deferred the necessary type yet.

xml>array-type was updated to handle nested arrays.

fix-conts is now named fix-consts and now uses identifier-prefixes instead of symbol-prefixes, resolving some ambiguity between the older and newer GIR files.

load-functions now filters out xml elements with attribute moved-to, since they'll otherwise result in re-definitions.

Added some more standard-types, some of which are needed, others weren't needed, but they're all assumed by GNOME/gobject-introspection.

"GTK 2/3 symbols detected"

A standard bootstrap (on Linux) will use ui.backend.gtk2, which results in things I'm unclear on, but the end result is that attempting to run gtk4-samples.opengl will fail with an error message: GTK 2/3 symbols detected. Using GTK 2/3 and GTK 4 in the same process is not supported. I'm currently using ./factor -i=boot.unix-x86.64.image -exclude="tools help handbook ui ui.tools" to build the image for testing gtk4. Haven't check exactly which components bring in gtk2, but just -exclude="ui ui.tools wasn't enough.

To-Do

  • Implement ui.backend.gtk4.
  • Fix SKIP-DEFINITIONS: to take the more expected name.
  • Add the appropriate dynamic libraries for macos and windows.
  • Compare the exact definitions generated before and after the updated GIR files to check for anything important that might be missing.
  • Decide how to best handle the GTK2 & GTK4 symbols conflict.
  • Maybe preprocess the new GIR files to remove the unused docs?

Read the original on github.com ↗