src/video/x11/SDL_x11wm.c
changeset 1505 4d005dfbb7f5
parent 1402 d910939febfa
child 1558 b46bb79cc197
equal deleted inserted replaced
1504:7b4b31075f67 1505:4d005dfbb7f5
   253 		error = pXutf8TextListToTextProperty(SDL_Display,
   253 		error = pXutf8TextListToTextProperty(SDL_Display,
   254 				(char **)&title, 1, XUTF8StringStyle,
   254 				(char **)&title, 1, XUTF8StringStyle,
   255 				&titleprop);
   255 				&titleprop);
   256 #endif
   256 #endif
   257 		if ( error != Success ) {
   257 		if ( error != Success ) {
   258 			pXStringListToTextProperty((char **)&title, 1,
   258 			char *title_latin1 = SDL_iconv_utf8_latin1((char *)title);
   259 					&titleprop);
   259 			if ( !title_latin1 ) {
       
   260 				SDL_OutOfMemory();
       
   261 				return;
       
   262 			}
       
   263 			pXStringListToTextProperty(&title_latin1, 1, &titleprop);
       
   264 			SDL_free(title_latin1);
   260 		}
   265 		}
   261 		pXSetWMName(SDL_Display, WMwindow, &titleprop);
   266 		pXSetWMName(SDL_Display, WMwindow, &titleprop);
   262 		pXFree(titleprop.value);
   267 		pXFree(titleprop.value);
   263 	}
   268 	}
   264 	if ( icon != NULL ) {
   269 	if ( icon != NULL ) {
   266 #ifdef X_HAVE_UTF8_STRING
   271 #ifdef X_HAVE_UTF8_STRING
   267 		error = pXutf8TextListToTextProperty(SDL_Display,
   272 		error = pXutf8TextListToTextProperty(SDL_Display,
   268 				(char **)&icon, 1, XUTF8StringStyle, &iconprop);
   273 				(char **)&icon, 1, XUTF8StringStyle, &iconprop);
   269 #endif
   274 #endif
   270 		if ( error != Success ) {
   275 		if ( error != Success ) {
   271 			pXStringListToTextProperty((char **)&icon, 1, &iconprop);
   276 			char *icon_latin1 = SDL_iconv_utf8_latin1((char *)title);
       
   277 			if ( !icon_latin1 ) {
       
   278 				SDL_OutOfMemory();
       
   279 				return;
       
   280 			}
       
   281 			pXStringListToTextProperty(&icon_latin1, 1, &iconprop);
       
   282 			SDL_free(icon_latin1);
   272 		}
   283 		}
   273 		pXSetWMIconName(SDL_Display, WMwindow, &iconprop);
   284 		pXSetWMIconName(SDL_Display, WMwindow, &iconprop);
   274 		pXFree(iconprop.value);
   285 		pXFree(iconprop.value);
   275 	}
   286 	}
   276 	pXSync(SDL_Display, False);
   287 	pXSync(SDL_Display, False);