diff options
author | dushistov@gmail.com <dushistov@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-29 02:52:36 +0000 |
---|---|---|
committer | dushistov@gmail.com <dushistov@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-29 02:52:36 +0000 |
commit | a25a50715427fc3ee8ac29a487a6b91cb2db5f51 (patch) | |
tree | 79df89d06907c0d5c64c3ef49e93b31b6bc13631 | |
parent | 5163a484e893511cbc907a05c4965ae7af2a3afa (diff) | |
download | chromium_src-a25a50715427fc3ee8ac29a487a6b91cb2db5f51.zip chromium_src-a25a50715427fc3ee8ac29a487a6b91cb2db5f51.tar.gz chromium_src-a25a50715427fc3ee8ac29a487a6b91cb2db5f51.tar.bz2 |
After chromium stop using gtk+ for Linux/X11 all not ASCII character in window title start looks like garbage. This patch fixes this issue, by using algorithm similar to gtk+/Qt's way of setting window titles.
BUG=378096
R=erg@chromium.org
Review URL: https://codereview.chromium.org/414413002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286058 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc | 21 |
2 files changed, 17 insertions, 5 deletions
@@ -118,6 +118,7 @@ Etienne Laurin <etienne@atnnn.com> Evan Peterson <evan.peterson.ep@gmail.com> Evan Wallace <evan.exe@gmail.com> Evangelos Foutras <evangelos@foutrelis.com> +Evgeniy Dushistov <dushistov@gmail.com> Fabien Tassin <fta@sofaraway.org> Felix H. Dahlke <fhd@ubercode.de> Fernando Jiménez Moreno <ferjmoreno@gmail.com> diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc index cae42de..852fa2d 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc @@ -627,11 +627,22 @@ bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) { PropModeReplace, reinterpret_cast<const unsigned char*>(utf8str.c_str()), utf8str.size()); - // TODO(erg): This is technically wrong. So XStoreName and friends expect - // this in Host Portable Character Encoding instead of UTF-8, which I believe - // is Compound Text. This shouldn't matter 90% of the time since this is the - // fallback to the UTF8 property above. - XStoreName(xdisplay_, xwindow_, utf8str.c_str()); + XTextProperty xtp; + char *c_utf8_str = const_cast<char *>(utf8str.c_str()); + const int err = + Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1, + XCompoundTextStyle, &xtp); + if (err != Success) { + const std::string ascii_str = base::UTF16ToASCII(title); + xtp.encoding = XA_STRING; + xtp.format = 8; + xtp.value = reinterpret_cast<unsigned char *> + (const_cast<char *>(ascii_str.c_str())); + xtp.nitems = ascii_str.size(); + XSetWMName(xdisplay_, xwindow_, &xtp); + } else { + XSetWMName(xdisplay_, xwindow_, &xtp); + } return true; } |