As described in the gtk+ project's commit 7b4f82c, the rsvg loader
apparently now restricts what external files it will load from an
SVG. As a workaround, the data can be embedded in a data: URI.

Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
---
 tools/show-svg-image.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/show-svg-image.c b/tools/show-svg-image.c
index f64523a..674d27e 100644
--- a/tools/show-svg-image.c
+++ b/tools/show-svg-image.c
@@ -206,11 +206,16 @@ update_tablet (Tablet *tablet)
        char        *width, *height;
        char         button;
        GError      *error;
-       gchar       *data;
+       gchar       *file_data, *escaped_file_data, *data;
+       gsize        file_len;
 
        if (tablet->handle)
                g_object_unref (tablet->handle);
 
+       if (!g_file_get_contents (libwacom_get_layout_filename 
(tablet->device), &file_data, &file_len, NULL))
+               return;
+       escaped_file_data = g_markup_escape_text (file_data, file_len);
+
        width = g_strdup_printf ("%d", tablet->area.width);
        height = g_strdup_printf ("%d", tablet->area.height);
 
@@ -264,12 +269,14 @@ update_tablet (Tablet *tablet)
                            "      fill:   ", DARK_COLOR,    " !important;\n"
                            "    }\n",
                            "  </style>\n"
-                           "  <xi:include href=\"", 
libwacom_get_layout_filename (tablet->device), "\"/>\n"
+                           "  <xi:include href=\"data:text/xml,", 
escaped_file_data, "\"/>\n"
                            "</svg>",
                            NULL);
 
        tablet->handle = rsvg_handle_new_from_data ((guint8 *) data, 
strlen(data), &error);
        g_free (data);
+       g_free (escaped_file_data);
+       g_free (file_data);
 }
 
 static void
-- 
2.8.3


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to