annotate src/video/quartz/SDL_QuartzVideo.h @ 779:68c8da837fc0

Date: Tue, 6 Jan 2004 21:54:02 +0100 From: Max Horn Subject: Auto hide mouse & other changes the attached bug adds the auto-hide-mouse feature I talked about earlier. Turned out it was a lot simpler than I thought, simply by using our existing code :-). I actually spent much more time on fixing various bugs in the code and correcting (IMO) some behavior (although, due to the lack of real specs for SDL, it's probably arguable what 'correct' means...). * adds auto (un)hiding of mouse depending on whether it is in- or outside the game window * computation of course coordinates is correct now (it often and reproducible got out of sync with the old code, since the NSEvent window was in some cases *not* our window anymore, so locationInWindow returned wrong results) * added a method which at any time returns the mouse coords, relative to our window * fixed handling of lost/gain input/mouse/app focus "events"
author Sam Lantinga <slouken@libsdl.org>
date Wed, 07 Jan 2004 15:01:51 +0000
parents 6f4fe7f2063b
children 9e84d106ec19
rev   line source
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 /*
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
3 Copyright (C) 1997-2003 Sam Lantinga
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
13 Library General Public License for more details.
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19 Sam Lantinga
252
e8157fcb3114 Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents: 158
diff changeset
20 slouken@libsdl.org
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 */
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
23 /*
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 @file SDL_QuartzVideo.h
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
25 @author Darrell Walisser, Max Horn, et al.
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
27 @abstract SDL video driver for Mac OS X.
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29 @discussion
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31 TODO
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32 - Hardware Cursor support with NSCursor instead of Carbon
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 - Keyboard repeat/mouse speed adjust (if needed)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 - Multiple monitor support (currently only main display)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 - Accelerated blitting support
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
36 - Fix white OpenGL window on minimize (fixed) (update: broken again on 10.2)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
37 - Find out what events should be sent/ignored if window is minimized
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
38 - Find a way to deal with external resolution/depth switch while app is running
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
39 - Check accuracy of QZ_SetGamma()
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
40 Problems:
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
41 - OGL not working in full screen with software renderer
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42 - SetColors sets palette correctly but clears framebuffer
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
43 - Crash in CG after several mode switches (I think this has been fixed)
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
44 - Retained windows don't draw their title bar quite right (OS Bug) (not using retained windows)
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
45 - Cursor in 8 bit modes is screwy (might just be Radeon PCI bug) (update: not just Radeon)
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
46 - Warping cursor delays mouse events for a fraction of a second,
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
47 there is a hack around this that helps a bit
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
48 */
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
49
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
50 #include <Cocoa/Cocoa.h>
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
51 #include <OpenGL/OpenGL.h>
656
864e2d2a9a55 Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents: 615
diff changeset
52 #include <OpenGL/gl.h>
864e2d2a9a55 Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents: 615
diff changeset
53 #include <OpenGL/glext.h>
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
54 #include <Carbon/Carbon.h>
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
55 #include <QuickTime/QuickTime.h>
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
56 #include <IOKit/IOKitLib.h> /* For powersave handling */
588
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
57 #include <pthread.h>
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
58
588
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
59 #include "SDL_thread.h"
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
60 #include "SDL_video.h"
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
61 #include "SDL_error.h"
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
62 #include "SDL_timer.h"
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
63 #include "SDL_syswm.h"
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
64 #include "SDL_sysvideo.h"
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
65 #include "SDL_pixels_c.h"
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
66 #include "SDL_events_c.h"
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
67
770
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
68 /*
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
69 This is a workaround to directly access NSOpenGLContext's CGL context
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
70 We need this to check for errors NSOpenGLContext doesn't support
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
71 */
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
72 @interface NSOpenGLContext (CGLContextAccess)
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
73 - (CGLContextObj) cglContext;
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
74 @end
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
75
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
76
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
77 /* Main driver structure to store required state information */
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
78 typedef struct SDL_PrivateVideoData {
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
79
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
80 CGDirectDisplayID display; /* 0 == main display (only support single display) */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
81 CFDictionaryRef mode; /* current mode of the display */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
82 CFDictionaryRef save_mode; /* original mode of the display */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
83 CFArrayRef mode_list; /* list of available fullscreen modes */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
84 CGDirectPaletteRef palette; /* palette of an 8-bit display */
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
85 NSOpenGLContext *gl_context; /* OpenGL rendering context */
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
86 Uint32 width, height, bpp; /* frequently used data about the display */
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
87 Uint32 flags; /* flags for current mode, for teardown purposes */
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
88 Uint32 video_set; /* boolean; indicates if video was set correctly */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
89 Uint32 warp_flag; /* boolean; notify to event loop that a warp just occured */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
90 Uint32 warp_ticks; /* timestamp when the warp occured */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
91 NSWindow *window; /* Cocoa window to implement the SDL window */
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
92 NSQuickDrawView *view; /* the window's view; draw 2D and OpenGL into this view */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
93 SDL_Surface *resize_icon; /* icon for the resize badge, we have to draw it by hand */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
94 SDL_GrabMode current_grab_mode; /* default value is SDL_GRAB_OFF */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
95 SDL_Rect **client_mode_list; /* resolution list to pass back to client */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
96 SDLKey keymap[256]; /* Mac OS X to SDL key mapping */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
97 Uint32 current_mods; /* current keyboard modifiers, to track modifier state */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
98 Uint32 last_virtual_button;/* last virtual mouse button pressed */
563
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
99 io_connect_t power_connection; /* used with IOKit to detect wake from sleep */
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
100 Uint8 expect_mouse_up; /* used to determine when to send mouse up events */
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
101 Uint8 grab_state; /* used to manage grab behavior */
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
102 NSPoint cursor_loc; /* saved cursor coords, for activate/deactivate when grabbed */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
103 BOOL cursor_should_be_visible; /* tells if cursor is supposed to be visible (SDL_ShowCursor) */
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
104 BOOL cursor_visible; /* tells if cursor is *actually* visible or not */
588
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
105 Uint8* sw_buffers[2]; /* pointers to the two software buffers for double-buffer emulation */
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
106 SDL_Thread *thread; /* thread for async updates to the screen */
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
107 SDL_sem *sem1, *sem2; /* synchronization for async screen updates */
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
108 Uint8 *current_buffer; /* the buffer being copied to the screen */
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
109 BOOL quit_thread; /* used to quit the async blitting thread */
563
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
110
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
111 ImageDescriptionHandle yuv_idh;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
112 MatrixRecordPtr yuv_matrix;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
113 DecompressorComponent yuv_codec;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
114 ImageSequence yuv_seq;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
115 PlanarPixmapInfoYUV420 *yuv_pixmap;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
116 Sint16 yuv_width, yuv_height;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
117 CGrafPtr yuv_port;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
118
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
119 } SDL_PrivateVideoData;
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
120
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
121 #define _THIS SDL_VideoDevice *this
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
122 #define display_id (this->hidden->display)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
123 #define mode (this->hidden->mode)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
124 #define save_mode (this->hidden->save_mode)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
125 #define mode_list (this->hidden->mode_list)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
126 #define palette (this->hidden->palette)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
127 #define gl_context (this->hidden->gl_context)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
128 #define device_width (this->hidden->width)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
129 #define device_height (this->hidden->height)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
130 #define device_bpp (this->hidden->bpp)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
131 #define mode_flags (this->hidden->flags)
158
4382c38dfbee Date: Tue, 21 Aug 2001 03:50:01 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 155
diff changeset
132 #define qz_window (this->hidden->window)
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
133 #define window_view (this->hidden->view)
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
134 #define video_set (this->hidden->video_set)
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
135 #define warp_ticks (this->hidden->warp_ticks)
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
136 #define warp_flag (this->hidden->warp_flag)
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
137 #define resize_icon (this->hidden->resize_icon)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
138 #define current_grab_mode (this->hidden->current_grab_mode)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
139 #define client_mode_list (this->hidden->client_mode_list)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
140 #define keymap (this->hidden->keymap)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
141 #define current_mods (this->hidden->current_mods)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
142 #define last_virtual_button (this->hidden->last_virtual_button)
563
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
143 #define power_connection (this->hidden->power_connection)
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
144 #define expect_mouse_up (this->hidden->expect_mouse_up)
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
145 #define grab_state (this->hidden->grab_state)
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
146 #define cursor_loc (this->hidden->cursor_loc)
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
147 #define cursor_should_be_visible (this->hidden->cursor_should_be_visible)
563
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
148 #define cursor_visible (this->hidden->cursor_visible)
588
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
149 #define sw_buffers (this->hidden->sw_buffers)
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
150 #define thread (this->hidden->thread)
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
151 #define sem1 (this->hidden->sem1)
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
152 #define sem2 (this->hidden->sem2)
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
153 #define current_buffer (this->hidden->current_buffer)
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
154 #define quit_thread (this->hidden->quit_thread)
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
155
563
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
156 /* grab states - the input is in one of these states */
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
157 enum {
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
158 QZ_UNGRABBED = 0,
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
159 QZ_VISIBLE_GRAB,
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
160 QZ_INVISIBLE_GRAB
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
161 };
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
162
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
163 /* grab actions - these can change the grabbed state */
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
164 enum {
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
165 QZ_ENABLE_GRAB = 0,
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
166 QZ_DISABLE_GRAB,
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
167 QZ_HIDECURSOR,
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
168 QZ_SHOWCURSOR
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
169 };
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
170
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
171 /* Gamma Functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
172 int QZ_SetGamma (_THIS, float red, float green, float blue);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
173 int QZ_GetGamma (_THIS, float *red, float *green, float *blue);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
174 int QZ_SetGammaRamp (_THIS, Uint16 *ramp);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
175 int QZ_GetGammaRamp (_THIS, Uint16 *ramp);
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
176
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
177 /* OpenGL functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
178 int QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
179 void QZ_TearDownOpenGL (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
180 void* QZ_GL_GetProcAddress (_THIS, const char *proc);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
181 int QZ_GL_GetAttribute (_THIS, SDL_GLattr attrib, int* value);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
182 int QZ_GL_MakeCurrent (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
183 void QZ_GL_SwapBuffers (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
184 int QZ_GL_LoadLibrary (_THIS, const char *location);
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
185
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
186 /* Cursor and Mouse functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
187 void QZ_FreeWMCursor (_THIS, WMcursor *cursor);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
188 WMcursor* QZ_CreateWMCursor (_THIS, Uint8 *data, Uint8 *mask,
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
189 int w, int h, int hot_x, int hot_y);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
190 int QZ_ShowWMCursor (_THIS, WMcursor *cursor);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
191 void QZ_WarpWMCursor (_THIS, Uint16 x, Uint16 y);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
192 void QZ_MoveWMCursor (_THIS, int x, int y);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
193 void QZ_CheckMouseMode (_THIS);
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
194
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
195 /* Event functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
196 void QZ_InitOSKeymap (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
197 void QZ_PumpEvents (_THIS);
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
198
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
199 /* Window Manager functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
200 void QZ_SetCaption (_THIS, const char *title, const char *icon);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
201 void QZ_SetIcon (_THIS, SDL_Surface *icon, Uint8 *mask);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
202 int QZ_IconifyWindow (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
203 SDL_GrabMode QZ_GrabInput (_THIS, SDL_GrabMode grab_mode);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
204 /*int QZ_GetWMInfo (_THIS, SDL_SysWMinfo *info);*/
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
205
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
206 /* YUV functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
207 SDL_Overlay* QZ_CreateYUVOverlay (_THIS, int width, int height,
561
4bcf7dd06c47 Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 555
diff changeset
208 Uint32 format, SDL_Surface *display);
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
209
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
210
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
211 /* Private functions (used internally) */
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
212 void QZ_PrivateWarpCursor (_THIS, int x, int y);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
213 void QZ_ChangeGrabState (_THIS, int action);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
214 void QZ_RegisterForSleepNotifications (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
215 void QZ_ShowMouse (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
216 void QZ_HideMouse (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
217 void QZ_PrivateGlobalToLocal (_THIS, NSPoint *p);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
218 void QZ_PrivateCocoaToSDL (_THIS, NSPoint *p);
779
68c8da837fc0 Date: Tue, 6 Jan 2004 21:54:02 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 777
diff changeset
219 BOOL QZ_IsMouseInWindow (_THIS);