Fixed bug #139
The text in SDL_WM_SetCaption() is in UTF-8 encoding. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401509
This commit is contained in:
parent
ffbb789969
commit
cf05f2fab8
4 changed files with 22 additions and 14 deletions
|
@ -818,7 +818,7 @@ extern DECLSPEC void SDLCALL SDL_GL_Unlock(void);
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets/Gets the title and icon text of the display window
|
* Sets/Gets the title and icon text of the display window (UTF-8 encoded)
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon);
|
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon);
|
||||||
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon);
|
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon);
|
||||||
|
|
|
@ -762,13 +762,9 @@ int SDL_RegisterApp(char *name, Uint32 style, void *hInst)
|
||||||
if ( name ) {
|
if ( name ) {
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
/* WinCE uses the UNICODE version */
|
/* WinCE uses the UNICODE version */
|
||||||
size_t nLen = SDL_strlen(name)+1;
|
SDL_Appname = SDL_iconv_utf8_ucs2(name);
|
||||||
SDL_Appname = SDL_malloc(nLen*2);
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, name, -1, SDL_Appname, nLen);
|
|
||||||
#else
|
#else
|
||||||
size_t nLen = SDL_strlen(name)+1;
|
SDL_Appname = SDL_iconv_utf8_latin1(name);
|
||||||
SDL_Appname = SDL_malloc(nLen);
|
|
||||||
SDL_strlcpy(SDL_Appname, name, nLen);
|
|
||||||
#endif /* _WIN32_WCE */
|
#endif /* _WIN32_WCE */
|
||||||
SDL_Appstyle = style;
|
SDL_Appstyle = style;
|
||||||
SDL_Instance = hInst ? hInst : SDL_GetModuleHandle();
|
SDL_Instance = hInst ? hInst : SDL_GetModuleHandle();
|
||||||
|
|
|
@ -230,12 +230,13 @@ void WIN_SetWMCaption(_THIS, const char *title, const char *icon)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
/* WinCE uses the UNICODE version */
|
/* WinCE uses the UNICODE version */
|
||||||
int nLen = SDL_strlen(title)+1;
|
LPWSTR lpszW = SDL_iconv_utf8_ucs2(title);
|
||||||
LPWSTR lpszW = alloca(nLen*2);
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, title, -1, lpszW, nLen);
|
|
||||||
SetWindowText(SDL_Window, lpszW);
|
SetWindowText(SDL_Window, lpszW);
|
||||||
|
SDL_free(lpszW);
|
||||||
#else
|
#else
|
||||||
SetWindowText(SDL_Window, title);
|
char *lpsz = SDL_iconv_utf8_latin1(title);
|
||||||
|
SetWindowText(SDL_Window, lpsz);
|
||||||
|
SDL_free(lpsz);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,8 +255,13 @@ void X11_SetCaption(_THIS, const char *title, const char *icon)
|
||||||
&titleprop);
|
&titleprop);
|
||||||
#endif
|
#endif
|
||||||
if ( error != Success ) {
|
if ( error != Success ) {
|
||||||
pXStringListToTextProperty((char **)&title, 1,
|
char *title_latin1 = SDL_iconv_utf8_latin1((char *)title);
|
||||||
&titleprop);
|
if ( !title_latin1 ) {
|
||||||
|
SDL_OutOfMemory();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pXStringListToTextProperty(&title_latin1, 1, &titleprop);
|
||||||
|
SDL_free(title_latin1);
|
||||||
}
|
}
|
||||||
pXSetWMName(SDL_Display, WMwindow, &titleprop);
|
pXSetWMName(SDL_Display, WMwindow, &titleprop);
|
||||||
pXFree(titleprop.value);
|
pXFree(titleprop.value);
|
||||||
|
@ -268,7 +273,13 @@ void X11_SetCaption(_THIS, const char *title, const char *icon)
|
||||||
(char **)&icon, 1, XUTF8StringStyle, &iconprop);
|
(char **)&icon, 1, XUTF8StringStyle, &iconprop);
|
||||||
#endif
|
#endif
|
||||||
if ( error != Success ) {
|
if ( error != Success ) {
|
||||||
pXStringListToTextProperty((char **)&icon, 1, &iconprop);
|
char *icon_latin1 = SDL_iconv_utf8_latin1((char *)title);
|
||||||
|
if ( !icon_latin1 ) {
|
||||||
|
SDL_OutOfMemory();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pXStringListToTextProperty(&icon_latin1, 1, &iconprop);
|
||||||
|
SDL_free(icon_latin1);
|
||||||
}
|
}
|
||||||
pXSetWMIconName(SDL_Display, WMwindow, &iconprop);
|
pXSetWMIconName(SDL_Display, WMwindow, &iconprop);
|
||||||
pXFree(iconprop.value);
|
pXFree(iconprop.value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue