Commit ae47a8fa authored by erg@chromium.org's avatar erg@chromium.org

Linux: Relanding a patch from an external contributor.

This patch was reverted because it leaked memory on every
window title set. This changes the patch around to use
UTF-8 XTextProperties and to free allocated memory
afterwards.

"""
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
First Review URL: https://codereview.chromium.org/414413002

Review URL: https://codereview.chromium.org/464173002

Cr-Commit-Position: refs/heads/master@{#289529}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289529 0039d316-1c4b-4281-b951-d872f2087c98
parent 12731795
...@@ -122,6 +122,7 @@ Etienne Laurin <etienne@atnnn.com> ...@@ -122,6 +122,7 @@ Etienne Laurin <etienne@atnnn.com>
Evan Peterson <evan.peterson.ep@gmail.com> Evan Peterson <evan.peterson.ep@gmail.com>
Evan Wallace <evan.exe@gmail.com> Evan Wallace <evan.exe@gmail.com>
Evangelos Foutras <evangelos@foutrelis.com> Evangelos Foutras <evangelos@foutrelis.com>
Evgeniy Dushistov <dushistov@gmail.com>
Fabien Tassin <fta@sofaraway.org> Fabien Tassin <fta@sofaraway.org>
Felix H. Dahlke <fhd@ubercode.de> Felix H. Dahlke <fhd@ubercode.de>
Fernando Jiménez Moreno <ferjmoreno@gmail.com> Fernando Jiménez Moreno <ferjmoreno@gmail.com>
......
...@@ -632,11 +632,13 @@ bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) { ...@@ -632,11 +632,13 @@ bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) {
PropModeReplace, PropModeReplace,
reinterpret_cast<const unsigned char*>(utf8str.c_str()), reinterpret_cast<const unsigned char*>(utf8str.c_str()),
utf8str.size()); utf8str.size());
// TODO(erg): This is technically wrong. So XStoreName and friends expect XTextProperty xtp;
// this in Host Portable Character Encoding instead of UTF-8, which I believe char *c_utf8_str = const_cast<char *>(utf8str.c_str());
// is Compound Text. This shouldn't matter 90% of the time since this is the if (Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1,
// fallback to the UTF8 property above. XUTF8StringStyle, &xtp) == Success) {
XStoreName(xdisplay_, xwindow_, utf8str.c_str()); XSetWMName(xdisplay_, xwindow_, &xtp);
XFree(xtp.value);
}
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment