mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-06 02:51:00 +01:00
Fix g_irepository_find_by_gtype() for GDK_TYPE_RECTANGLE
Complement fix for g-ir-scanner which converts every GdkRectangle gtype to CairoRectangleInt. Make sure that C-side API is also aware of this workaround. Use case requiring this patch: When binding implementation wants to get/set property, it can use either GI-based approach (g_property_info_xxx() funcs), or just GLib facilities. Although former is probably preferred, there are cases when latter is still needed (e.g. gstreamer uses dynamic properties, which are not present in the gir). In this case, binding implementation queries the type of the propertyb (using g_object_class_find_property()), it gets GDK_TYPE_RECTANGLE, and without the patch it cannot map it to any known type. https://bugzilla.gnome.org/show_bug.cgi?id=655423
This commit is contained in:
parent
13069a377f
commit
b8010062b5
11
gitypelib.c
11
gitypelib.c
@ -208,6 +208,17 @@ g_typelib_get_dir_entry_by_gtype (GITypelib *typelib,
|
||||
guint i;
|
||||
const char *c_prefix;
|
||||
|
||||
/* There is a corner case regarding GdkRectangle. GdkRectangle is a
|
||||
boxed type, but it is just an alias to boxed struct
|
||||
CairoRectangleInt. Scanner automatically converts all references
|
||||
to GdkRectangle to CairoRectangleInt, so GdkRectangle does not
|
||||
appear in the typelibs at all, although user code might query it.
|
||||
So if we get such query, we also change it to lookup of
|
||||
CairoRectangleInt.
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=655423 */
|
||||
if (!fastpass && !strcmp (gtype_name, "GdkRectangle"))
|
||||
gtype_name = "CairoRectangleInt";
|
||||
|
||||
/* Inside each typelib, we include the "C prefix" which acts as
|
||||
* a namespace mechanism. For GtkTreeView, the C prefix is Gtk.
|
||||
* Given the assumption that GTypes for a library also use the
|
||||
|
Loading…
x
Reference in New Issue
Block a user