src/video/cocoa/SDL_cocoamodes.m
author Ryan C. Gordon <icculus@icculus.org>
Sat, 12 Jan 2013 14:04:51 -0500
changeset 6809 54cca01b6006
parent 6788 036f53f2f5aa
child 6836 b0ca1571caf3
permissions -rw-r--r--
Fix a memory leak. We need to clean up our autorelease pool code at some point.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     2
  Simple DirectMedia Layer
6138
4c64952a58fb Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 6105
diff changeset
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     7
  arising from the use of this software.
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    11
  freely, subject to the following restrictions:
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
*/
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
#include "SDL_config.h"
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
6044
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5646
diff changeset
    23
#if SDL_VIDEO_DRIVER_COCOA
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5646
diff changeset
    24
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
#include "SDL_cocoavideo.h"
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    26
6787
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
    27
/* We need this for IODisplayCreateInfoDictionary and kIODisplayOnlyPreferredName */
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
    28
#include <IOKit/graphics/IOGraphicsLib.h>
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
    29
6104
e49364c8a253 Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 6101
diff changeset
    30
/* we need this for ShowMenuBar() and HideMenuBar(). */
e49364c8a253 Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 6101
diff changeset
    31
#include <Carbon/Carbon.h>
6101
4b88086910d3 Fix buildbot sdl-macosx-unix-x86 and sdl-macosx-amd64 compiler warnings
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6072
diff changeset
    32
6105
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    33
static inline void Cocoa_ToggleMenuBar(const BOOL show)
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    34
{
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    35
    /* !!! FIXME: keep an eye on this.
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    36
     * ShowMenuBar/HideMenuBar is officially unavailable for 64-bit binaries.
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    37
     *  It happens to work, as of 10.7, but we're going to see if
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    38
     *  we can just simply do without it on newer OSes...
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    39
     */
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    40
#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070) && !defined(__LP64__)
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    41
    if (show)
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    42
        ShowMenuBar();
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    43
    else
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    44
        HideMenuBar();
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    45
#endif
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    46
}
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    47
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
    48
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    49
/* !!! FIXME: clean out the pre-10.6 code when it makes sense to do so. */
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    50
#define FORCE_OLD_API 0 || (MAC_OS_X_VERSION_MAX_ALLOWED < 1060)
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    51
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    52
#if FORCE_OLD_API
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    53
#undef MAC_OS_X_VERSION_MIN_REQUIRED
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
    54
#define MAC_OS_X_VERSION_MIN_REQUIRED 1050
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    55
#endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    56
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
    57
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
1973
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    58
/* 
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    59
    Add methods to get at private members of NSScreen. 
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    60
    Since there is a bug in Apple's screen switching code
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    61
    that does not update this variable when switching
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    62
    to fullscreen, we'll set it manually (but only for the
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    63
    main screen).
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    64
*/
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    65
@interface NSScreen (NSScreenAccess)
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    66
- (void) setFrame:(NSRect)frame;
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    67
@end
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    68
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    69
@implementation NSScreen (NSScreenAccess)
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    70
- (void) setFrame:(NSRect)frame;
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    71
{
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    72
    _frame = frame;
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    73
}
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    74
@end
3246
c843261f74a4 From: Jjgod Jiang <gzjjgod@gmail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    75
#endif
1973
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
    76
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    77
static inline BOOL
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    78
IS_SNOW_LEOPARD_OR_LATER(_THIS)
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    79
{
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    80
#if FORCE_OLD_API
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    81
    return NO;
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    82
#else
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    83
    return ((((SDL_VideoData *) _this->driverdata))->osversion >= 0x1060);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    84
#endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    85
}
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
    86
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    87
static void
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    88
CG_SetError(const char *prefix, CGDisplayErr result)
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    89
{
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    90
    const char *error;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    91
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    92
    switch (result) {
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    93
    case kCGErrorFailure:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    94
        error = "kCGErrorFailure";
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    95
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    96
    case kCGErrorIllegalArgument:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    97
        error = "kCGErrorIllegalArgument";
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    98
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
    99
    case kCGErrorInvalidConnection:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   100
        error = "kCGErrorInvalidConnection";
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   101
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   102
    case kCGErrorInvalidContext:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   103
        error = "kCGErrorInvalidContext";
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   104
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   105
    case kCGErrorCannotComplete:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   106
        error = "kCGErrorCannotComplete";
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   107
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   108
    case kCGErrorNotImplemented:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   109
        error = "kCGErrorNotImplemented";
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   110
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   111
    case kCGErrorRangeCheck:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   112
        error = "kCGErrorRangeCheck";
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   113
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   114
    case kCGErrorTypeCheck:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   115
        error = "kCGErrorTypeCheck";
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   116
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   117
    case kCGErrorInvalidOperation:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   118
        error = "kCGErrorInvalidOperation";
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   119
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   120
    case kCGErrorNoneAvailable:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   121
        error = "kCGErrorNoneAvailable";
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   122
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   123
    default:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   124
        error = "Unknown Error";
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   125
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   126
    }
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   127
    SDL_SetError("%s: %s", prefix, error);
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   128
}
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   129
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   130
static SDL_bool
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   131
GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode)
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   132
{
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   133
    SDL_DisplayModeData *data;
6072
8b473f33c766 Fixed compiler warnings for uninitialized variables.
Ryan C. Gordon <icculus@icculus.org>
parents: 6044
diff changeset
   134
    long width = 0;
8b473f33c766 Fixed compiler warnings for uninitialized variables.
Ryan C. Gordon <icculus@icculus.org>
parents: 6044
diff changeset
   135
    long height = 0;
8b473f33c766 Fixed compiler warnings for uninitialized variables.
Ryan C. Gordon <icculus@icculus.org>
parents: 6044
diff changeset
   136
    long bpp = 0;
8b473f33c766 Fixed compiler warnings for uninitialized variables.
Ryan C. Gordon <icculus@icculus.org>
parents: 6044
diff changeset
   137
    long refreshRate = 0;
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   138
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   139
    data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   140
    if (!data) {
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   141
        return SDL_FALSE;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   142
    }
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   143
    data->moderef = moderef;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   144
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
   145
    #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   146
    if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   147
        CGDisplayModeRef vidmode = (CGDisplayModeRef) moderef;
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   148
        CFStringRef fmt = CGDisplayModeCopyPixelEncoding(vidmode);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   149
        width = (long) CGDisplayModeGetWidth(vidmode);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   150
        height = (long) CGDisplayModeGetHeight(vidmode);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   151
        refreshRate = (long) CGDisplayModeGetRefreshRate(vidmode);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   152
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   153
        if (CFStringCompare(fmt, CFSTR(IO32BitDirectPixels),
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   154
                            kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   155
            bpp = 32;
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   156
        } else if (CFStringCompare(fmt, CFSTR(IO16BitDirectPixels),
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   157
                            kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   158
            bpp = 16;
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   159
        } else {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   160
            bpp = 0;  /* ignore 8-bit and such for now. */
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   161
        }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   162
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   163
        CFRelease(fmt);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   164
    }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   165
    #endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   166
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
   167
    #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   168
    if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
6044
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5646
diff changeset
   169
        CFNumberRef number;
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   170
        CFDictionaryRef vidmode = (CFDictionaryRef) moderef;
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   171
        number = CFDictionaryGetValue(vidmode, kCGDisplayWidth);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   172
        CFNumberGetValue(number, kCFNumberLongType, &width);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   173
        number = CFDictionaryGetValue(vidmode, kCGDisplayHeight);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   174
        CFNumberGetValue(number, kCFNumberLongType, &height);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   175
        number = CFDictionaryGetValue(vidmode, kCGDisplayBitsPerPixel);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   176
        CFNumberGetValue(number, kCFNumberLongType, &bpp);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   177
        number = CFDictionaryGetValue(vidmode, kCGDisplayRefreshRate);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   178
        CFNumberGetValue(number, kCFNumberLongType, &refreshRate);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   179
    }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   180
    #endif
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   181
1969
5d3724f64f2b Clarified the difference between render drivers and render contexts
Sam Lantinga <slouken@libsdl.org>
parents: 1934
diff changeset
   182
    mode->format = SDL_PIXELFORMAT_UNKNOWN;
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   183
    switch (bpp) {
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   184
    case 16:
2237
e57a883ffa86 Advertise the most efficient format for the screen. Of course SDL code needs
Sam Lantinga <slouken@libsdl.org>
parents: 1973
diff changeset
   185
        mode->format = SDL_PIXELFORMAT_ARGB1555;
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   186
        break;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   187
    case 32:
2237
e57a883ffa86 Advertise the most efficient format for the screen. Of course SDL code needs
Sam Lantinga <slouken@libsdl.org>
parents: 1973
diff changeset
   188
        mode->format = SDL_PIXELFORMAT_ARGB8888;
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   189
        break;
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   190
    case 8: /* We don't support palettized modes now */
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   191
    default: /* Totally unrecognizable bit depth. */
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   192
        return SDL_FALSE;
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   193
    }
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   194
    mode->w = width;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   195
    mode->h = height;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   196
    mode->refresh_rate = refreshRate;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   197
    mode->driverdata = data;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   198
    return SDL_TRUE;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   199
}
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   200
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   201
static inline void
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   202
Cocoa_ReleaseDisplayMode(_THIS, const void *moderef)
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   203
{
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   204
    /* We don't own moderef unless we use the 10.6+ APIs. */
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
   205
    #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   206
    if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   207
        CGDisplayModeRelease((CGDisplayModeRef) moderef);  /* NULL is ok */
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   208
    }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   209
    #endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   210
}
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   211
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   212
static inline void
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   213
Cocoa_ReleaseDisplayModeList(_THIS, CFArrayRef modelist)
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   214
{
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   215
    /* We don't own modelis unless we use the 10.6+ APIs. */
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
   216
    #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   217
    if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   218
        CFRelease(modelist);  /* NULL is ok */
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   219
    }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   220
    #endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   221
}
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   222
6788
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6787
diff changeset
   223
static const char *
6787
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
   224
Cocoa_GetDisplayName(CGDirectDisplayID displayID)
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
   225
{
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
   226
    NSDictionary *deviceInfo = (NSDictionary *)IODisplayCreateInfoDictionary(CGDisplayIOServicePort(displayID), kIODisplayOnlyPreferredName);
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
   227
    NSDictionary *localizedNames = [deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]];
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
   228
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
   229
    if ([localizedNames count] > 0) {
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
   230
        return [[localizedNames objectForKey:[[localizedNames allKeys] objectAtIndex:0]] UTF8String];
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
   231
    }
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
   232
    return NULL;
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
   233
}
95a4c5a5464c Added SDL_GetDisplayName(), with implementation for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 6388
diff changeset
   234
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   235
void
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   236
Cocoa_InitModes(_THIS)
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   237
{
6809
54cca01b6006 Fix a memory leak. We need to clean up our autorelease pool code at some point.
Ryan C. Gordon <icculus@icculus.org>
parents: 6788
diff changeset
   238
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   239
    CGDisplayErr result;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   240
    CGDirectDisplayID *displays;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   241
    CGDisplayCount numDisplays;
3505
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   242
    int pass, i;
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   243
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   244
    result = CGGetOnlineDisplayList(0, NULL, &numDisplays);
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   245
    if (result != kCGErrorSuccess) {
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   246
        CG_SetError("CGGetOnlineDisplayList()", result);
6809
54cca01b6006 Fix a memory leak. We need to clean up our autorelease pool code at some point.
Ryan C. Gordon <icculus@icculus.org>
parents: 6788
diff changeset
   247
        [pool release];
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   248
        return;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   249
    }
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   250
    displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays);
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   251
    result = CGGetOnlineDisplayList(numDisplays, displays, &numDisplays);
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   252
    if (result != kCGErrorSuccess) {
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   253
        CG_SetError("CGGetOnlineDisplayList()", result);
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   254
        SDL_stack_free(displays);
6809
54cca01b6006 Fix a memory leak. We need to clean up our autorelease pool code at some point.
Ryan C. Gordon <icculus@icculus.org>
parents: 6788
diff changeset
   255
        [pool release];
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   256
        return;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   257
    }
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   258
3505
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   259
    /* Pick up the primary display in the first pass, then get the rest */
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   260
    for (pass = 0; pass < 2; ++pass) {
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   261
        for (i = 0; i < numDisplays; ++i) {
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   262
            SDL_VideoDisplay display;
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   263
            SDL_DisplayData *displaydata;
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   264
            SDL_DisplayMode mode;
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   265
            const void *moderef = NULL;
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   266
3505
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   267
            if (pass == 0) {
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   268
                if (!CGDisplayIsMain(displays[i])) {
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   269
                    continue;
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   270
                }
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   271
            } else {
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   272
                if (CGDisplayIsMain(displays[i])) {
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   273
                    continue;
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   274
                }
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   275
            }
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   276
3505
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   277
            if (CGDisplayMirrorsDisplay(displays[i]) != kCGNullDirectDisplay) {
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   278
                continue;
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   279
            }
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   280
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
   281
            #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   282
            if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   283
                moderef = CGDisplayCopyDisplayMode(displays[i]);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   284
            }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   285
            #endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   286
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
   287
            #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   288
            if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   289
                moderef = CGDisplayCurrentMode(displays[i]);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   290
            }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   291
            #endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   292
3505
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   293
            if (!moderef) {
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   294
                continue;
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   295
            }
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   296
3505
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   297
            displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata));
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   298
            if (!displaydata) {
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   299
                Cocoa_ReleaseDisplayMode(_this, moderef);
3505
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   300
                continue;
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   301
            }
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   302
            displaydata->display = displays[i];
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   303
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   304
            SDL_zero(display);
6788
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6787
diff changeset
   305
            display.name = (char *)Cocoa_GetDisplayName(displays[i]);
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   306
            if (!GetDisplayMode (_this, moderef, &mode)) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   307
                Cocoa_ReleaseDisplayMode(_this, moderef);
3505
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   308
                SDL_free(displaydata);
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   309
                continue;
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   310
            }
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   311
3505
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   312
            display.desktop_mode = mode;
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   313
            display.current_mode = mode;
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   314
            display.driverdata = displaydata;
a1bf34bc2a58 Ensure that the main display is picked up first
Sam Lantinga <slouken@libsdl.org>
parents: 3504
diff changeset
   315
            SDL_AddVideoDisplay(&display);
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   316
        }
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   317
    }
1973
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
   318
    SDL_stack_free(displays);
6809
54cca01b6006 Fix a memory leak. We need to clean up our autorelease pool code at some point.
Ryan C. Gordon <icculus@icculus.org>
parents: 6788
diff changeset
   319
    [pool release];
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   320
}
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   321
3528
59ff7a2beb57 Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents: 3525
diff changeset
   322
int
59ff7a2beb57 Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents: 3525
diff changeset
   323
Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
3525
455a6c47d2c6 Fixed compilation on Mac OS X 10.4
Sam Lantinga <slouken@libsdl.org>
parents: 3513
diff changeset
   324
{
3528
59ff7a2beb57 Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents: 3525
diff changeset
   325
    SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
3525
455a6c47d2c6 Fixed compilation on Mac OS X 10.4
Sam Lantinga <slouken@libsdl.org>
parents: 3513
diff changeset
   326
    CGRect cgrect;
455a6c47d2c6 Fixed compilation on Mac OS X 10.4
Sam Lantinga <slouken@libsdl.org>
parents: 3513
diff changeset
   327
3528
59ff7a2beb57 Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents: 3525
diff changeset
   328
    cgrect = CGDisplayBounds(displaydata->display);
59ff7a2beb57 Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents: 3525
diff changeset
   329
    rect->x = (int)cgrect.origin.x;
59ff7a2beb57 Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents: 3525
diff changeset
   330
    rect->y = (int)cgrect.origin.y;
59ff7a2beb57 Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents: 3525
diff changeset
   331
    rect->w = (int)cgrect.size.width;
59ff7a2beb57 Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents: 3525
diff changeset
   332
    rect->h = (int)cgrect.size.height;
59ff7a2beb57 Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents: 3525
diff changeset
   333
    return 0;
3525
455a6c47d2c6 Fixed compilation on Mac OS X 10.4
Sam Lantinga <slouken@libsdl.org>
parents: 3513
diff changeset
   334
}
455a6c47d2c6 Fixed compilation on Mac OS X 10.4
Sam Lantinga <slouken@libsdl.org>
parents: 3513
diff changeset
   335
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   336
void
3500
4b594623401b Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents: 3280
diff changeset
   337
Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   338
{
3500
4b594623401b Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents: 3280
diff changeset
   339
    SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   340
    CFArrayRef modes = NULL;
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   341
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
   342
    #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   343
    if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   344
        modes = CGDisplayCopyAllDisplayModes(data->display, NULL);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   345
    }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   346
    #endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   347
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
   348
    #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   349
    if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   350
        modes = CGDisplayAvailableModes(data->display);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   351
    }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   352
    #endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   353
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   354
    if (modes) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   355
        const CFIndex count = CFArrayGetCount(modes);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   356
        CFIndex i;
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   357
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   358
        for (i = 0; i < count; i++) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   359
            const void *moderef = CFArrayGetValueAtIndex(modes, i);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   360
            SDL_DisplayMode mode;
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   361
            if (GetDisplayMode(_this, moderef, &mode)) {
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
   362
                #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   363
                if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   364
                    CGDisplayModeRetain((CGDisplayModeRef) moderef);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   365
                }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   366
                #endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   367
                SDL_AddDisplayMode(display, &mode);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   368
            }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   369
        }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   370
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   371
        Cocoa_ReleaseDisplayModeList(_this, modes);
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   372
    }
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   373
}
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   374
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   375
static CGError
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   376
Cocoa_SwitchMode(_THIS, CGDirectDisplayID display, const void *mode)
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   377
{
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
   378
    #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   379
    if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   380
        return CGDisplaySetDisplayMode(display, (CGDisplayModeRef) mode, NULL);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   381
    }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   382
    #endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   383
5646
fe1df351ca3d Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 5643
diff changeset
   384
    #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   385
    if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   386
        return CGDisplaySwitchToMode(display, (CFDictionaryRef) mode);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   387
    }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   388
    #endif
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   389
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   390
    return kCGErrorFailure;
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   391
}
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   392
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   393
int
3500
4b594623401b Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents: 3280
diff changeset
   394
Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   395
{
3500
4b594623401b Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents: 3280
diff changeset
   396
    SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   397
    SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   398
    CGDisplayFadeReservationToken fade_token = kCGDisplayFadeReservationInvalidToken;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   399
    CGError result;
4939
de89a6f73c06 Fixed restoring the desktop resolution when toggling fullscreen mode
Sam Lantinga <slouken@libsdl.org>
parents: 4925
diff changeset
   400
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   401
    /* Fade to black to hide resolution-switching flicker */
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   402
    if (CGAcquireDisplayFadeReservation(5, &fade_token) == kCGErrorSuccess) {
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   403
        CGDisplayFade(fade_token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, TRUE);
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   404
    }
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   405
3513
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   406
    if (data == display->desktop_mode.driverdata) {
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   407
        /* Restoring desktop mode */
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   408
        Cocoa_SwitchMode(_this, displaydata->display, data->moderef);
4939
de89a6f73c06 Fixed restoring the desktop resolution when toggling fullscreen mode
Sam Lantinga <slouken@libsdl.org>
parents: 4925
diff changeset
   409
5248
ff2564c24045 Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
Sam Lantinga <slouken@libsdl.org>
parents: 5149
diff changeset
   410
        if (CGDisplayIsMain(displaydata->display)) {
ff2564c24045 Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
Sam Lantinga <slouken@libsdl.org>
parents: 5149
diff changeset
   411
            CGReleaseAllDisplays();
ff2564c24045 Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
Sam Lantinga <slouken@libsdl.org>
parents: 5149
diff changeset
   412
        } else {
ff2564c24045 Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
Sam Lantinga <slouken@libsdl.org>
parents: 5149
diff changeset
   413
            CGDisplayRelease(displaydata->display);
ff2564c24045 Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
Sam Lantinga <slouken@libsdl.org>
parents: 5149
diff changeset
   414
        }
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   415
3513
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   416
        if (CGDisplayIsMain(displaydata->display)) {
6105
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
   417
            Cocoa_ToggleMenuBar(YES);
3513
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   418
        }
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   419
    } else {
4939
de89a6f73c06 Fixed restoring the desktop resolution when toggling fullscreen mode
Sam Lantinga <slouken@libsdl.org>
parents: 4925
diff changeset
   420
        /* Put up the blanking window (a window above all other windows) */
5248
ff2564c24045 Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
Sam Lantinga <slouken@libsdl.org>
parents: 5149
diff changeset
   421
        if (CGDisplayIsMain(displaydata->display)) {
ff2564c24045 Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
Sam Lantinga <slouken@libsdl.org>
parents: 5149
diff changeset
   422
            /* If we don't capture all displays, Cocoa tries to rearrange windows... *sigh* */
ff2564c24045 Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
Sam Lantinga <slouken@libsdl.org>
parents: 5149
diff changeset
   423
            result = CGCaptureAllDisplays();
ff2564c24045 Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
Sam Lantinga <slouken@libsdl.org>
parents: 5149
diff changeset
   424
        } else {
ff2564c24045 Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
Sam Lantinga <slouken@libsdl.org>
parents: 5149
diff changeset
   425
            result = CGDisplayCapture(displaydata->display);
ff2564c24045 Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
Sam Lantinga <slouken@libsdl.org>
parents: 5149
diff changeset
   426
        }
4939
de89a6f73c06 Fixed restoring the desktop resolution when toggling fullscreen mode
Sam Lantinga <slouken@libsdl.org>
parents: 4925
diff changeset
   427
        if (result != kCGErrorSuccess) {
de89a6f73c06 Fixed restoring the desktop resolution when toggling fullscreen mode
Sam Lantinga <slouken@libsdl.org>
parents: 4925
diff changeset
   428
            CG_SetError("CGDisplayCapture()", result);
de89a6f73c06 Fixed restoring the desktop resolution when toggling fullscreen mode
Sam Lantinga <slouken@libsdl.org>
parents: 4925
diff changeset
   429
            goto ERR_NO_CAPTURE;
de89a6f73c06 Fixed restoring the desktop resolution when toggling fullscreen mode
Sam Lantinga <slouken@libsdl.org>
parents: 4925
diff changeset
   430
        }
de89a6f73c06 Fixed restoring the desktop resolution when toggling fullscreen mode
Sam Lantinga <slouken@libsdl.org>
parents: 4925
diff changeset
   431
3513
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   432
        /* Do the physical switch */
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   433
        result = Cocoa_SwitchMode(_this, displaydata->display, data->moderef);
3513
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   434
        if (result != kCGErrorSuccess) {
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   435
            CG_SetError("CGDisplaySwitchToMode()", result);
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   436
            goto ERR_NO_SWITCH;
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   437
        }
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   438
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   439
        /* Hide the menu bar so it doesn't intercept events */
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   440
        if (CGDisplayIsMain(displaydata->display)) {
6105
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
   441
            Cocoa_ToggleMenuBar(NO);
3513
b66c9e8090d4 Restore the desktop mode when requested
Sam Lantinga <slouken@libsdl.org>
parents: 3510
diff changeset
   442
        }
3510
58cbfa81317a Don't need to hide the menu bar if we're not on the main display
Sam Lantinga <slouken@libsdl.org>
parents: 3505
diff changeset
   443
    }
1973
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
   444
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   445
    /* Fade in again (asynchronously) */
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   446
    if (fade_token != kCGDisplayFadeReservationInvalidToken) {
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   447
        CGDisplayFade(fade_token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE);
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   448
        CGReleaseDisplayFadeReservation(fade_token);
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   449
    }
1973
81255f93dfcd Fixed fullscreen modes with Cocoa video driver.
Sam Lantinga <slouken@libsdl.org>
parents: 1969
diff changeset
   450
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   451
    return 0;
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   452
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   453
    /* Since the blanking window covers *all* windows (even force quit) correct recovery is crucial */
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   454
ERR_NO_SWITCH:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   455
    CGDisplayRelease(displaydata->display);
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   456
ERR_NO_CAPTURE:
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   457
    if (fade_token != kCGDisplayFadeReservationInvalidToken) {
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   458
        CGDisplayFade (fade_token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE);
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   459
        CGReleaseDisplayFadeReservation(fade_token);
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   460
    }
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   461
    return -1;
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   462
}
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   463
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   464
void
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   465
Cocoa_QuitModes(_THIS)
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   466
{
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   467
    int i, j;
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   468
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   469
    for (i = 0; i < _this->num_displays; ++i) {
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   470
        SDL_VideoDisplay *display = &_this->displays[i];
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   471
        SDL_DisplayModeData *mode;
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   472
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   473
        if (display->current_mode.driverdata != display->desktop_mode.driverdata) {
3500
4b594623401b Work in progress on multi-display support:
Sam Lantinga <slouken@libsdl.org>
parents: 3280
diff changeset
   474
            Cocoa_SetDisplayMode(_this, display, &display->desktop_mode);
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   475
        }
5643
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   476
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   477
        mode = (SDL_DisplayModeData *) display->desktop_mode.driverdata;
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   478
        Cocoa_ReleaseDisplayMode(_this, mode->moderef);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   479
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   480
        for (j = 0; j < display->num_display_modes; j++) {
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   481
            mode = (SDL_DisplayModeData*) display->display_modes[j].driverdata;
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   482
            Cocoa_ReleaseDisplayMode(_this, mode->moderef);
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   483
        }
4c286789c40f Cleaned out functions deprecated in Mac OS X 10.6 SDK.
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   484
1934
70139af5ac27 Implemented Mac OS X video mode selection.
Sam Lantinga <slouken@libsdl.org>
parents: 1931
diff changeset
   485
    }
6105
3b06b03d74f4 More work to clean up compiler warnings.
Ryan C. Gordon <icculus@icculus.org>
parents: 6104
diff changeset
   486
    Cocoa_ToggleMenuBar(YES);
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   487
}
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   488
6044
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5646
diff changeset
   489
#endif /* SDL_VIDEO_DRIVER_COCOA */
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5646
diff changeset
   490
1931
103c6fec2a60 The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   491
/* vi: set ts=4 sw=4 expandtab: */