mirror of
https://github.com/joel16/SDL2.git
synced 2025-03-04 01:17:05 +00:00
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
@ -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_GetCaption(char **title, char **icon);
|
||||
|
@ -762,13 +762,9 @@ int SDL_RegisterApp(char *name, Uint32 style, void *hInst)
|
||||
if ( name ) {
|
||||
#ifdef _WIN32_WCE
|
||||
/* WinCE uses the UNICODE version */
|
||||
size_t nLen = SDL_strlen(name)+1;
|
||||
SDL_Appname = SDL_malloc(nLen*2);
|
||||
MultiByteToWideChar(CP_ACP, 0, name, -1, SDL_Appname, nLen);
|
||||
SDL_Appname = SDL_iconv_utf8_ucs2(name);
|
||||
#else
|
||||
size_t nLen = SDL_strlen(name)+1;
|
||||
SDL_Appname = SDL_malloc(nLen);
|
||||
SDL_strlcpy(SDL_Appname, name, nLen);
|
||||
SDL_Appname = SDL_iconv_utf8_latin1(name);
|
||||
#endif /* _WIN32_WCE */
|
||||
SDL_Appstyle = style;
|
||||
SDL_Instance = hInst ? hInst : SDL_GetModuleHandle();
|
||||
|
@ -230,12 +230,13 @@ void WIN_SetWMCaption(_THIS, const char *title, const char *icon)
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
/* WinCE uses the UNICODE version */
|
||||
int nLen = SDL_strlen(title)+1;
|
||||
LPWSTR lpszW = alloca(nLen*2);
|
||||
MultiByteToWideChar(CP_ACP, 0, title, -1, lpszW, nLen);
|
||||
LPWSTR lpszW = SDL_iconv_utf8_ucs2(title);
|
||||
SetWindowText(SDL_Window, lpszW);
|
||||
SDL_free(lpszW);
|
||||
#else
|
||||
SetWindowText(SDL_Window, title);
|
||||
char *lpsz = SDL_iconv_utf8_latin1(title);
|
||||
SetWindowText(SDL_Window, lpsz);
|
||||
SDL_free(lpsz);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -255,8 +255,13 @@ void X11_SetCaption(_THIS, const char *title, const char *icon)
|
||||
&titleprop);
|
||||
#endif
|
||||
if ( error != Success ) {
|
||||
pXStringListToTextProperty((char **)&title, 1,
|
||||
&titleprop);
|
||||
char *title_latin1 = SDL_iconv_utf8_latin1((char *)title);
|
||||
if ( !title_latin1 ) {
|
||||
SDL_OutOfMemory();
|
||||
return;
|
||||
}
|
||||
pXStringListToTextProperty(&title_latin1, 1, &titleprop);
|
||||
SDL_free(title_latin1);
|
||||
}
|
||||
pXSetWMName(SDL_Display, WMwindow, &titleprop);
|
||||
pXFree(titleprop.value);
|
||||
@ -268,7 +273,13 @@ void X11_SetCaption(_THIS, const char *title, const char *icon)
|
||||
(char **)&icon, 1, XUTF8StringStyle, &iconprop);
|
||||
#endif
|
||||
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);
|
||||
pXFree(iconprop.value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user