Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11video.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 | 8d9bb0cf2c2a |
children | 3ba88cb7eb1b |
comparison
equal
deleted
inserted
replaced
1557:61c237f69076 | 1558:b46bb79cc197 |
---|---|
308 } | 308 } |
309 | 309 |
310 /* Create auxiliary (toplevel) windows with the current visual */ | 310 /* Create auxiliary (toplevel) windows with the current visual */ |
311 static void create_aux_windows(_THIS) | 311 static void create_aux_windows(_THIS) |
312 { | 312 { |
313 Atom _NET_WM_NAME; | |
314 Atom _NET_WM_ICON_NAME; | |
313 char classname[1024]; | 315 char classname[1024]; |
314 XSetWindowAttributes xattr; | 316 XSetWindowAttributes xattr; |
315 XWMHints *hints; | 317 XWMHints *hints; |
316 XTextProperty titleprop, iconprop; | 318 XTextProperty titleprop, titlepropUTF8, iconprop, iconpropUTF8; |
317 int def_vis = (SDL_Visual == DefaultVisual(SDL_Display, SDL_Screen)); | 319 int def_vis = (SDL_Visual == DefaultVisual(SDL_Display, SDL_Screen)); |
320 | |
321 /* Look up some useful Atoms */ | |
322 WM_DELETE_WINDOW = pXInternAtom(SDL_Display, "WM_DELETE_WINDOW", False); | |
323 _NET_WM_NAME = pXInternAtom(SDL_Display, "_NET_WM_NAME", False); | |
324 _NET_WM_ICON_NAME = pXInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False); | |
318 | 325 |
319 /* Don't create any extra windows if we are being managed */ | 326 /* Don't create any extra windows if we are being managed */ |
320 if ( SDL_windowid ) { | 327 if ( SDL_windowid ) { |
321 FSwindow = 0; | 328 FSwindow = 0; |
322 WMwindow = SDL_strtol(SDL_windowid, NULL, 0); | 329 WMwindow = SDL_strtol(SDL_windowid, NULL, 0); |
356 mask = SubstructureRedirectMask; | 363 mask = SubstructureRedirectMask; |
357 pXSendEvent(SDL_Display, SDL_Root, False, mask, &ev); | 364 pXSendEvent(SDL_Display, SDL_Root, False, mask, &ev); |
358 } | 365 } |
359 | 366 |
360 hints = NULL; | 367 hints = NULL; |
361 titleprop.value = iconprop.value = NULL; | 368 titleprop.value = titlepropUTF8.value = NULL; |
369 iconprop.value = iconpropUTF8.value = NULL; | |
362 if(WMwindow) { | 370 if(WMwindow) { |
363 /* All window attributes must survive the recreation */ | 371 /* All window attributes must survive the recreation */ |
364 hints = pXGetWMHints(SDL_Display, WMwindow); | 372 hints = pXGetWMHints(SDL_Display, WMwindow); |
365 pXGetWMName(SDL_Display, WMwindow, &titleprop); | 373 pXGetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME); |
366 pXGetWMIconName(SDL_Display, WMwindow, &iconprop); | 374 pXGetTextProperty(SDL_Display, WMwindow, &titlepropUTF8, _NET_WM_NAME); |
375 pXGetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME); | |
376 pXGetTextProperty(SDL_Display, WMwindow, &iconpropUTF8, _NET_WM_ICON_NAME); | |
367 pXDestroyWindow(SDL_Display, WMwindow); | 377 pXDestroyWindow(SDL_Display, WMwindow); |
368 } | 378 } |
369 | 379 |
370 /* Create the window for windowed management */ | 380 /* Create the window for windowed management */ |
371 /* (reusing the xattr structure above) */ | 381 /* (reusing the xattr structure above) */ |
381 hints->flags = InputHint; | 391 hints->flags = InputHint; |
382 } | 392 } |
383 pXSetWMHints(SDL_Display, WMwindow, hints); | 393 pXSetWMHints(SDL_Display, WMwindow, hints); |
384 pXFree(hints); | 394 pXFree(hints); |
385 if(titleprop.value) { | 395 if(titleprop.value) { |
386 pXSetWMName(SDL_Display, WMwindow, &titleprop); | 396 pXSetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME); |
387 pXFree(titleprop.value); | 397 pXFree(titleprop.value); |
388 } | 398 } |
399 if(titlepropUTF8.value) { | |
400 pXSetTextProperty(SDL_Display, WMwindow, &titlepropUTF8, _NET_WM_NAME); | |
401 pXFree(titlepropUTF8.value); | |
402 } | |
389 if(iconprop.value) { | 403 if(iconprop.value) { |
390 pXSetWMIconName(SDL_Display, WMwindow, &iconprop); | 404 pXSetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME); |
391 pXFree(iconprop.value); | 405 pXFree(iconprop.value); |
406 } | |
407 if(iconpropUTF8.value) { | |
408 pXSetTextProperty(SDL_Display, WMwindow, &iconpropUTF8, _NET_WM_ICON_NAME); | |
409 pXFree(iconpropUTF8.value); | |
392 } | 410 } |
393 | 411 |
394 pXSelectInput(SDL_Display, WMwindow, | 412 pXSelectInput(SDL_Display, WMwindow, |
395 FocusChangeMask | KeyPressMask | KeyReleaseMask | 413 FocusChangeMask | KeyPressMask | KeyReleaseMask |
396 | PropertyChangeMask | StructureNotifyMask | KeymapStateMask); | 414 | PropertyChangeMask | StructureNotifyMask | KeymapStateMask); |
431 } | 449 } |
432 } | 450 } |
433 #endif | 451 #endif |
434 | 452 |
435 /* Allow the window to be deleted by the window manager */ | 453 /* Allow the window to be deleted by the window manager */ |
436 WM_DELETE_WINDOW = pXInternAtom(SDL_Display, "WM_DELETE_WINDOW", False); | |
437 pXSetWMProtocols(SDL_Display, WMwindow, &WM_DELETE_WINDOW, 1); | 454 pXSetWMProtocols(SDL_Display, WMwindow, &WM_DELETE_WINDOW, 1); |
438 } | 455 } |
439 | 456 |
440 static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat) | 457 static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat) |
441 { | 458 { |