x11: fix setting UTF-8 window titles for some special cases
commit3e6e80a32c04e38c7d2fa77e4bcf1401e792dc7a
authorwm4 <wm4@mplayer2.org>
Wed, 25 Jan 2012 01:01:22 +0000 (25 02:01 +0100)
committerUoti Urpala <uau@mplayer2.org>
Sun, 25 Mar 2012 19:30:37 +0000 (25 22:30 +0300)
tree7afd049ef305d48ae176eb4ea20137f811c9b775
parent506d9beb666bae92a93b945594f4cb857e9a5ca5
x11: fix setting UTF-8 window titles for some special cases

Setting the WM_NAME/WM_ICON_NAME window properties didn't always work:
apparently there are some characters that can't be represented in the X
STRING or COMPOUND_TEXT encodings, such as U+2013 EN DASH. The function
Xutf8TextListToTextProperty partially converts the string, and returns
a value different from 'Success'. This means vo_x11_set_property_string
didn't set these window properties.

On most modern window managers, this is not a problem, since these use
the _NET_WM_NAME/_NET_ICON_NAME and the UTF8_STRING encoding. Some older
WMs like IceWM don't read these, and the window title remains blank.

It's not clear what exactly we should do in this situation, but fix it
by setting set the WM_NAME/WM_ICON_NAME properties as UTF8_TEXT. This
violates the ICCCM, but at least IceWM seems to handle this well.

See also:
  http://lists.freedesktop.org/archives/xorg/2004-September/003391.html
  http://lists.freedesktop.org/archives/xorg/2004-September/003395.html
libvo/x11_common.c