comparison 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
comparison
equal deleted inserted replaced
271:9631db4d9ee1 272:d1447a846d80
5 - (void)miniaturize:(id)sender; 5 - (void)miniaturize:(id)sender;
6 - (void)deminiaturize:(id)sender; 6 - (void)deminiaturize:(id)sender;
7 - (void)display; 7 - (void)display;
8 @end 8 @end
9 9
10 /**
11 * Function to set the opacity of window's pixels to 100%
12 * The opacity is only used by the window server code that does the minimize effect
13 **/
14 static void QZ_SetPortAlphaOpaque (CGrafPtr port, Uint32 noTitleBar) {
15
16 Uint32 *pixels;
17 Uint32 rowPixels;
18 Uint32 width, height;
19 Uint32 bpp;
20 PixMapHandle pixMap;
21 Rect bounds;
22 int i, j;
23
24 pixMap = GetPortPixMap ( port );
25 bpp = GetPixDepth ( pixMap );
26
27 if (bpp == 32) {
28
29 GetPortBounds ( port, &bounds );
30 width = bounds.right - bounds.left;
31 height = bounds.bottom - bounds.top;
32
33 LockPortBits (port);
34
35 pixels = (Uint32*) GetPixBaseAddr ( pixMap );
36 rowPixels = GetPixRowBytes ( pixMap ) / 4;
37
38 if (! noTitleBar) {
39
40 /* offset for title bar */
41 pixels += rowPixels * 22;
42 }
43
44 for (i = 0; i < height; i++)
45 for (j = 0; j < width; j++) {
46
47 pixels[ (i * rowPixels) + j ] |= 0xFF000000;
48 }
49
50 UnlockPortBits (port);
51 }
52 }
53
10 @implementation SDL_QuartzWindow 54 @implementation SDL_QuartzWindow
11 55
12 /* These methods should be rewritten to fix the miniaturize bug */ 56 /* override these methods to fix the miniaturize animation/dock icon bug */
13 - (void)miniaturize:(id)sender 57 - (void)miniaturize:(id)sender
14 { 58 {
59
60 if (SDL_VideoSurface->flags & SDL_OPENGL) {
61
62 /* Grab framebuffer and put into NSImage */
63 /* [ qz_window setMiniwindowImage:image ]; */
64 }
65 else {
66
67 QZ_SetPortAlphaOpaque ([ [ self contentView ] qdPort ],
68 [ self styleMask ] & NSBorderlessWindowMask);
69 }
70
15 [ super miniaturize:sender ]; 71 [ super miniaturize:sender ];
16 } 72 }
17 73
74 /* this routine fires *after* deminiaturizing, so it might be useless to us */
18 - (void)deminiaturize:(id)sender 75 - (void)deminiaturize:(id)sender
19 { 76 {
20 [ super deminiaturize:sender ]; 77 [ super deminiaturize:sender ];
21 } 78 }
22 79
23 - (void)display 80 - (void)display
24 { 81 {
25 /* Do nothing to keep pinstripe pattern from drawing */ 82 /* Do nothing to keep pinstripe pattern from drawing */
36 - (BOOL)windowShouldClose:(id)sender { 93 - (BOOL)windowShouldClose:(id)sender {
37 94
38 SDL_PrivateQuit(); 95 SDL_PrivateQuit();
39 return NO; 96 return NO;
40 } 97 }
98
41 @end 99 @end
100
101 /* empty class; probably could be used to fix bugs in the future */
102 @interface SDL_QuartzWindowView : NSQuickDrawView
103 {}
104 @end
105
106 @implementation SDL_QuartzWindowView
107
108 @end