comparison src/video/cocoa/SDL_cocoawindow.m @ 3057:089a77aebb7d

Added test program for SDL_CreateWindowFrom() Make sure OpenGL library is loaded before working with OpenGL windows, even those created with SDL_CreateWindowFrom()
author Sam Lantinga <slouken@libsdl.org>
date Mon, 09 Feb 2009 05:32:12 +0000
parents 99210400e8b9
children 4c28a9655933
comparison
equal deleted inserted replaced
3056:a434fe6360df 3057:089a77aebb7d
420 420
421 if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) { 421 if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) {
422 [nswindow release]; 422 [nswindow release];
423 return -1; 423 return -1;
424 } 424 }
425 #ifdef SDL_VIDEO_OPENGL_CGL
426 if (window->flags & SDL_WINDOW_OPENGL) {
427 if (Cocoa_GL_SetupWindow(_this, window) < 0) {
428 Cocoa_DestroyWindow(_this, window);
429 return -1;
430 }
431 }
432 #endif
433 return 0; 425 return 0;
434 } 426 }
435 427
436 int 428 int
437 Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) 429 Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
584 { 576 {
585 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 577 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
586 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 578 SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
587 579
588 if (data) { 580 if (data) {
589 #ifdef SDL_VIDEO_OPENGL_CGL
590 if (window->flags & SDL_WINDOW_OPENGL) {
591 Cocoa_GL_CleanupWindow(_this, window);
592 }
593 #endif
594 [data->listener close]; 581 [data->listener close];
595 [data->listener release]; 582 [data->listener release];
596 if (data->created) { 583 if (data->created) {
597 [data->window close]; 584 [data->window close];
598 } 585 }