Mercurial > sdl-ios-xcode
comparison src/video/quartz/SDL_QuartzVideo.m @ 158:4382c38dfbee
Date: Tue, 21 Aug 2001 03:50:01 +0200
From: Max Horn <max@quendi.de>
Subject: New patch for OS X
Attached a .patch file for SDL/OSX with some nice bug fixes / enhancments.
* fixes the activation issues, which also caused the window to be
always drawn like an inactive. The close/minimize widgets now are
animated properly, too.
* the menu items are automatically adjusted to use the app name
instead of just "SDL App". I did this so that we really can use one
central SDLMain.nib file, w/o requiring developers to make a copy of
it and adjust it.
* libSDLMain now contains the proper cocoa code, not as before the
carbon code. This means apps no longer have to carry a copy of
SDLMain.m/SDLMain.h
* revamped configure.in to properly build a Cocoa/Quartz SDL lib, not
a Carbon based SDL lib
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 21 Aug 2001 07:19:59 +0000 |
parents | 2d162219f433 |
children | 37e3ca9254c7 |
comparison
equal
deleted
inserted
replaced
157:de04f423389a | 158:4382c38dfbee |
---|---|
265 else { | 265 else { |
266 if ( (mode_flags & SDL_OPENGL) == 0 ) { | 266 if ( (mode_flags & SDL_OPENGL) == 0 ) { |
267 UnlockPortBits ( [ windowView qdPort ] ); | 267 UnlockPortBits ( [ windowView qdPort ] ); |
268 [ windowView release ]; | 268 [ windowView release ]; |
269 } | 269 } |
270 [ window setContentView:nil ]; | 270 [ qz_window setContentView:nil ]; |
271 [ window setDelegate:nil ]; | 271 [ qz_window setDelegate:nil ]; |
272 [ window close ]; | 272 [ qz_window close ]; |
273 } | 273 } |
274 | 274 |
275 /* Set pixels to null (so other code doesn't try to free it) */ | 275 /* Set pixels to null (so other code doesn't try to free it) */ |
276 if (this->screen != NULL) | 276 if (this->screen != NULL) |
277 this->screen->pixels = NULL; | 277 this->screen->pixels = NULL; |
406 if ( flags & SDL_RESIZABLE ) | 406 if ( flags & SDL_RESIZABLE ) |
407 style |= NSResizableWindowMask; | 407 style |= NSResizableWindowMask; |
408 } | 408 } |
409 | 409 |
410 /* Manually create a window, avoids having a nib file resource */ | 410 /* Manually create a window, avoids having a nib file resource */ |
411 window = [ [ SDL_QuartzWindow alloc ] initWithContentRect:rect | 411 qz_window = [ [ SDL_QuartzWindow alloc ] initWithContentRect:rect |
412 styleMask:style backing:NSBackingStoreBuffered defer:NO ]; | 412 styleMask:style backing:NSBackingStoreBuffered defer:NO ]; |
413 if (window == nil) { | 413 if (qz_window == nil) { |
414 SDL_SetError ("Could not create the Cocoa window"); | 414 SDL_SetError ("Could not create the Cocoa window"); |
415 return NULL; | 415 return NULL; |
416 } | 416 } |
417 | 417 |
418 current->flags = 0; | 418 current->flags = 0; |
419 current->w = width; | 419 current->w = width; |
420 current->h = height; | 420 current->h = height; |
421 | 421 |
422 [ window setReleasedWhenClosed:YES ]; | 422 [ qz_window setReleasedWhenClosed:YES ]; |
423 QZ_SetCaption(this, this->wm_title, this->wm_icon); | 423 QZ_SetCaption(this, this->wm_title, this->wm_icon); |
424 [ window setAcceptsMouseMovedEvents:YES ]; | 424 [ qz_window setAcceptsMouseMovedEvents:YES ]; |
425 [ window setViewsNeedDisplay:NO ]; | 425 [ qz_window setViewsNeedDisplay:NO ]; |
426 [ window center ]; | 426 [ qz_window center ]; |
427 [ window setDelegate: | 427 [ qz_window setDelegate: |
428 [ [ [ SDL_QuartzWindowDelegate alloc ] init ] autorelease ] ]; | 428 [ [ [ SDL_QuartzWindowDelegate alloc ] init ] autorelease ] ]; |
429 | 429 |
430 /* For OpenGL, we set the content view to a NSOpenGLView */ | 430 /* For OpenGL, we set the content view to a NSOpenGLView */ |
431 if ( flags & SDL_OPENGL ) { | 431 if ( flags & SDL_OPENGL ) { |
432 | 432 |
433 if ( ! QZ_SetupOpenGL (this, bpp, flags) ) { | 433 if ( ! QZ_SetupOpenGL (this, bpp, flags) ) { |
434 return NULL; | 434 return NULL; |
435 } | 435 } |
436 | 436 |
437 [ gl_context setView: [ window contentView ] ]; | 437 [ gl_context setView: [ qz_window contentView ] ]; |
438 [ gl_context makeCurrentContext]; | 438 [ gl_context makeCurrentContext]; |
439 [ window orderFront:nil ]; | 439 [ qz_window makeKeyAndOrderFront:nil ]; |
440 current->flags |= SDL_OPENGL; | 440 current->flags |= SDL_OPENGL; |
441 } | 441 } |
442 /* For 2D, we set the content view to a NSQuickDrawView */ | 442 /* For 2D, we set the content view to a NSQuickDrawView */ |
443 else { | 443 else { |
444 | 444 |
445 windowView = [ [ NSQuickDrawView alloc ] init ]; | 445 windowView = [ [ NSQuickDrawView alloc ] init ]; |
446 [ window setContentView:windowView ]; | 446 [ qz_window setContentView:windowView ]; |
447 [ window orderFront:nil ]; | 447 [ qz_window makeKeyAndOrderFront:nil ]; |
448 | 448 |
449 LockPortBits ( [ windowView qdPort ] ); | 449 LockPortBits ( [ windowView qdPort ] ); |
450 current->pixels = GetPixBaseAddr ( GetPortPixMap ( [ windowView qdPort ] ) ); | 450 current->pixels = GetPixBaseAddr ( GetPortPixMap ( [ windowView qdPort ] ) ); |
451 current->pitch = GetPixRowBytes ( GetPortPixMap ( [ windowView qdPort ] ) ); | 451 current->pitch = GetPixRowBytes ( GetPortPixMap ( [ windowView qdPort ] ) ); |
452 | 452 |