Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11video.c @ 1767:ae9f6be81810
Fixed bug #196
Use the title and icon stored in the SDL video info, when creating X11 windows.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 05 May 2006 05:09:10 +0000 |
parents | c2c6ff414ef5 |
children | c546353b1ad4 |
comparison
equal
deleted
inserted
replaced
1766:410b1ed7fe28 | 1767:ae9f6be81810 |
---|---|
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 int x = 0, y = 0; | 313 int x = 0, y = 0; |
314 Atom _NET_WM_NAME; | |
315 Atom _NET_WM_ICON_NAME; | |
316 char classname[1024]; | 314 char classname[1024]; |
317 XSetWindowAttributes xattr; | 315 XSetWindowAttributes xattr; |
318 XWMHints *hints; | 316 XWMHints *hints; |
319 XTextProperty titleprop, titlepropUTF8, iconprop, iconpropUTF8; | |
320 int def_vis = (SDL_Visual == DefaultVisual(SDL_Display, SDL_Screen)); | 317 int def_vis = (SDL_Visual == DefaultVisual(SDL_Display, SDL_Screen)); |
321 | 318 |
322 /* Look up some useful Atoms */ | 319 /* Look up some useful Atoms */ |
323 WM_DELETE_WINDOW = XInternAtom(SDL_Display, "WM_DELETE_WINDOW", False); | 320 WM_DELETE_WINDOW = XInternAtom(SDL_Display, "WM_DELETE_WINDOW", False); |
324 _NET_WM_NAME = XInternAtom(SDL_Display, "_NET_WM_NAME", False); | |
325 _NET_WM_ICON_NAME = XInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False); | |
326 | 321 |
327 /* Don't create any extra windows if we are being managed */ | 322 /* Don't create any extra windows if we are being managed */ |
328 if ( SDL_windowid ) { | 323 if ( SDL_windowid ) { |
329 FSwindow = 0; | 324 FSwindow = 0; |
330 WMwindow = SDL_strtol(SDL_windowid, NULL, 0); | 325 WMwindow = SDL_strtol(SDL_windowid, NULL, 0); |
370 mask = SubstructureRedirectMask; | 365 mask = SubstructureRedirectMask; |
371 XSendEvent(SDL_Display, SDL_Root, False, mask, &ev); | 366 XSendEvent(SDL_Display, SDL_Root, False, mask, &ev); |
372 } | 367 } |
373 | 368 |
374 hints = NULL; | 369 hints = NULL; |
375 titleprop.value = titlepropUTF8.value = NULL; | |
376 iconprop.value = iconpropUTF8.value = NULL; | |
377 if(WMwindow) { | 370 if(WMwindow) { |
378 /* All window attributes must survive the recreation */ | 371 /* All window attributes must survive the recreation */ |
379 hints = XGetWMHints(SDL_Display, WMwindow); | 372 hints = XGetWMHints(SDL_Display, WMwindow); |
380 XGetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME); | |
381 XGetTextProperty(SDL_Display, WMwindow, &titlepropUTF8, _NET_WM_NAME); | |
382 XGetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME); | |
383 XGetTextProperty(SDL_Display, WMwindow, &iconpropUTF8, _NET_WM_ICON_NAME); | |
384 XDestroyWindow(SDL_Display, WMwindow); | 373 XDestroyWindow(SDL_Display, WMwindow); |
385 } | 374 } |
386 | 375 |
387 /* Create the window for windowed management */ | 376 /* Create the window for windowed management */ |
388 /* (reusing the xattr structure above) */ | 377 /* (reusing the xattr structure above) */ |
398 hints->input = True; | 387 hints->input = True; |
399 hints->flags = InputHint; | 388 hints->flags = InputHint; |
400 } | 389 } |
401 XSetWMHints(SDL_Display, WMwindow, hints); | 390 XSetWMHints(SDL_Display, WMwindow, hints); |
402 XFree(hints); | 391 XFree(hints); |
403 if(titleprop.value) { | 392 X11_SetCaptionNoLock(this, this->wm_title, this->wm_icon); |
404 XSetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME); | |
405 XFree(titleprop.value); | |
406 } | |
407 if(titlepropUTF8.value) { | |
408 XSetTextProperty(SDL_Display, WMwindow, &titlepropUTF8, _NET_WM_NAME); | |
409 XFree(titlepropUTF8.value); | |
410 } | |
411 if(iconprop.value) { | |
412 XSetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME); | |
413 XFree(iconprop.value); | |
414 } | |
415 if(iconpropUTF8.value) { | |
416 XSetTextProperty(SDL_Display, WMwindow, &iconpropUTF8, _NET_WM_ICON_NAME); | |
417 XFree(iconpropUTF8.value); | |
418 } | |
419 | 393 |
420 XSelectInput(SDL_Display, WMwindow, | 394 XSelectInput(SDL_Display, WMwindow, |
421 FocusChangeMask | KeyPressMask | KeyReleaseMask | 395 FocusChangeMask | KeyPressMask | KeyReleaseMask |
422 | PropertyChangeMask | StructureNotifyMask | KeymapStateMask); | 396 | PropertyChangeMask | StructureNotifyMask | KeymapStateMask); |
423 | 397 |