diff options
author | Benjamin Otte <otte@redhat.com> | 2019-11-26 06:09:20 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2019-12-12 07:47:45 +0100 |
commit | 43e6db5c0d077bea5412afa5426398cb5000793c (patch) | |
tree | 7339311ee95b251844e6be2d663a906f2befafea | |
parent | 426e13efc61aaa9259dd280c5960a961dbb1c2f2 (diff) | |
download | gtk+-43e6db5c0d077bea5412afa5426398cb5000793c.tar.gz |
xxx: Add a hack to make paintables transform to/from objects
See also: https://gitlab.gnome.org/GNOME/glib/merge_requests/1251
-rw-r--r-- | gdk/gdkpaintable.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gdk/gdkpaintable.c b/gdk/gdkpaintable.c index 5f708d77ee..4b3bfc5d33 100644 --- a/gdk/gdkpaintable.c +++ b/gdk/gdkpaintable.c @@ -137,6 +137,16 @@ static double gdk_paintable_default_get_intrinsic_aspect_ratio (GdkPaintable *pa }; static void +g_value_object_transform_value (const GValue *src_value, + GValue *dest_value) +{ + if (src_value->data[0].v_pointer && g_type_is_a (G_OBJECT_TYPE (src_value->data[0].v_pointer), G_VALUE_TYPE (dest_value))) + dest_value->data[0].v_pointer = g_object_ref (src_value->data[0].v_pointer); + else + dest_value->data[0].v_pointer = NULL; +} + +static void gdk_paintable_default_init (GdkPaintableInterface *iface) { iface->snapshot = gdk_paintable_default_snapshot; @@ -146,6 +156,9 @@ gdk_paintable_default_init (GdkPaintableInterface *iface) iface->get_intrinsic_height = gdk_paintable_default_get_intrinsic_height; iface->get_intrinsic_aspect_ratio = gdk_paintable_default_get_intrinsic_aspect_ratio; + g_value_register_transform_func (G_TYPE_OBJECT, GDK_TYPE_PAINTABLE, g_value_object_transform_value); + g_value_register_transform_func (GDK_TYPE_PAINTABLE, G_TYPE_OBJECT, g_value_object_transform_value); + /** * GdkPaintable::invalidate-contents * @paintable: a #GdkPaintable |