diff options
author | Arnon Gilboa <agilboa@redhat.com> | 2010-10-25 08:35:34 +0200 |
---|---|---|
committer | Arnon Gilboa <agilboa@redhat.com> | 2010-10-25 08:35:34 +0200 |
commit | 79660586188ba968bb95f9ef198f56fa4d1ff972 (patch) | |
tree | 7abf767c3a5d70cc156782a57ee5bc31101a96df /client | |
parent | 3d08b908b4c7d260d090094abcb8c287334a6b28 (diff) | |
download | spice-79660586188ba968bb95f9ef198f56fa4d1ff972.tar.gz spice-79660586188ba968bb95f9ef198f56fa4d1ff972.tar.xz spice-79660586188ba968bb95f9ef198f56fa4d1ff972.zip |
spicec-win: map title string from utf8 to utf16
Fix win client broken by the utf8 patch.
Diffstat (limited to 'client')
-rw-r--r-- | client/windows/red_window.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp index 8248aeec..6d8a70d8 100644 --- a/client/windows/red_window.cpp +++ b/client/windows/red_window.cpp @@ -448,7 +448,14 @@ RedWindow::~RedWindow() void RedWindow::set_title(std::string& title) { - SetWindowText(_win, title.c_str()); + int len = MultiByteToWideChar(CP_UTF8, 0, title.c_str(), title.length(), NULL, 0) + 1; + WCHAR* wtitle = new WCHAR[len * sizeof(WCHAR)]; + + if (wtitle && MultiByteToWideChar(CP_UTF8, 0, title.c_str(), title.length(), wtitle, len)) { + wtitle[len - 1] = L'\0'; + SetWindowText(_win, wtitle); + } + delete []wtitle; } void RedWindow::set_icon(Icon* icon) |