Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11wm.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 | b5a4ac87b98c |
comparison
equal
deleted
inserted
replaced
1766:410b1ed7fe28 | 1767:ae9f6be81810 |
---|---|
238 done: | 238 done: |
239 SDL_Unlock_EventThread(); | 239 SDL_Unlock_EventThread(); |
240 SDL_FreeSurface(sicon); | 240 SDL_FreeSurface(sicon); |
241 } | 241 } |
242 | 242 |
243 void X11_SetCaption(_THIS, const char *title, const char *icon) | 243 void X11_SetCaptionNoLock(_THIS, const char *title, const char *icon) |
244 { | 244 { |
245 XTextProperty titleprop, iconprop; | 245 XTextProperty titleprop, iconprop; |
246 Status status; | 246 Status status; |
247 | 247 |
248 #ifdef X_HAVE_UTF8_STRING | 248 #ifdef X_HAVE_UTF8_STRING |
253 if (SDL_X11_HAVE_UTF8) { | 253 if (SDL_X11_HAVE_UTF8) { |
254 _NET_WM_NAME = XInternAtom(SDL_Display, "_NET_WM_NAME", False); | 254 _NET_WM_NAME = XInternAtom(SDL_Display, "_NET_WM_NAME", False); |
255 _NET_WM_ICON_NAME = XInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False); | 255 _NET_WM_ICON_NAME = XInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False); |
256 } | 256 } |
257 #endif | 257 #endif |
258 | |
259 /* Lock the event thread, in multi-threading environments */ | |
260 SDL_Lock_EventThread(); | |
261 | 258 |
262 if ( title != NULL ) { | 259 if ( title != NULL ) { |
263 char *title_latin1 = SDL_iconv_utf8_latin1((char *)title); | 260 char *title_latin1 = SDL_iconv_utf8_latin1((char *)title); |
264 if ( !title_latin1 ) { | 261 if ( !title_latin1 ) { |
265 SDL_OutOfMemory(); | 262 SDL_OutOfMemory(); |
304 } | 301 } |
305 } | 302 } |
306 #endif | 303 #endif |
307 } | 304 } |
308 XSync(SDL_Display, False); | 305 XSync(SDL_Display, False); |
309 | 306 } |
307 | |
308 void X11_SetCaption(_THIS, const char *title, const char *icon) | |
309 { | |
310 SDL_Lock_EventThread(); | |
311 X11_SetCaptionNoLock(this, title, icon); | |
310 SDL_Unlock_EventThread(); | 312 SDL_Unlock_EventThread(); |
311 } | 313 } |
312 | 314 |
313 /* Iconify the window */ | 315 /* Iconify the window */ |
314 int X11_IconifyWindow(_THIS) | 316 int X11_IconifyWindow(_THIS) |
330 return(SDL_GRAB_OFF); | 332 return(SDL_GRAB_OFF); |
331 } | 333 } |
332 if ( ! SDL_Window ) { | 334 if ( ! SDL_Window ) { |
333 return(mode); /* Will be set later on mode switch */ | 335 return(mode); /* Will be set later on mode switch */ |
334 } | 336 } |
335 #if SDL_VIDEO_DRIVER_X11_XINERAMA | |
336 /* FIXME: Is this okay? | |
337 if ( use_xinerama ) { | |
338 mode &= ~SDL_GRAB_FULLSCREEN; | |
339 } | |
340 */ | |
341 #endif | |
342 if ( mode == SDL_GRAB_OFF ) { | 337 if ( mode == SDL_GRAB_OFF ) { |
343 XUngrabPointer(SDL_Display, CurrentTime); | 338 XUngrabPointer(SDL_Display, CurrentTime); |
344 XUngrabKeyboard(SDL_Display, CurrentTime); | 339 XUngrabKeyboard(SDL_Display, CurrentTime); |
345 } else { | 340 } else { |
346 if ( this->screen->flags & SDL_FULLSCREEN ) { | 341 if ( this->screen->flags & SDL_FULLSCREEN ) { |
349 } | 344 } |
350 /* Try to grab the mouse */ | 345 /* Try to grab the mouse */ |
351 #if 0 /* We'll wait here until we actually grab, otherwise behavior undefined */ | 346 #if 0 /* We'll wait here until we actually grab, otherwise behavior undefined */ |
352 for ( numtries = 0; numtries < 10; ++numtries ) { | 347 for ( numtries = 0; numtries < 10; ++numtries ) { |
353 #else | 348 #else |
354 while ( 1 ) { | 349 for ( ; ; ) { |
355 #endif | 350 #endif |
356 result = XGrabPointer(SDL_Display, SDL_Window, True, 0, | 351 result = XGrabPointer(SDL_Display, SDL_Window, True, 0, |
357 GrabModeAsync, GrabModeAsync, | 352 GrabModeAsync, GrabModeAsync, |
358 SDL_Window, None, CurrentTime); | 353 SDL_Window, None, CurrentTime); |
359 if ( result == GrabSuccess ) { | 354 if ( result == GrabSuccess ) { |