Date: Sun, 10 Jun 2001 17:33:44 -0500
From: Darrell Walisser <dwaliss1@purdue.edu> Subject: Re: [SDL] Mac OS X Goodies For You Updates and fixes: -fixed erasing window when minmizing it (with some minor window redraw problems) -implemented close box to send SDLQuit event -fixed messed up alpha on 32bpp windows --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%4057
This commit is contained in:
parent
028b0ae934
commit
addd2dc543
2 changed files with 29 additions and 6 deletions
|
@ -355,7 +355,8 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
|
||||||
|
|
||||||
/* Manually create a window, avoids having a nib file resource */
|
/* Manually create a window, avoids having a nib file resource */
|
||||||
window = [ [ SDL_QuartzWindow alloc ] initWithContentRect:rect
|
window = [ [ SDL_QuartzWindow alloc ] initWithContentRect:rect
|
||||||
styleMask:(NSTitledWindowMask | NSMiniaturizableWindowMask)
|
styleMask:(NSTitledWindowMask | NSMiniaturizableWindowMask |
|
||||||
|
NSClosableWindowMask)
|
||||||
backing: //NSBackingStoreBuffered
|
backing: //NSBackingStoreBuffered
|
||||||
NSBackingStoreRetained
|
NSBackingStoreRetained
|
||||||
defer:NO ];
|
defer:NO ];
|
||||||
|
@ -368,9 +369,13 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
|
||||||
current->w = width;
|
current->w = width;
|
||||||
current->h = height;
|
current->h = height;
|
||||||
|
|
||||||
|
[ window setReleasedWhenClosed:YES ];
|
||||||
[ window setTitle:windowTitle ];
|
[ window setTitle:windowTitle ];
|
||||||
[ window setAcceptsMouseMovedEvents:YES ];
|
[ window setAcceptsMouseMovedEvents:YES ];
|
||||||
|
[ window setViewsNeedDisplay:NO ];
|
||||||
[ window center ];
|
[ window center ];
|
||||||
|
[ window setDelegate:
|
||||||
|
[ [ [ SDL_QuartzWindowDelegate alloc ] init ] autorelease ] ];
|
||||||
|
|
||||||
/* For OpenGL, we set the content view to a NSOpenGLView */
|
/* For OpenGL, we set the content view to a NSOpenGLView */
|
||||||
if ( flags & SDL_OPENGL ) {
|
if ( flags & SDL_OPENGL ) {
|
||||||
|
@ -447,7 +452,7 @@ static SDL_Surface* QZ_SetVideoMode (_THIS, SDL_Surface *current, int width,
|
||||||
SDL_SetError ("24bpp is not available");
|
SDL_SetError ("24bpp is not available");
|
||||||
return NULL;
|
return NULL;
|
||||||
case 32: /* (8)-8-8-8 ARGB */
|
case 32: /* (8)-8-8-8 ARGB */
|
||||||
amask = 0xFF000000;
|
amask = 0x00000000; /* per-pixel alpha needs to be fixed */
|
||||||
rmask = 0x00FF0000;
|
rmask = 0x00FF0000;
|
||||||
gmask = 0x0000FF00;
|
gmask = 0x0000FF00;
|
||||||
bmask = 0x000000FF;
|
bmask = 0x000000FF;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
{}
|
{}
|
||||||
- (void)miniaturize:(id)sender;
|
- (void)miniaturize:(id)sender;
|
||||||
- (void)deminiaturize:(id)sender;
|
- (void)deminiaturize:(id)sender;
|
||||||
|
- (void)display;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SDL_QuartzWindow
|
@implementation SDL_QuartzWindow
|
||||||
|
@ -16,10 +17,27 @@
|
||||||
|
|
||||||
- (void)deminiaturize:(id)sender
|
- (void)deminiaturize:(id)sender
|
||||||
{
|
{
|
||||||
/* Let the app know they have to redraw everything */
|
|
||||||
SDL_PrivateExpose ();
|
|
||||||
|
|
||||||
[ super deminiaturize:sender ];
|
[ super deminiaturize:sender ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)display
|
||||||
|
{
|
||||||
|
/* Do nothing to keep pinstripe pattern from drawing */
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
/* Delegate for our NSWindow to send SDLQuit() on close */
|
||||||
|
@interface SDL_QuartzWindowDelegate : NSObject
|
||||||
|
{}
|
||||||
|
- (BOOL)windowShouldClose:(id)sender;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation SDL_QuartzWindowDelegate
|
||||||
|
- (BOOL)windowShouldClose:(id)sender {
|
||||||
|
|
||||||
|
SDL_Event event;
|
||||||
|
event.type = SDL_QUIT;
|
||||||
|
SDL_PushEvent(&event);
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
@end
|
@end
|
Loading…
Add table
Add a link
Reference in a new issue