src/video/quartz/SDL_QuartzVideo.h
changeset 272 d1447a846d80
parent 252 e8157fcb3114
child 297 f6ffac90895c
     1.1 --- a/src/video/quartz/SDL_QuartzVideo.h	Tue Jan 22 18:28:35 2002 +0000
     1.2 +++ b/src/video/quartz/SDL_QuartzVideo.h	Tue Jan 22 18:46:28 2002 +0000
     1.3 @@ -34,25 +34,28 @@
     1.4          - Multiple monitor support (currently only main display)
     1.5          - Accelerated blitting support
     1.6          - Set the window icon (dock icon when API is available)
     1.7 -        - Avoid erasing window on minimize, or disable minimize
     1.8 +        - Fix white OpenGL window on minimize
     1.9 +        - Find out what events should be sent/ignored if window is mimimized
    1.10 +        - Find a better way to deal with resolution/depth switch while app is running
    1.11 +        - Resizeable windows
    1.12 +        - Check accuracy of QZ_SetGamma()
    1.13      Problems:
    1.14          - OGL not working in full screen with software renderer
    1.15          - SetColors sets palette correctly but clears framebuffer
    1.16          - Crash in CG after several mode switches
    1.17 -        - Retained windows don't draw their title bar quite right (OS Bug)
    1.18 -        - Should I do depth switching for windowed modes? - No, not usually.
    1.19 -        - Launch times are slow, maybe prebinding will help
    1.20 -        - Direct framebuffer access has some artifacts, maybe a driver issue
    1.21 -        - Cursor in 8 bit modes is screwy
    1.22 +        - Retained windows don't draw their title bar quite right (OS Bug) (not using retained windows)
    1.23 +        - Cursor in 8 bit modes is screwy (might just be Radeon PCI bug)
    1.24 +        - Warping cursor delays mouse events for a fraction of a second,
    1.25 +          there is a hack around this that helps a bit
    1.26  */
    1.27  
    1.28 -#include <ApplicationServices/ApplicationServices.h>
    1.29 +#include <Cocoa/Cocoa.h>
    1.30  #include <OpenGL/OpenGL.h>
    1.31 -#include <Cocoa/Cocoa.h>
    1.32  #include <Carbon/Carbon.h>
    1.33  
    1.34  #include "SDL_video.h"
    1.35  #include "SDL_error.h"
    1.36 +#include "SDL_timer.h"
    1.37  #include "SDL_syswm.h"
    1.38  #include "SDL_sysvideo.h"
    1.39  #include "SDL_pixels_c.h"
    1.40 @@ -71,21 +74,34 @@
    1.41  }
    1.42  @end
    1.43  
    1.44 +/* Structure for rez switch gamma fades */
    1.45 +/* We can hide the monitor flicker by setting the gamma tables to 0 */
    1.46 +#define QZ_GAMMA_TABLE_SIZE 256
    1.47 +
    1.48 +typedef struct {
    1.49 +
    1.50 +    CGGammaValue red[QZ_GAMMA_TABLE_SIZE];
    1.51 +    CGGammaValue green[QZ_GAMMA_TABLE_SIZE];
    1.52 +    CGGammaValue blue[QZ_GAMMA_TABLE_SIZE];
    1.53 +
    1.54 +} SDL_QuartzGammaTable;
    1.55 +
    1.56 +/* Main driver structure to store required state information */
    1.57  typedef struct SDL_PrivateVideoData {
    1.58  
    1.59 -    CGDirectDisplayID  display; /* 0 == main display */
    1.60 -    CFDictionaryRef    mode;
    1.61 -    CFDictionaryRef    save_mode;
    1.62 -    CFArrayRef         mode_list;
    1.63 -    CGDirectPaletteRef palette;
    1.64 -    NSOpenGLContext    *gl_context;
    1.65 -    Uint32             width, height, bpp;
    1.66 -    Uint32             flags;
    1.67 -    SDL_bool           video_is_set; /* tell if the video mode was set */
    1.68 -    
    1.69 -    /* Window-only fields */
    1.70 -    NSWindow        *window;
    1.71 -    NSQuickDrawView *view;
    1.72 +    CGDirectDisplayID  display;            /* 0 == main display (only support single display) */
    1.73 +    CFDictionaryRef    mode;               /* current mode of the display */
    1.74 +    CFDictionaryRef    save_mode;          /* original mode of the display */
    1.75 +    CFArrayRef         mode_list;          /* list of available fullscreen modes */
    1.76 +    CGDirectPaletteRef palette;            /* palette of an 8-bit display */
    1.77 +    NSOpenGLContext    *gl_context;        /* object that represents an OpenGL rendering context */
    1.78 +    Uint32             width, height, bpp; /* frequently used data about the display */
    1.79 +    Uint32             flags;              /* flags for mode, for teardown purposes */
    1.80 +    Uint32             video_set;          /* boolean; indicates if video was set correctly */
    1.81 +    Uint32             warp_flag;          /* boolean; notify to event loop that a warp just occured */
    1.82 +    Uint32             warp_ticks;         /* timestamp when the warp occured */
    1.83 +    NSWindow           *window;            /* Cocoa window to implement the SDL window */
    1.84 +    NSQuickDrawView    *view;              /* the window's view; draw 2D into this view */
    1.85      
    1.86  } SDL_PrivateVideoData ;
    1.87  
    1.88 @@ -95,21 +111,68 @@
    1.89  #define save_mode (this->hidden->save_mode)
    1.90  #define mode_list (this->hidden->mode_list)
    1.91  #define palette (this->hidden->palette)
    1.92 -#define glcontext (this->hidden->glcontext)
    1.93 -#define objc_video (this->hidden->objc_video)
    1.94  #define gl_context (this->hidden->gl_context)
    1.95  #define device_width (this->hidden->width)
    1.96  #define device_height (this->hidden->height)
    1.97  #define device_bpp (this->hidden->bpp)
    1.98  #define mode_flags (this->hidden->flags)
    1.99 -#define video_set (this->hidden->video_is_set)
   1.100  #define qz_window (this->hidden->window)
   1.101 -#define windowView (this->hidden->view)
   1.102 +#define window_view (this->hidden->view)
   1.103 +#define video_set (this->hidden->video_set)
   1.104 +#define warp_ticks (this->hidden->warp_ticks)
   1.105 +#define warp_flag (this->hidden->warp_flag)
   1.106 +
   1.107 +/* Obscuring code: maximum number of windows above ours (inclusive) */
   1.108 +#define kMaxWindows 256
   1.109 +
   1.110 +/* Some of the Core Graphics Server API for obscuring code */
   1.111 +#define kCGSWindowLevelTop          2147483632
   1.112 +#define kCGSWindowLevelDockIconDrag 500
   1.113 +#define kCGSWindowLevelDockMenu     101
   1.114 +#define kCGSWindowLevelMenuIgnore    21
   1.115 +#define kCGSWindowLevelMenu          20
   1.116 +#define kCGSWindowLevelDockLabel     12
   1.117 +#define kCGSWindowLevelDockIcon      11
   1.118 +#define kCGSWindowLevelDock          10
   1.119 +#define kCGSWindowLevelUtility        3
   1.120 +#define kCGSWindowLevelNormal         0
   1.121 +
   1.122 +/* For completeness; We never use these window levels, they are always below us
   1.123 +#define kCGSWindowLevelMBarShadow -20
   1.124 +#define kCGSWindowLevelDesktopPicture -2147483647
   1.125 +#define kCGSWindowLevelDesktop        -2147483648
   1.126 +*/
   1.127  
   1.128 -/* Interface for hardware fill not (yet) in the public API */
   1.129 -int CGSDisplayHWFill (CGDirectDisplayID id, unsigned int x, unsigned int y, 
   1.130 +typedef CGError       CGSError;
   1.131 +typedef long	      CGSWindowCount;
   1.132 +typedef void *	      CGSConnectionID;
   1.133 +typedef int	      CGSWindowID;
   1.134 +typedef CGSWindowID*  CGSWindowIDList;
   1.135 +typedef CGWindowLevel CGSWindowLevel;
   1.136 +typedef NSRect        CGSRect;
   1.137 +
   1.138 +extern CGSConnectionID _CGSDefaultConnection ();
   1.139 +
   1.140 +extern CGSError CGSGetOnScreenWindowList (CGSConnectionID cid, 
   1.141 +                                          CGSConnectionID owner,
   1.142 +                                          CGSWindowCount listCapacity,
   1.143 +                                          CGSWindowIDList list,
   1.144 +                                          CGSWindowCount *listCount);
   1.145 +
   1.146 +extern CGSError CGSGetScreenRectForWindow (CGSConnectionID cid,
   1.147 +                                           CGSWindowID wid,
   1.148 +                                           CGSRect *rect);
   1.149 +
   1.150 +extern CGWindowLevel CGSGetWindowLevel (CGSConnectionID cid,
   1.151 +                                        CGSWindowID wid,
   1.152 +                                        CGSWindowLevel *level);
   1.153 +                                        
   1.154 +extern CGSError CGSDisplayHWFill (CGDirectDisplayID id, unsigned int x, unsigned int y, 
   1.155                        unsigned int w, unsigned int h, unsigned int color);
   1.156 -int CGSDisplayCanHWFill (CGDirectDisplayID id);
   1.157 +
   1.158 +extern CGSError CGSDisplayCanHWFill (CGDirectDisplayID id);
   1.159 +
   1.160 +extern CGSError CGSGetMouseEnabledFlags (CGSConnectionID cid, CGSWindowID wid, int *flags);
   1.161  
   1.162  /* Bootstrap functions */
   1.163  static int              QZ_Available ();
   1.164 @@ -156,7 +219,7 @@
   1.165  static int    QZ_GL_LoadLibrary    (_THIS, const char *location);
   1.166  
   1.167  /* Private function to warp the cursor (used internally) */
   1.168 -static void  QZ_PrivateWarpCursor (_THIS, int fullscreen, int h, int x, int y);
   1.169 +static void  QZ_PrivateWarpCursor (_THIS, int x, int y);
   1.170  
   1.171  /* Cursor and Mouse functions */
   1.172  static void         QZ_FreeWMCursor     (_THIS, WMcursor *cursor);
   1.173 @@ -177,3 +240,4 @@
   1.174  static int  QZ_IconifyWindow (_THIS);
   1.175  static SDL_GrabMode QZ_GrabInput (_THIS, SDL_GrabMode grab_mode);
   1.176  /*static int  QZ_GetWMInfo     (_THIS, SDL_SysWMinfo *info);*/
   1.177 +