[libwnck] core: Remove usage of gdk_display_get_default() in text_property_to_utf8



commit 88b233eef0f398ab1a7a63799e74ca93883fbd46
Author: Vincent Untz <vuntz gnome org>
Date:   Fri Feb 18 18:57:41 2011 +0100

    core: Remove usage of gdk_display_get_default() in text_property_to_utf8

 libwnck/xutils.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/libwnck/xutils.c b/libwnck/xutils.c
index ec1fff8..23a1cb9 100644
--- a/libwnck/xutils.c
+++ b/libwnck/xutils.c
@@ -253,15 +253,25 @@ _wnck_get_atom (Screen *screen,
 }
 
 static char*
-text_property_to_utf8 (const XTextProperty *prop)
+text_property_to_utf8 (Display             *display,
+                       const XTextProperty *prop)
 {
+  GdkDisplay *gdkdisplay;
   char **list;
   int count;
   char *retval;
 
   list = NULL;
 
-  count = gdk_text_property_to_utf8_list_for_display (gdk_display_get_default (),
+  gdkdisplay = gdk_x11_lookup_xdisplay (display);
+
+  if (!gdkdisplay) {
+    g_warning ("No GdkDisplay matching Display \"%s\" was found.\n",
+               DisplayString (display));
+    return NULL;
+  }
+
+  count = gdk_text_property_to_utf8_list_for_display (gdkdisplay,
                                           gdk_x11_xatom_to_atom (prop->encoding),
                                           prop->format,
                                           prop->value,
@@ -300,7 +310,7 @@ _wnck_get_text_property (Screen *screen,
                         &text,
                         atom))
     {
-      retval = text_property_to_utf8 (&text);
+      retval = text_property_to_utf8 (display, &text);
 
       if (text.value)
         XFree (text.value);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]