Mercurial > sdl-ios-xcode
diff src/video/quartz/SDL_QuartzWindow.m @ 272:d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
From: Darrell Walisser <dwaliss1@purdue.edu>
Subject: SDL Quartz video update
-better mouse motion events
-fixed minification bugs (except OpenGL)
-fixed QZ_SetGamma for correct semantics
-fade/unfade display before/after rez switch
-experimental obscured-check/blind-copy code
The obscured code, while it speeds up window drawing substantially, isn't
ready yet. The reason is that there doesn't (yet) seem to be a way to know
when the window is dragged or when the window suddenly comes to the
foreground. Since Carbon windows seem to allow detection of such things, I
suspect it is possible through some window server API. Cocoa(NSWindow) has no
functions for such things, AFAIK.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 22 Jan 2002 18:46:28 +0000 |
parents | bd6b0a910a65 |
children | 74262d2647ca |
line wrap: on
line diff
--- a/src/video/quartz/SDL_QuartzWindow.m Tue Jan 22 18:28:35 2002 +0000 +++ b/src/video/quartz/SDL_QuartzWindow.m Tue Jan 22 18:46:28 2002 +0000 @@ -7,17 +7,74 @@ - (void)display; @end +/** + * Function to set the opacity of window's pixels to 100% + * The opacity is only used by the window server code that does the minimize effect + **/ +static void QZ_SetPortAlphaOpaque (CGrafPtr port, Uint32 noTitleBar) { + + Uint32 *pixels; + Uint32 rowPixels; + Uint32 width, height; + Uint32 bpp; + PixMapHandle pixMap; + Rect bounds; + int i, j; + + pixMap = GetPortPixMap ( port ); + bpp = GetPixDepth ( pixMap ); + + if (bpp == 32) { + + GetPortBounds ( port, &bounds ); + width = bounds.right - bounds.left; + height = bounds.bottom - bounds.top; + + LockPortBits (port); + + pixels = (Uint32*) GetPixBaseAddr ( pixMap ); + rowPixels = GetPixRowBytes ( pixMap ) / 4; + + if (! noTitleBar) { + + /* offset for title bar */ + pixels += rowPixels * 22; + } + + for (i = 0; i < height; i++) + for (j = 0; j < width; j++) { + + pixels[ (i * rowPixels) + j ] |= 0xFF000000; + } + + UnlockPortBits (port); + } +} + @implementation SDL_QuartzWindow -/* These methods should be rewritten to fix the miniaturize bug */ +/* override these methods to fix the miniaturize animation/dock icon bug */ - (void)miniaturize:(id)sender { + + if (SDL_VideoSurface->flags & SDL_OPENGL) { + + /* Grab framebuffer and put into NSImage */ + /* [ qz_window setMiniwindowImage:image ]; */ + } + else { + + QZ_SetPortAlphaOpaque ([ [ self contentView ] qdPort ], + [ self styleMask ] & NSBorderlessWindowMask); + } + [ super miniaturize:sender ]; } +/* this routine fires *after* deminiaturizing, so it might be useless to us */ - (void)deminiaturize:(id)sender { - [ super deminiaturize:sender ]; + [ super deminiaturize:sender ]; } - (void)display @@ -38,4 +95,14 @@ SDL_PrivateQuit(); return NO; } + @end + +/* empty class; probably could be used to fix bugs in the future */ +@interface SDL_QuartzWindowView : NSQuickDrawView +{} +@end + +@implementation SDL_QuartzWindowView + +@end \ No newline at end of file