src/video/quartz/SDL_QuartzVideo.m
branchSDL-1.2
changeset 6158 6f3a2bb301d6
parent 6157 8a1bc41db6bb
child 6173 5619adf4736d
equal deleted inserted replaced
6157:8a1bc41db6bb 6158:6f3a2bb301d6
    34 CG_EXTERN size_t CGDisplayBytesPerRow(CGDirectDisplayID display)
    34 CG_EXTERN size_t CGDisplayBytesPerRow(CGDirectDisplayID display)
    35   CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6,
    35   CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6,
    36     __IPHONE_NA, __IPHONE_NA);
    36     __IPHONE_NA, __IPHONE_NA);
    37 #endif
    37 #endif
    38 
    38 
    39 #if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060)  /* Fixed in Snow Leopard */
    39 
       
    40 static inline BOOL IS_LION_OR_LATER(_THIS)
       
    41 {
       
    42     return (system_version >= 0x1070);
       
    43 }
       
    44 
       
    45 static inline BOOL IS_SNOW_LEOPARD_OR_LATER(_THIS)
       
    46 {
       
    47     return (system_version >= 0x1060);
       
    48 }
       
    49 
       
    50 #if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) && !defined(__LP64__)  /* Fixed in Snow Leopard */
    40 /*
    51 /*
    41     Add methods to get at private members of NSScreen. 
    52     Add methods to get at private members of NSScreen. 
    42     Since there is a bug in Apple's screen switching code
    53     Since there is a bug in Apple's screen switching code
    43     that does not update this variable when switching
    54     that does not update this variable when switching
    44     to fullscreen, we'll set it manually (but only for the
    55     to fullscreen, we'll set it manually (but only for the
    52 - (void) setFrame:(NSRect)frame;
    63 - (void) setFrame:(NSRect)frame;
    53 {
    64 {
    54     _frame = frame;
    65     _frame = frame;
    55 }
    66 }
    56 @end
    67 @end
    57 static inline void QZ_SetFrame(NSScreen *nsscreen, NSRect frame)
    68 static inline void QZ_SetFrame(_THIS, NSScreen *nsscreen, NSRect frame)
    58 {
    69 {
    59     [nsscreen setFrame:frame];
    70     if (!IS_SNOW_LEOPARD_OR_LATER(this)) {
       
    71         [nsscreen setFrame:frame];
       
    72     }
    60 }
    73 }
    61 #else
    74 #else
    62 static inline void QZ_SetFrame(NSScreen *nsscreen, NSRect frame)
    75 static inline void QZ_SetFrame(_THIS, NSScreen *nsscreen, NSRect frame)
    63 {
    76 {
    64 }
    77 }
    65 #endif
    78 #endif
    66 
    79 
    67 @interface SDLTranslatorResponder : NSTextView
    80 @interface SDLTranslatorResponder : NSTextView
   122 #if (defined(__GNUC__) && (__GNUC__ >= 4))
   135 #if (defined(__GNUC__) && (__GNUC__ >= 4))
   123 #  if (MAC_OS_X_VERSION_MAX_ALLOWED <= 1070)
   136 #  if (MAC_OS_X_VERSION_MAX_ALLOWED <= 1070)
   124 #    pragma GCC diagnostic ignored "-Wdeprecated-declarations"
   137 #    pragma GCC diagnostic ignored "-Wdeprecated-declarations"
   125 #  endif
   138 #  endif
   126 #endif
   139 #endif
   127 
       
   128 static inline BOOL IS_LION_OR_LATER(_THIS)
       
   129 {
       
   130     return (system_version >= 0x1070);
       
   131 }
       
   132 
       
   133 static inline BOOL IS_SNOW_LEOPARD_OR_LATER(_THIS)
       
   134 {
       
   135     return (system_version >= 0x1060);
       
   136 }
       
   137 
   140 
   138 static void QZ_ReleaseDisplayMode(_THIS, const void *moderef)
   141 static void QZ_ReleaseDisplayMode(_THIS, const void *moderef)
   139 {
   142 {
   140     /* we only own these references in the 10.6+ API. */
   143     /* we only own these references in the 10.6+ API. */
   141 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
   144 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
   605             /* 
   608             /* 
   606                 Reset the main screen's rectangle
   609                 Reset the main screen's rectangle
   607                 See comment in QZ_SetVideoFullscreen for why we do this
   610                 See comment in QZ_SetVideoFullscreen for why we do this
   608             */
   611             */
   609             screen_rect = NSMakeRect(0,0,device_width,device_height);
   612             screen_rect = NSMakeRect(0,0,device_width,device_height);
   610             QZ_SetFrame([ NSScreen mainScreen ], screen_rect);
   613             QZ_SetFrame(this, [ NSScreen mainScreen ], screen_rect);
   611         }
   614         }
   612     }
   615     }
   613     /* Release window mode resources */
   616     /* Release window mode resources */
   614     else {
   617     else {
   615         id delegate = [ qz_window delegate ];
   618         id delegate = [ qz_window delegate ];
   925         As a result, coordinate translation produces incorrect results.
   928         As a result, coordinate translation produces incorrect results.
   926         We can hack around this bug by setting the screen rect
   929         We can hack around this bug by setting the screen rect
   927         ourselves. This hack should be removed if/when the bug is fixed.
   930         ourselves. This hack should be removed if/when the bug is fixed.
   928     */
   931     */
   929     screen_rect = NSMakeRect(0,0,width,height);
   932     screen_rect = NSMakeRect(0,0,width,height);
   930     QZ_SetFrame([ NSScreen mainScreen ], screen_rect);
   933     QZ_SetFrame(this, [ NSScreen mainScreen ], screen_rect);
   931 
   934 
   932     /* Save the flags to ensure correct tear-down */
   935     /* Save the flags to ensure correct tear-down */
   933     mode_flags = current->flags;
   936     mode_flags = current->flags;
   934 
   937 
   935     /* Set app state, hide cursor if necessary, ... */
   938     /* Set app state, hide cursor if necessary, ... */