summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2011-12-26 17:15:11 +0100
committerwm4 <wm4@mplayer2.org>2012-01-18 02:53:30 +0100
commit2e0bae181f155541922278d681185a5b84f602b4 (patch)
tree10603afa929e8348312893feda4936a3fdf3b262
parent34b22ec6ea4a31eb40bb29b6da21cf2f406ea1a4 (diff)
downloadmpv-2e0bae181f155541922278d681185a5b84f602b4.tar.bz2
mpv-2e0bae181f155541922278d681185a5b84f602b4.tar.xz
x11: simplify setting unicode text properties
-rw-r--r--libvo/x11_common.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index cdbbc213b5..e33b3c7ff6 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -993,34 +993,18 @@ static int vo_x11_get_gnome_layer(struct vo_x11_state *x11, Window win)
return WIN_LAYER_NORMAL;
}
-// set a X text property that expects a STRING type
+// set a X text property that expects a STRING or COMPOUND_TEXT type
static void vo_x11_set_property_string(struct vo *vo, Atom name, const char *t)
{
struct vo_x11_state *x11 = vo->x11;
XTextProperty prop = {0};
- int success;
-
- success = Xutf8TextListToTextProperty(x11->display, (char **)&t, 1,
- XStringStyle, &prop);
-
- // The call can fail if the string uses characters not in the STRING
- // encoding (which is latin-1 as far as I can tell). Try COMPOUND_TEXT
- // instead. (It is possible that COMPOUND_TEXT always works, but since the
- // difference in the type used for the property is visible to the Window
- // manager and the ICCCM seems to specify STRING, we're trying to be careful
- // and try STRING first.)
- // GTK seems to follow about the same fallback mechanism.
- if (success != Success) {
- XFree(prop.value);
- prop.value = NULL;
- success = Xutf8TextListToTextProperty(x11->display, (char **)&t, 1,
- XCompoundTextStyle, &prop);
- }
- if (success == Success)
+ if (Xutf8TextListToTextProperty(x11->display, (char **)&t, 1,
+ XStdICCTextStyle, &prop) == Success)
+ {
XSetTextProperty(x11->display, x11->window, &prop, name);
-
- XFree(prop.value);
+ XFree(prop.value);
+ }
}
// set a X text property that expects a UTF8_STRING type