Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11wm.c @ 1558:b46bb79cc197
Fixed bug #113:
Date: Sat, 16 Apr 2005 08:39:22 +1000
From: "Eric Mangold"
Subject: [SDL] Window manager does not show SDL window titles
Hello,
I have an issue with SDL-using applications and the sawfish window manager.
The problem is that SDL windows do not show the window caption. My gnome
panel *does* show the window name, but the actual sawfish window frame
shows no caption at all. All other non-SDL applications that I use work
fine.
I tried a couple other window managers, and they *were* able to show the
SDL window captions correctly. Though there many be other WMs that can't.
I believe the problem is that SDL is using the UTF8_STRING type for the
window's WM_NAME and WM_ICON properties. In fact, WM_NAME and WM_ICON are
supposed to set to a TEXT type, usually STRING (ISO 8859-1).
The property names _NET_WM_NAME and _NET_WM_ICON_NAME should be used to
store the UTF8_STRING versions of the window title and icon name.
You can see the properties I refer to with a command like this:
xprop|grep -e "WM.*NAME"
Please note the freedesktop.org standard:
http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#id2506954
This page talks a little bit about the history of these properties. Just
search down the page for "WM_NAME".
http://www.cl.cam.ac.uk/~mgk25/unicode.html
Please let me know if I can be of any assistance in resolving this issue.
Thanks,
Eric Mangold
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 20 Mar 2006 07:31:36 +0000 |
parents | 4d005dfbb7f5 |
children | 3ba88cb7eb1b |
comparison
equal
deleted
inserted
replaced
1557:61c237f69076 | 1558:b46bb79cc197 |
---|---|
241 } | 241 } |
242 | 242 |
243 void X11_SetCaption(_THIS, const char *title, const char *icon) | 243 void X11_SetCaption(_THIS, const char *title, const char *icon) |
244 { | 244 { |
245 XTextProperty titleprop, iconprop; | 245 XTextProperty titleprop, iconprop; |
246 Status status; | |
247 | |
248 #ifdef X_HAVE_UTF8_STRING | |
249 Atom _NET_WM_NAME; | |
250 Atom _NET_WM_ICON_NAME; | |
251 | |
252 /* Look up some useful Atoms */ | |
253 _NET_WM_NAME = pXInternAtom(SDL_Display, "_NET_WM_NAME", False); | |
254 _NET_WM_ICON_NAME = pXInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False); | |
255 #endif | |
246 | 256 |
247 /* Lock the event thread, in multi-threading environments */ | 257 /* Lock the event thread, in multi-threading environments */ |
248 SDL_Lock_EventThread(); | 258 SDL_Lock_EventThread(); |
249 | 259 |
250 if ( title != NULL ) { | 260 if ( title != NULL ) { |
251 int error = XLocaleNotSupported; | 261 char *title_latin1 = SDL_iconv_utf8_latin1((char *)title); |
262 if ( !title_latin1 ) { | |
263 SDL_OutOfMemory(); | |
264 return; | |
265 } | |
266 status = pXStringListToTextProperty(&title_latin1, 1, &titleprop); | |
267 SDL_free(title_latin1); | |
268 if ( status ) { | |
269 pXSetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME); | |
270 pXFree(titleprop.value); | |
271 } | |
252 #ifdef X_HAVE_UTF8_STRING | 272 #ifdef X_HAVE_UTF8_STRING |
253 error = pXutf8TextListToTextProperty(SDL_Display, | 273 status = pXutf8TextListToTextProperty(SDL_Display, |
254 (char **)&title, 1, XUTF8StringStyle, | 274 (char **)&title, 1, XUTF8StringStyle, &titleprop); |
255 &titleprop); | 275 if ( status == Success ) { |
276 pXSetTextProperty(SDL_Display, WMwindow, &titleprop, _NET_WM_NAME); | |
277 pXFree(titleprop.value); | |
278 } | |
256 #endif | 279 #endif |
257 if ( error != Success ) { | |
258 char *title_latin1 = SDL_iconv_utf8_latin1((char *)title); | |
259 if ( !title_latin1 ) { | |
260 SDL_OutOfMemory(); | |
261 return; | |
262 } | |
263 pXStringListToTextProperty(&title_latin1, 1, &titleprop); | |
264 SDL_free(title_latin1); | |
265 } | |
266 pXSetWMName(SDL_Display, WMwindow, &titleprop); | |
267 pXFree(titleprop.value); | |
268 } | 280 } |
269 if ( icon != NULL ) { | 281 if ( icon != NULL ) { |
270 int error = XLocaleNotSupported; | 282 char *icon_latin1 = SDL_iconv_utf8_latin1((char *)icon); |
283 if ( !icon_latin1 ) { | |
284 SDL_OutOfMemory(); | |
285 return; | |
286 } | |
287 status = pXStringListToTextProperty(&icon_latin1, 1, &iconprop); | |
288 SDL_free(icon_latin1); | |
289 if ( status ) { | |
290 pXSetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME); | |
291 pXFree(iconprop.value); | |
292 } | |
271 #ifdef X_HAVE_UTF8_STRING | 293 #ifdef X_HAVE_UTF8_STRING |
272 error = pXutf8TextListToTextProperty(SDL_Display, | 294 status = pXutf8TextListToTextProperty(SDL_Display, |
273 (char **)&icon, 1, XUTF8StringStyle, &iconprop); | 295 (char **)&icon, 1, XUTF8StringStyle, &iconprop); |
296 if ( status == Success ) { | |
297 pXSetTextProperty(SDL_Display, WMwindow, &iconprop, _NET_WM_ICON_NAME); | |
298 pXFree(iconprop.value); | |
299 } | |
274 #endif | 300 #endif |
275 if ( error != Success ) { | |
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); | |
283 } | |
284 pXSetWMIconName(SDL_Display, WMwindow, &iconprop); | |
285 pXFree(iconprop.value); | |
286 } | 301 } |
287 pXSync(SDL_Display, False); | 302 pXSync(SDL_Display, False); |
288 | 303 |
289 SDL_Unlock_EventThread(); | 304 SDL_Unlock_EventThread(); |
290 } | 305 } |