src/video/quartz/SDL_QuartzVideo.h
changeset 501 74262d2647ca
parent 498 4b8ff8ac2c07
child 555 2536446a92de
     1.1 --- a/src/video/quartz/SDL_QuartzVideo.h	Sat Oct 05 04:56:32 2002 +0000
     1.2 +++ b/src/video/quartz/SDL_QuartzVideo.h	Sat Oct 05 05:07:57 2002 +0000
     1.3 @@ -22,9 +22,9 @@
     1.4  
     1.5  /*    
     1.6      @file   SDL_QuartzVideo.h
     1.7 -    @author Darrell Walisser
     1.8 +    @author Darrell Walisser, Max Horn, et al.
     1.9      
    1.10 -    @abstract SDL video driver for MacOS X.
    1.11 +    @abstract SDL video driver for Mac OS X.
    1.12      
    1.13      @discussion
    1.14      
    1.15 @@ -33,17 +33,17 @@
    1.16          - Keyboard repeat/mouse speed adjust (if needed)
    1.17          - Multiple monitor support (currently only main display)
    1.18          - Accelerated blitting support
    1.19 -        - Fix white OpenGL window on minimize (fixed)
    1.20 -        - Find out what events should be sent/ignored if window is mimimized
    1.21 +        - Fix white OpenGL window on minimize (fixed) (update: broken again on 10.2)
    1.22 +        - Find out what events should be sent/ignored if window is minimized
    1.23          - Find a way to deal with external resolution/depth switch while app is running
    1.24 -        - Resizeable windows
    1.25 +        - Resizeable windows (done)
    1.26          - Check accuracy of QZ_SetGamma()
    1.27      Problems:
    1.28          - OGL not working in full screen with software renderer
    1.29          - SetColors sets palette correctly but clears framebuffer
    1.30          - Crash in CG after several mode switches (I think this has been fixed)
    1.31          - Retained windows don't draw their title bar quite right (OS Bug) (not using retained windows)
    1.32 -        - Cursor in 8 bit modes is screwy (might just be Radeon PCI bug)
    1.33 +        - Cursor in 8 bit modes is screwy (might just be Radeon PCI bug) (update: not just Radeon)
    1.34          - Warping cursor delays mouse events for a fraction of a second,
    1.35            there is a hack around this that helps a bit
    1.36  */
    1.37 @@ -62,11 +62,11 @@
    1.38  #include "SDL_events_c.h"
    1.39  
    1.40  /* 
    1.41 -   Add methods to get at private members of NSScreen. 
    1.42 -   Since there is a bug in Apple's screen switching code
    1.43 -   that does not update this variable when switching
    1.44 -   to fullscreen, we'll set it manually (but only for the
    1.45 -   main screen).
    1.46 +    Add methods to get at private members of NSScreen. 
    1.47 +    Since there is a bug in Apple's screen switching code
    1.48 +    that does not update this variable when switching
    1.49 +    to fullscreen, we'll set it manually (but only for the
    1.50 +    main screen).
    1.51  */
    1.52  @interface NSScreen (NSScreenAccess)
    1.53  - (void) setFrame:(NSRect)frame;
    1.54 @@ -79,8 +79,10 @@
    1.55  }
    1.56  @end
    1.57  
    1.58 -/* This is a workaround to directly access NSOpenGLContext's CGL context */
    1.59 -/* We need to do this in order to check for errors */
    1.60 +/* 
    1.61 +    This is a workaround to directly access NSOpenGLContext's CGL context
    1.62 +    We need this to check for errors NSOpenGLContext doesn't support
    1.63 +*/
    1.64  @interface NSOpenGLContext (CGLContextAccess)
    1.65  - (CGLContextObj) cglContext;
    1.66  @end
    1.67 @@ -92,8 +94,10 @@
    1.68  }
    1.69  @end
    1.70  
    1.71 -/* Structure for rez switch gamma fades */
    1.72 -/* We can hide the monitor flicker by setting the gamma tables to 0 */
    1.73 +/* 
    1.74 +    Structure for rez switch gamma fades
    1.75 +    We can hide the monitor flicker by setting the gamma tables to 0
    1.76 +*/
    1.77  #define QZ_GAMMA_TABLE_SIZE 256
    1.78  
    1.79  typedef struct {
    1.80 @@ -112,14 +116,22 @@
    1.81      CFDictionaryRef    save_mode;          /* original mode of the display */
    1.82      CFArrayRef         mode_list;          /* list of available fullscreen modes */
    1.83      CGDirectPaletteRef palette;            /* palette of an 8-bit display */
    1.84 -    NSOpenGLContext    *gl_context;        /* object that represents an OpenGL rendering context */
    1.85 +    NSOpenGLContext    *gl_context;        /* OpenGL rendering context */
    1.86      Uint32             width, height, bpp; /* frequently used data about the display */
    1.87 -    Uint32             flags;              /* flags for mode, for teardown purposes */
    1.88 +    Uint32             flags;              /* flags for current mode, for teardown purposes */
    1.89      Uint32             video_set;          /* boolean; indicates if video was set correctly */
    1.90      Uint32             warp_flag;          /* boolean; notify to event loop that a warp just occured */
    1.91      Uint32             warp_ticks;         /* timestamp when the warp occured */
    1.92      NSWindow           *window;            /* Cocoa window to implement the SDL window */
    1.93 -    NSQuickDrawView    *view;              /* the window's view; draw 2D into this view */
    1.94 +    NSQuickDrawView    *view;              /* the window's view; draw 2D and OpenGL into this view */
    1.95 +    SDL_Surface        *resize_icon;       /* icon for the resize badge, we have to draw it by hand */
    1.96 +    SDL_GrabMode       current_grab_mode;  /* default value is SDL_GRAB_OFF */
    1.97 +    BOOL               in_foreground;      /* boolean; indicate if app is in foreground or not */
    1.98 +    SDL_Rect           **client_mode_list; /* resolution list to pass back to client */
    1.99 +    SDLKey             keymap[256];        /* Mac OS X to SDL key mapping */
   1.100 +    Uint32             current_mods;       /* current keyboard modifiers, to track modifier state */
   1.101 +    Uint32             last_virtual_button;/* last virtual mouse button pressed */
   1.102 +    
   1.103      ImageDescriptionHandle yuv_idh;
   1.104      MatrixRecordPtr        yuv_matrix;
   1.105      DecompressorComponent  yuv_codec;
   1.106 @@ -146,6 +158,14 @@
   1.107  #define video_set (this->hidden->video_set)
   1.108  #define warp_ticks (this->hidden->warp_ticks)
   1.109  #define warp_flag (this->hidden->warp_flag)
   1.110 +#define resize_icon (this->hidden->resize_icon)
   1.111 +#define current_grab_mode (this->hidden->current_grab_mode)
   1.112 +#define in_foreground (this->hidden->in_foreground)
   1.113 +#define client_mode_list (this->hidden->client_mode_list)
   1.114 +#define keymap (this->hidden->keymap)
   1.115 +#define current_mods (this->hidden->current_mods)
   1.116 +#define last_virtual_button (this->hidden->last_virtual_button)
   1.117 +
   1.118  #define yuv_idh (this->hidden->yuv_idh)
   1.119  #define yuv_matrix (this->hidden->yuv_matrix)
   1.120  #define yuv_codec (this->hidden->yuv_codec)
   1.121 @@ -156,7 +176,13 @@
   1.122  #define yuv_height (this->hidden->yuv_height)
   1.123  #define yuv_port (this->hidden->yuv_port)
   1.124  
   1.125 -/* Obscuring code: maximum number of windows above ours (inclusive) */
   1.126 +/* 
   1.127 +    Obscuring code: maximum number of windows above ours (inclusive) 
   1.128 +    
   1.129 +    Note: this doesn't work too well in practice and should be
   1.130 +    phased out when we add OpenGL 2D acceleration. It was never
   1.131 +    enabled in the first place, so this shouldn't be a problem ;-)
   1.132 +*/
   1.133  #define kMaxWindows 256
   1.134  
   1.135  /* Some of the Core Graphics Server API for obscuring code */
   1.136 @@ -171,10 +197,11 @@
   1.137  #define kCGSWindowLevelUtility        3
   1.138  #define kCGSWindowLevelNormal         0
   1.139  
   1.140 -/* For completeness; We never use these window levels, they are always below us
   1.141 -#define kCGSWindowLevelMBarShadow -20
   1.142 -#define kCGSWindowLevelDesktopPicture -2147483647
   1.143 -#define kCGSWindowLevelDesktop        -2147483648
   1.144 +/* 
   1.145 +    For completeness; We never use these window levels, they are always below us
   1.146 +    #define kCGSWindowLevelMBarShadow -20
   1.147 +    #define kCGSWindowLevelDesktopPicture -2147483647
   1.148 +    #define kCGSWindowLevelDesktop        -2147483648
   1.149  */
   1.150  
   1.151  typedef CGError       CGSError;
   1.152 @@ -227,7 +254,7 @@
   1.153  static int          QZ_SetColors        (_THIS, int first_color,
   1.154                                           int num_colors, SDL_Color *colors);
   1.155  static void         QZ_DirectUpdate     (_THIS, int num_rects, SDL_Rect *rects);
   1.156 -static int 	     QZ_LockWindow       (_THIS, SDL_Surface *surface);
   1.157 +static int          QZ_LockWindow       (_THIS, SDL_Surface *surface);
   1.158  static void         QZ_UnlockWindow     (_THIS, SDL_Surface *surface);
   1.159  static void         QZ_UpdateRects      (_THIS, int num_rects, SDL_Rect *rects);
   1.160  static void         QZ_VideoQuit        (_THIS);
   1.161 @@ -246,8 +273,8 @@
   1.162  static int QZ_GetGammaRamp (_THIS, Uint16 *ramp);
   1.163  
   1.164  /* OpenGL functions */
   1.165 -static int    QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags);
   1.166 -static void   QZ_TearDownOpenGL (_THIS);
   1.167 +static int    QZ_SetupOpenGL       (_THIS, int bpp, Uint32 flags);
   1.168 +static void   QZ_TearDownOpenGL    (_THIS);
   1.169  static void*  QZ_GL_GetProcAddress (_THIS, const char *proc);
   1.170  static int    QZ_GL_GetAttribute   (_THIS, SDL_GLattr attrib, int* value);
   1.171  static int    QZ_GL_MakeCurrent    (_THIS);
   1.172 @@ -271,13 +298,12 @@
   1.173  static void         QZ_PumpEvents       (_THIS);
   1.174  
   1.175  /* Window Manager functions */
   1.176 -static void QZ_SetCaption    (_THIS, const char *title, const char *icon);
   1.177 -static void QZ_SetIcon       (_THIS, SDL_Surface *icon, Uint8 *mask);
   1.178 -static int  QZ_IconifyWindow (_THIS);
   1.179 +static void QZ_SetCaption        (_THIS, const char *title, const char *icon);
   1.180 +static void QZ_SetIcon           (_THIS, SDL_Surface *icon, Uint8 *mask);
   1.181 +static int  QZ_IconifyWindow     (_THIS);
   1.182  static SDL_GrabMode QZ_GrabInput (_THIS, SDL_GrabMode grab_mode);
   1.183  /*static int  QZ_GetWMInfo     (_THIS, SDL_SysWMinfo *info);*/
   1.184  
   1.185  /* YUV functions */
   1.186  static SDL_Overlay* QZ_CreateYUVOverlay (_THIS, int width, int height,
   1.187 -                                         Uint32 format, SDL_Surface *display);
   1.188 -
   1.189 +                                         Uint32 format, SDL_Surface *display);
   1.190 \ No newline at end of file