[PATCH] SDL_WM_SetCaption with UTF-8

Hello,

This patch enables UTF-8 suport for SDL_WM_SetCaption() in x11.

XFree86 >= 4.0.2 supports text strings in UTF-8. Presence of this
feature is indicated by the macro X_HAVE_UTF8_STRING.–
Ivo Danihelka

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.10
diff -u -p -r1.10 SDL_x11wm.c
— src/video/x11/SDL_x11wm.c 4 Jan 2004 16:49:27 -0000 1.10
+++ src/video/x11/SDL_x11wm.c 28 Jun 2004 20:52:28 -0000
@@ -255,12 +255,22 @@ void X11_SetCaption(_THIS, const char *t
SDL_Lock_EventThread();

if ( title != NULL ) {

+#ifdef X_HAVE_UTF8_STRING

  •   Xutf8TextListToTextProperty(SDL_Display, (char **)&title, 1,
    
  •   	XUTF8StringStyle, &titleprop);
    

+#else
XStringListToTextProperty((char **)&title, 1, &titleprop);
+#endif
XSetWMName(SDL_Display, WMwindow, &titleprop);
XFree(titleprop.value);
}
if ( icon != NULL ) {
+#ifdef X_HAVE_UTF8_STRING

  •   Xutf8TextListToTextProperty(SDL_Display, (char **)&icon, 1,
    
  •   	XUTF8StringStyle, &iconprop);
    

+#else
XStringListToTextProperty((char **)&icon, 1, &iconprop);
+#endif
XSetWMIconName(SDL_Display, WMwindow, &iconprop);
XFree(iconprop.value);
}

Do I miss something? Is there any other way how to enable unicode
characters in window caption?On Mon, 2004-06-28 at 23:15, Ivo Danihelka wrote:

This patch enables UTF-8 suport for SDL_WM_SetCaption() in x11.


Ivo Danihelka

Ivo Danihelka wrote:> On Mon, 2004-06-28 at 23:15, Ivo Danihelka wrote:

This patch enables UTF-8 suport for SDL_WM_SetCaption() in x11.

Do I miss something? Is there any other way how to enable unicode
characters in window caption?

I don’t think that there is.

It seems that for some obscure reason, X11 unicode support in SDL is frowned
upon.

A taboo of some sort.

./lxnt

Hello,

This patch enables UTF-8 suport for SDL_WM_SetCaption() in x11.

XFree86 >= 4.0.2 supports text strings in UTF-8. Presence of this
feature is indicated by the macro X_HAVE_UTF8_STRING.

Thanks! Added to CVS.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment