diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2020-06-10 16:59:41 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2020-06-10 17:17:51 +0100 |
commit | 94f44a08d3c177c12de8ce84c647a08b0a12a411 (patch) | |
tree | bc0de4d9cc743ce093c99b0a1c52155e914af304 /pango/pangocairo.h | |
parent | 4b5e25a22cc0bb10c60cd43bef394e16f4a11846 (diff) | |
download | pango-94f44a08d3c177c12de8ce84c647a08b0a12a411.tar.gz |
Use the appropriate namespace for Pango sub-libraries
The Pango sub-libraries have symbols in the pango_<something> namespace,
but the identifiers are in the Pango one, which makes consumers of the
introspection data either get something like:
PangoCairo.show_layout()
with a bunch of warnings caused by the type macros not following the
appropriate pattern, or:
PangoCairo.cairo_show_layout()
which breaks introspection ABI.
We can use the __GI_SCANNER__ pre-processor symbol to trick the scanner
into generating the appropriate representation of the API, while keeping
the C consumers happy with the existing—albeit wildly inconsistent with
best practices for GObject-based libraries—symbols.
Diffstat (limited to 'pango/pangocairo.h')
-rw-r--r-- | pango/pangocairo.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/pango/pangocairo.h b/pango/pangocairo.h index cd368f8f..633ccf9d 100644 --- a/pango/pangocairo.h +++ b/pango/pangocairo.h @@ -37,9 +37,20 @@ G_BEGIN_DECLS * Since: 1.18 **/ typedef struct _PangoCairoFont PangoCairoFont; -#define PANGO_TYPE_CAIRO_FONT (pango_cairo_font_get_type ()) -#define PANGO_CAIRO_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FONT, PangoCairoFont)) -#define PANGO_IS_CAIRO_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT)) + +/* This is a hack because PangoCairo is hijacking the Pango namespace, but + * consumers of the PangoCairo API expect these symbols to live under the + * PangoCairo namespace. + */ +#ifdef __GI_SCANNER__ +#define PANGO_CAIRO_TYPE_FONT (pango_cairo_font_get_type()) +#define PANGO_CAIRO_FONT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANGO_CAIRO_TYPE_FONT, PangoCairoFont)) +#define PANGO_CAIRO_IS_FONT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANGO_CAIRO_TYPE_FONT)) +#else +#define PANGO_TYPE_CAIRO_FONT (pango_cairo_font_get_type ()) +#define PANGO_CAIRO_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FONT, PangoCairoFont)) +#define PANGO_IS_CAIRO_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT)) +#endif /** * PangoCairoFontMap: @@ -51,9 +62,16 @@ typedef struct _PangoCairoFont PangoCairoFont; * Since: 1.10 **/ typedef struct _PangoCairoFontMap PangoCairoFontMap; + +#ifdef __GI_SCANNER__ +#define PANGO_CAIRO_TYPE_FONT_MAP (pango_cairo_font_map_get_type()) +#define PANGO_CAIRO_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANGO_CAIRO_TYPE_FONT_MAP, PangoCairoFontMap)) +#define PANGO_CAIRO_IS_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANGO_CAIRO_TYPE_FONT_MAP)) +#else #define PANGO_TYPE_CAIRO_FONT_MAP (pango_cairo_font_map_get_type ()) #define PANGO_CAIRO_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FONT_MAP, PangoCairoFontMap)) #define PANGO_IS_CAIRO_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT_MAP)) +#endif /** * PangoCairoShapeRendererFunc: |