[MPlayer-dev-eng] [Patch] Supporting unicode window title
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Thu May 5 07:37:36 CEST 2011
On Thu, May 05, 2011 at 04:48:03AM +0400, Vladimir Mosgalin wrote:
> On 2011.05.04 at 23:24:57 +0200, Reimar Döffinger wrote next:
>
> > > I'm running mplayer in window lately, and got sick watching at ugly
> > > chars in window title with
> > > use-filename-title = on
> > > option (russian and asian letters look completely wrong, european
> > > symbols like ä render with extra symbol/distorted). Fortunately, it's
> > > easy to fix by adding a hint.. should work with any descent window
> > > manager.
> >
> > What else is it if not UTF-8? Personally I strongly think that
> > needing this rather implies it is _not_ a decent window manager
> > (though past experience says such a thing is as real as
> > yellow unicorns).
>
> Well normal XStoreName isn't unicode aware; according to manual
> "If the string is not in the Host Portable Character Encoding, the
> result is implementation-dependent."
> where Host Portable Character Encoding is minimum subset that's
> same in each and every encoding in Xlib, ie.
> a..z A..Z 0..9 !"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ <space>, <tab>, and
> <newline>
>
> And "implementation-dependent", of course, means "it's not going to
> work, live with that". Hint is only real way that works. And by descent
> window manager I mean one that follows standard,
> http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html, where if
> WM_NAME is set, it's used instead of old-style title.
Why would you call it a "decent window manager" when "implementation-dependent"
character encoding doesn't mean UTF-8?
I'd at best call that one still living in the last century and making things
needlessly difficult due to it.
Even more so since detecting UTF-8 is possible quite reliably if you
really want to insist on not breaking anything.
> > > XTranslateCoordinates(mDisplay, vo_window, mRootWin, 0, 0, &vo_dx, &vo_dy,
> > > &dummy_win);
> > > if (vo_wintitle)
> > > + {
> > > XStoreName(mDisplay, vo_window, vo_wintitle);
> > > + XChangeProperty(mDisplay, vo_window,
> > > + XInternAtom(mDisplay, "_NET_WM_NAME", False),
> > > + XInternAtom(mDisplay, "UTF8_STRING", False),
> > > + 8, PropModeReplace, (unsigned char *) vo_wintitle,
> > > + strlen(vo_wintitle));
> >
> > Please handle this in the same way as other Atoms are handled,
> > search the file for e.g. NET_WM_PID to see what to add where.
> > Maybe a bit overkill but better to keep it as consistent as
> > possible (though I admit _MOTIF_WM_HINTS and XV_COLORKEY atoms
> > already aren't implemented consistently).
>
> OK, attached. UTF8_STRING looks a bit ugly.. but oh well.
Fine by me.
More information about the MPlayer-dev-eng
mailing list