[SDL] [PATCH] Fixed XLocaleNotSupported in utf8 code

Ivo Danihelka i.danihelka at sh.cvut.cz
Wed Sep 1 16:06:23 PDT 2004


Hi,
there exist X server configurations which does not support locales.
They even does not support conversion from utf-8 textList to utf-8
textProperty.

This patch fixes such situations. It is my bug because I submitted the
previous support for utf-8.

-- 
Ivo Danihelka
-------------- next part --------------
Index: src/video/x11/SDL_x11wm.c
===================================================================
RCS file: /home/sdlweb/libsdl.org/cvs/SDL12/src/video/x11/SDL_x11wm.c,v
retrieving revision 1.11
diff -u -p -r1.11 SDL_x11wm.c
--- src/video/x11/SDL_x11wm.c	25 Jul 2004 17:33:33 -0000	1.11
+++ src/video/x11/SDL_x11wm.c	1 Sep 2004 22:11:38 -0000
@@ -255,22 +255,28 @@ void X11_SetCaption(_THIS, const char *t
 	SDL_Lock_EventThread();
 
 	if ( title != NULL ) {
+		int error = XLocaleNotSupported;
 #ifdef X_HAVE_UTF8_STRING
-		Xutf8TextListToTextProperty(SDL_Display, (char **)&title, 1,
-			XUTF8StringStyle, &titleprop);
-#else
-		XStringListToTextProperty((char **)&title, 1, &titleprop);
+		error = Xutf8TextListToTextProperty(SDL_Display,
+				(char **)&title, 1, XUTF8StringStyle,
+				&titleprop);
 #endif
+		if ( error != Success ) {
+			XStringListToTextProperty((char **)&title, 1,
+					&titleprop);
+		}
 		XSetWMName(SDL_Display, WMwindow, &titleprop);
 		XFree(titleprop.value);
 	}
 	if ( icon != NULL ) {
+		int error = XLocaleNotSupported;
 #ifdef X_HAVE_UTF8_STRING
-		Xutf8TextListToTextProperty(SDL_Display, (char **)&icon, 1,
-			XUTF8StringStyle, &iconprop);
-#else
-		XStringListToTextProperty((char **)&icon, 1, &iconprop);
+		error = Xutf8TextListToTextProperty(SDL_Display,
+				(char **)&icon, 1, XUTF8StringStyle, &iconprop);
 #endif
+		if ( error != Success ) {
+			XStringListToTextProperty((char **)&icon, 1, &iconprop);
+		}
 		XSetWMIconName(SDL_Display, WMwindow, &iconprop);
 		XFree(iconprop.value);
 	}


More information about the SDL mailing list