Hans de Goede wrote:
Hi,
On 10/24/2010 05:54 PM, Arnon Gilboa wrote:
Fix win client broken by the utf8 patch.
---
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 8248aee..145f6b2 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 (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)
Hmm, sorry about this, the reason that I assumed that using
SetWindowText with a
UTF-8 string would work fine is because Microsoft's documentation says
that
it takes a const char *, not a const wchar *:
http://msdn.microsoft.com/en-us/library/ms633546%28VS.85%29.aspx
It's ok.
Are we compiling with some define which turns all non unicode
functions into
their unicode equivalents?
Right, we inherit the default UNICODE/_UNICODE defines
Regards,
Hans
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel