summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper St. Pierre <[email protected]>2015-07-20 23:54:12 +0200
committerinfirit <[email protected]>2015-09-14 18:45:45 +0200
commitb4b73de038caffbca46e3f94e4ec056c16734f5c (patch)
tree608a121f5eea5cc4c9f8ace9670f87b243723e6e /src
parente959355cbae2b4ed4dcd9124b0ffe1e328965ef0 (diff)
downloadmarco-b4b73de038caffbca46e3f94e4ec056c16734f5c.tar.bz2
marco-b4b73de038caffbca46e3f94e4ec056c16734f5c.tar.xz
xprop: Don't use GDK for reading text properties
Diffstat (limited to 'src')
-rw-r--r--src/core/xprops.c26
-rw-r--r--src/include/ui.h3
-rw-r--r--src/ui/ui.c32
3 files changed, 24 insertions, 37 deletions
diff --git a/src/core/xprops.c b/src/core/xprops.c
index 82d28046..a54e2185 100644
--- a/src/core/xprops.c
+++ b/src/core/xprops.c
@@ -646,6 +646,29 @@ meta_prop_get_cardinal_with_atom_type (MetaDisplay *display,
return cardinal_with_atom_type_from_results (&results, prop_type, cardinal_p);
}
+static char *
+text_property_to_utf8 (Display *xdisplay,
+ const XTextProperty *prop)
+{
+ char *ret = NULL;
+ char **local_list = NULL;
+ int count = 0;
+ int res;
+
+ res = XmbTextPropertyToTextList (xdisplay, prop, &local_list, &count);
+ if (res == XNoMemory || res == XLocaleNotSupported || res == XConverterNotFound)
+ goto out;
+
+ if (count == 0)
+ goto out;
+
+ ret = g_strdup (local_list[0]);
+
+ out:
+ meta_XFree (local_list);
+ return ret;
+}
+
static gboolean
text_property_from_results (GetPropertyResults *results,
char **utf8_str_p)
@@ -660,8 +683,7 @@ text_property_from_results (GetPropertyResults *results,
tp.format = results->format;
tp.nitems = results->n_items;
- *utf8_str_p = meta_text_property_to_utf8 (results->display->xdisplay,
- &tp);
+ *utf8_str_p = text_property_to_utf8 (results->display->xdisplay, &tp);
if (tp.value != NULL)
XFree (tp.value);
diff --git a/src/include/ui.h b/src/include/ui.h
index e7ce90aa..a3e4975c 100644
--- a/src/include/ui.h
+++ b/src/include/ui.h
@@ -170,9 +170,6 @@ GdkPixbuf* meta_ui_get_default_mini_icon (MetaUI *ui);
gboolean meta_ui_window_should_not_cause_focus (Display *xdisplay,
Window xwindow);
-char* meta_text_property_to_utf8 (Display *xdisplay,
- const XTextProperty *prop);
-
void meta_ui_set_current_theme (const char *name,
gboolean force_reload);
gboolean meta_ui_have_a_theme (void);
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 6de4de1c..582ac43c 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -931,38 +931,6 @@ meta_ui_window_should_not_cause_focus (Display *xdisplay,
return FALSE;
}
-char*
-meta_text_property_to_utf8 (Display *xdisplay,
- const XTextProperty *prop)
-{
- GdkDisplay *display;
- char **list;
- int count;
- char *retval;
-
- list = NULL;
-
- display = gdk_x11_lookup_xdisplay (xdisplay);
- count = gdk_text_property_to_utf8_list_for_display (display,
- gdk_x11_xatom_to_atom_for_display (display, prop->encoding),
- prop->format,
- prop->value,
- prop->nitems,
- &list);
-
- if (count == 0)
- retval = NULL;
- else
- {
- retval = list[0];
- list[0] = g_strdup (""); /* something to free */
- }
-
- g_strfreev (list);
-
- return retval;
-}
-
void
meta_ui_theme_get_frame_borders (MetaUI *ui,
MetaFrameType type,