[gnome-settings-daemon] wacom: Make OSD work again
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Make OSD work again
- Date: Fri, 4 Oct 2013 07:46:26 +0000 (UTC)
commit 67ddb3d6a07e6246ad66a4b0880e9dc8631f8250
Author: Bastien Nocera <hadess hadess net>
Date: Fri Oct 4 09:41:13 2013 +0200
wacom: Make OSD work again
The recent lirsvg security changes made the include portion of the
SVG used for the OSD fail to parse.
Set the base URI for the layouts before loading the SVG data to
fix the new strict loading policy (#691708).
https://bugzilla.gnome.org/show_bug.cgi?id=709350
plugins/wacom/gsd-wacom-osd-window.c | 40 ++++++++++++++++++++++++++++------
1 files changed, 33 insertions(+), 7 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-osd-window.c b/plugins/wacom/gsd-wacom-osd-window.c
index d894915..bffaf24 100644
--- a/plugins/wacom/gsd-wacom-osd-window.c
+++ b/plugins/wacom/gsd-wacom-osd-window.c
@@ -781,6 +781,35 @@ osd_window_editing_button (GsdWacomOSDWindow *self)
return self->priv->edition_mode && gtk_widget_get_visible (self->priv->editor);
}
+static RsvgHandle *
+load_rsvg_with_base (const char *css_string,
+ const char *original_layout_path,
+ GError **error)
+{
+ RsvgHandle *handle;
+ char *dirname;
+
+ handle = rsvg_handle_new ();
+
+ dirname = g_path_get_dirname (original_layout_path);
+ rsvg_handle_set_base_uri (handle, dirname);
+ g_free (dirname);
+
+ if (!rsvg_handle_write (handle,
+ (guint8 *) css_string,
+ strlen (css_string),
+ error)) {
+ g_object_unref (handle);
+ return NULL;
+ }
+ if (!rsvg_handle_close (handle, error)) {
+ g_object_unref (handle);
+ return NULL;
+ }
+
+ return handle;
+}
+
static void
gsd_wacom_osd_window_update (GsdWacomOSDWindow *osd_window)
{
@@ -860,15 +889,12 @@ gsd_wacom_osd_window_update (GsdWacomOSDWindow *osd_window)
replace_string (&css_string, "layout_file", layout_file);
/* Render the SVG with the CSS applied */
- if (osd_window->priv->handle)
- g_object_unref (osd_window->priv->handle);
- osd_window->priv->handle = rsvg_handle_new_from_data ((guint8 *) css_string,
- strlen (css_string),
- &error);
- if (error != NULL) {
+ g_clear_object (&osd_window->priv->handle);
+ osd_window->priv->handle = load_rsvg_with_base (css_string, layout_file, &error);
+ if (osd_window->priv->handle == NULL) {
g_debug ("CSS applied:\n%s\n", css_string);
g_printerr ("RSVG error: %s\n", error->message);
- g_clear_pointer (&error, g_error_free);
+ g_clear_error (&error);
}
g_free (css_string);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]