src/video/cocoa/wnd_quickdraw.mm
author egladil
Mon, 17 Dec 2007 07:47:21 +0000
changeset 8588 9a8122b510f9
parent 8535 cda5ffec8999
child 8623 652df321c912
permissions -rw-r--r--
(svn r11653) -Feature: [OSX] Allow windowed mode subdrivers to be disabled at compile time.
2743
b3a6f4ddfdb8 (svn r3288) Set svn properties on cocoa related files, and add Id tag.
peter1138
parents: 2741
diff changeset
     1
/* $Id$ */
b3a6f4ddfdb8 (svn r3288) Set svn properties on cocoa related files, and add Id tag.
peter1138
parents: 2741
diff changeset
     2
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
     3
/******************************************************************************
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
     4
 *                             Cocoa video driver                             *
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
     5
 * Known things left to do:                                                   *
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
     6
 *  List available resolutions.                                               *
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
     7
 ******************************************************************************/
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     8
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     9
#ifdef WITH_COCOA
8588
9a8122b510f9 (svn r11653) -Feature: [OSX] Allow windowed mode subdrivers to be disabled at compile time.
egladil
parents: 8535
diff changeset
    10
#ifdef ENABLE_COCOA_QUICKDRAW
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    11
8461
385ca6f76feb (svn r11521) -Codechange: [OSX] Check what the running os version is in a cleaner way.
egladil
parents: 8448
diff changeset
    12
#define MAC_OS_X_VERSION_MIN_REQUIRED    MAC_OS_X_VERSION_10_3
385ca6f76feb (svn r11521) -Codechange: [OSX] Check what the running os version is in a cleaner way.
egladil
parents: 8448
diff changeset
    13
#define MAC_OS_X_VERSION_MAX_ALLOWED     MAC_OS_X_VERSION_10_3
6514
634933c84aef (svn r8967) -Fix (OSX): silent the warnings in cocoa_v.mm about deprecated stuff.. we know that\!
truelight
parents: 6485
diff changeset
    14
#include <AvailabilityMacros.h>
634933c84aef (svn r8967) -Fix (OSX): silent the warnings in cocoa_v.mm about deprecated stuff.. we know that\!
truelight
parents: 6485
diff changeset
    15
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    16
#import <Cocoa/Cocoa.h>
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    17
#import <sys/time.h> /* gettimeofday */
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    18
#import <sys/param.h> /* for MAXPATHLEN */
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    19
#import <unistd.h>
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    20
6192
c6adfc929c6b (svn r8605) -Codechange: [OSX] changed all objective C to objective C++
bjarni
parents: 5993
diff changeset
    21
/**
c6adfc929c6b (svn r8605) -Codechange: [OSX] changed all objective C to objective C++
bjarni
parents: 5993
diff changeset
    22
 * Important notice regarding all modifications!!!!!!!
c6adfc929c6b (svn r8605) -Codechange: [OSX] changed all objective C to objective C++
bjarni
parents: 5993
diff changeset
    23
 * There are certain limitations because the file is objective C++.
c6adfc929c6b (svn r8605) -Codechange: [OSX] changed all objective C to objective C++
bjarni
parents: 5993
diff changeset
    24
 * gdb has limitations.
c6adfc929c6b (svn r8605) -Codechange: [OSX] changed all objective C to objective C++
bjarni
parents: 5993
diff changeset
    25
 * C++ and objective C code can't be joined in all cases (classes stuff).
c6adfc929c6b (svn r8605) -Codechange: [OSX] changed all objective C to objective C++
bjarni
parents: 5993
diff changeset
    26
 * Read http://developer.apple.com/releasenotes/Cocoa/Objective-C++.html for more information.
c6adfc929c6b (svn r8605) -Codechange: [OSX] changed all objective C to objective C++
bjarni
parents: 5993
diff changeset
    27
 */
c6adfc929c6b (svn r8605) -Codechange: [OSX] changed all objective C to objective C++
bjarni
parents: 5993
diff changeset
    28
c6adfc929c6b (svn r8605) -Codechange: [OSX] changed all objective C to objective C++
bjarni
parents: 5993
diff changeset
    29
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    30
/* Defined in stdbool.h */
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    31
#ifndef __cplusplus
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    32
# ifndef __BEOS__
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    33
#  undef bool
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    34
#  undef false
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    35
#  undef true
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    36
# endif
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    37
#endif
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    38
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5832
diff changeset
    39
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    40
#include "../../stdafx.h"
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    41
#include "../../debug.h"
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    42
#include "../../variables.h"
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    43
#include "cocoa_v.h"
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    44
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    45
#undef Point
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    46
#undef Rect
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    47
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    48
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    49
class WindowQuickdrawSubdriver;
7981
506461241c0e (svn r10996) -Feature: [OSX] added more options for right click emulation (controlled from the interface tab in the patch window)
bjarni
parents: 7952
diff changeset
    50
506461241c0e (svn r10996) -Feature: [OSX] added more options for right click emulation (controlled from the interface tab in the patch window)
bjarni
parents: 7952
diff changeset
    51
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    52
/* Subclass of NSWindow to fix genie effect and support resize events  */
8439
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
    53
@interface OTTD_QuickdrawWindow : NSWindow {
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    54
	WindowQuickdrawSubdriver *driver;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    55
}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    56
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    57
- (void)setDriver:(WindowQuickdrawSubdriver*)drv;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    58
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    59
- (void)miniaturize:(id)sender;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    60
- (void)display;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    61
- (void)setFrame:(NSRect)frameRect display:(BOOL)flag;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    62
- (void)appDidHide:(NSNotification*)note;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    63
- (void)appWillUnhide:(NSNotification*)note;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    64
- (void)appDidUnhide:(NSNotification*)note;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    65
- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    66
@end
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    67
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    68
/* Delegate for our NSWindow to send ask for quit on close */
8439
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
    69
@interface OTTD_QuickdrawWindowDelegate : NSObject{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    70
	WindowQuickdrawSubdriver *driver;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    71
}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    72
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    73
- (void)setDriver:(WindowQuickdrawSubdriver*)drv;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    74
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    75
- (BOOL)windowShouldClose:(id)sender;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    76
@end
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    77
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    78
class WindowQuickdrawSubdriver: public CocoaSubdriver {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    79
	int device_width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    80
	int device_height;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    81
	int device_depth;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    82
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    83
	int window_width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    84
	int window_height;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    85
	int window_pitch;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    86
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    87
	int buffer_depth;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    88
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    89
	void *pixel_buffer;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    90
	void *window_buffer;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    91
8439
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
    92
	OTTD_QuickdrawWindow *window;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    93
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
    94
	#define MAX_DIRTY_RECTS 100
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5832
diff changeset
    95
	Rect dirty_rects[MAX_DIRTY_RECTS];
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    96
	int num_dirty_rects;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    97
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    98
	uint16 palette16[256];
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    99
	uint32 palette32[256];
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   100
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   101
public:
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   102
	bool active;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   103
	bool setup;
7456
0c0636370335 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 7435
diff changeset
   104
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   105
	NSQuickDrawView *qdview;
7456
0c0636370335 (svn r10216) -Fix: palette animation always redid all palette entries, where in fact only a few indexes were needed
truelight
parents: 7435
diff changeset
   106
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   107
private:
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   108
	void GetDeviceInfo();
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   109
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   110
	bool SetVideoMode(int width, int height);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   111
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   112
	/**
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   113
	 * This function copies 32bpp pixels from the screen buffer in 16bpp windowed mode.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   114
	 *
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   115
	 * @param left The x coord for the left edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   116
	 * @param top The y coord for the top edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   117
	 * @param right The x coord for the right edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   118
	 * @param bottom The y coord for the bottom edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   119
	 */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   120
	void Blit32ToView32(int left, int top, int right, int bottom);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   121
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   122
	/**
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   123
	 * This function copies 8bpp pixels from the screen buffer in 32bpp windowed mode.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   124
	 *
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   125
	 * @param left The x coord for the left edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   126
	 * @param top The y coord for the top edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   127
	 * @param right The x coord for the right edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   128
	 * @param bottom The y coord for the bottom edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   129
	 */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   130
	void BlitIndexedToView32(int left, int top, int right, int bottom);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   131
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   132
	/**
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   133
	 * This function copies 8bpp pixels from the screen buffer in 16bpp windowed mode.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   134
	 *
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   135
	 * @param left The x coord for the left edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   136
	 * @param top The y coord for the top edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   137
	 * @param right The x coord for the right edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   138
	 * @param bottom The y coord for the bottom edge of the box to blit.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   139
	 */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   140
	void BlitIndexedToView16(int left, int top, int right, int bottom);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   141
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   142
	inline void BlitToView(int left, int top, int right, int bottom);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   143
	void DrawResizeIcon();
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   144
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   145
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   146
public:
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   147
	WindowQuickdrawSubdriver(int bpp);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   148
	virtual ~WindowQuickdrawSubdriver();
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   149
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   150
	virtual void Draw();
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   151
	virtual void MakeDirty(int left, int top, int width, int height);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   152
	virtual void UpdatePalette(uint first_color, uint num_colors);
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   153
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   154
	virtual uint ListModes(OTTDPoint* modes, uint max_modes);
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   155
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   156
	virtual bool ChangeResolution(int w, int h);
7806
65bd17ca1609 (svn r10662) -Add: added 'V' as new shortcut for new viewport (bilbo)
truelight
parents: 7672
diff changeset
   157
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   158
	virtual bool IsFullscreen() { return false; }
7806
65bd17ca1609 (svn r10662) -Add: added 'V' as new shortcut for new viewport (bilbo)
truelight
parents: 7672
diff changeset
   159
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   160
	virtual int GetWidth() { return window_width; }
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   161
	virtual int GetHeight() { return window_height; }
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   162
	virtual void *GetPixelBuffer() { return pixel_buffer; }
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   163
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   164
	/* Convert local coordinate to window server (CoreGraphics) coordinate */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   165
	virtual CGPoint PrivateLocalToCG(NSPoint* p);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   166
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   167
	virtual NSPoint GetMouseLocation(NSEvent *event);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   168
	virtual bool MouseIsInsideView(NSPoint *pt);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   169
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   170
	virtual bool IsActive() { return active; }
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   171
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   172
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   173
	void SetPortAlphaOpaque();
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   174
	bool WindowResized();
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   175
};
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   176
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   177
8439
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
   178
@implementation OTTD_QuickdrawWindow
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   179
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   180
- (void)setDriver:(WindowQuickdrawSubdriver*)drv
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   181
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   182
	driver = drv;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   183
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   184
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   185
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   186
/* we override these methods to fix the miniaturize animation/dock icon bug */
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   187
- (void)miniaturize:(id)sender
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   188
{
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   189
	/* make the alpha channel opaque so anim won't have holes in it */
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   190
	driver->SetPortAlphaOpaque ();
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   191
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   192
	/* window is hidden now */
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   193
	driver->active = false;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   194
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   195
	QZ_ShowMouse();
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   196
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   197
	[ super miniaturize:sender ];
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   198
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   199
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   200
- (void)display
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   201
{
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   202
	/* This method fires just before the window deminaturizes from the Dock.
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   203
	 * We'll save the current visible surface, let the window manager redraw any
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   204
	 * UI elements, and restore the surface. This way, no expose event
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   205
	 * is required, and the deminiaturize works perfectly.
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   206
	 */
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   207
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   208
	driver->SetPortAlphaOpaque();
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   209
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   210
	/* save current visible surface */
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   211
	[ self cacheImageInRect:[ driver->qdview frame ] ];
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   212
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   213
	/* let the window manager redraw controls, border, etc */
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   214
	[ super display ];
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   215
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   216
	/* restore visible surface */
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   217
	[ self restoreCachedImage ];
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   218
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   219
	/* window is visible again */
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   220
	driver->active = true;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   221
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   222
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   223
- (void)setFrame:(NSRect)frameRect display:(BOOL)flag
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   224
{
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   225
	[ super setFrame:frameRect display:flag ];
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   226
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   227
	/* Don't do anything if the window is currently being created */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   228
	if (driver->setup) return;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   229
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   230
	if (!driver->WindowResized())
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   231
		error("Cocoa: Failed to resize window.");
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   232
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   233
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   234
- (void)appDidHide:(NSNotification*)note
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   235
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   236
	driver->active = false;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   237
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   238
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   239
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   240
- (void)appWillUnhide:(NSNotification*)note
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   241
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   242
	driver->SetPortAlphaOpaque ();
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   243
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   244
	/* save current visible surface */
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   245
	[ self cacheImageInRect:[ driver->qdview frame ] ];
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   246
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   247
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   248
- (void)appDidUnhide:(NSNotification*)note
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   249
{
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   250
	/* restore cached image, since it may not be current, post expose event too */
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   251
	[ self restoreCachedImage ];
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   252
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   253
	driver->active = true;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   254
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   255
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   256
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   257
- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   258
{
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   259
	/* Make our window subclass receive these application notifications */
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   260
	[ [ NSNotificationCenter defaultCenter ] addObserver:self
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   261
	selector:@selector(appDidHide:) name:NSApplicationDidHideNotification object:NSApp ];
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   262
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   263
	[ [ NSNotificationCenter defaultCenter ] addObserver:self
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   264
	selector:@selector(appDidUnhide:) name:NSApplicationDidUnhideNotification object:NSApp ];
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   265
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   266
	[ [ NSNotificationCenter defaultCenter ] addObserver:self
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   267
	selector:@selector(appWillUnhide:) name:NSApplicationWillUnhideNotification object:NSApp ];
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   268
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   269
	return [ super initWithContentRect:contentRect styleMask:styleMask backing:backingType defer:flag ];
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   270
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   271
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   272
@end
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   273
8439
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
   274
@implementation OTTD_QuickdrawWindowDelegate
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   275
- (void)setDriver:(WindowQuickdrawSubdriver*)drv
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   276
{
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   277
	driver = drv;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   278
}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   279
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   280
- (BOOL)windowShouldClose:(id)sender
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   281
{
4548
23b56455df33 (svn r6380) -Codechange: unify all ways to quit OTTD.
rubidium
parents: 4536
diff changeset
   282
	HandleExitGameRequest();
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   283
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   284
	return NO;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   285
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   286
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   287
- (void)windowDidBecomeKey:(NSNotification*)aNotification
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   288
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   289
	driver->active = true;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   290
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   291
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   292
- (void)windowDidResignKey:(NSNotification*)aNotification
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   293
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   294
	driver->active = false;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   295
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   296
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   297
- (void)windowDidBecomeMain:(NSNotification*)aNotification
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   298
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   299
	driver->active = true;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   300
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   301
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   302
- (void)windowDidResignMain:(NSNotification*)aNotification
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   303
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   304
	driver->active = false;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   305
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   306
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   307
@end
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   308
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   309
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   310
static const int _resize_icon_width  = 16;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   311
static const int _resize_icon_height = 16;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   312
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   313
static bool _resize_icon[] = {
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   314
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   315
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   316
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   317
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   318
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   319
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   320
	0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   321
	0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   322
	0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   323
	0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   324
	0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   325
	0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   326
	0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   327
	0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   328
	0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0,
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   329
	1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   330
};
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   331
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   332
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   333
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   334
extern const char _openttd_revision[];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   335
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   336
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   337
void WindowQuickdrawSubdriver::GetDeviceInfo()
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   338
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   339
	CFDictionaryRef    cur_mode;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   340
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   341
	/* Initialize the video settings; this data persists between mode switches */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   342
	cur_mode = CGDisplayCurrentMode(kCGDirectMainDisplay);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   343
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   344
	/* Gather some information that is useful to know about the display */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   345
	CFNumberGetValue(
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   346
		(const __CFNumber*)CFDictionaryGetValue(cur_mode, kCGDisplayBitsPerPixel),
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   347
		kCFNumberSInt32Type, &device_depth
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   348
	);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   349
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   350
	CFNumberGetValue(
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   351
		(const __CFNumber*)CFDictionaryGetValue(cur_mode, kCGDisplayWidth),
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   352
		kCFNumberSInt32Type, &device_width
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   353
	);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   354
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   355
	CFNumberGetValue(
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   356
		(const __CFNumber*)CFDictionaryGetValue(cur_mode, kCGDisplayHeight),
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   357
		kCFNumberSInt32Type, &device_height
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   358
	);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   359
}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   360
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   361
bool WindowQuickdrawSubdriver::SetVideoMode(int width, int height)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   362
{
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   363
	char caption[50];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   364
	NSString *nsscaption;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   365
	unsigned int style;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   366
	NSRect contentRect;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   367
	BOOL isCustom = NO;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   368
	bool ret;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   369
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   370
	setup = true;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   371
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   372
	GetDeviceInfo();
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   373
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   374
	if (buffer_depth > device_depth) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   375
		DEBUG(driver, 0, "Cannot use a blitter with a higer screen depth than the display when running in windowed mode.");
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   376
		setup = false;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   377
		return false;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   378
	}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   379
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   380
	if (width > device_width)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   381
		width = device_width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   382
	if (height > device_height)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   383
		height = device_height;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   384
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   385
	contentRect = NSMakeRect(0, 0, width, height);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   386
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   387
	/* Check if we should recreate the window */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   388
	if (window == nil) {
8439
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
   389
		OTTD_QuickdrawWindowDelegate *delegate;
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   390
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   391
		/* Set the window style */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   392
		style = NSTitledWindowMask;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   393
		style |= (NSMiniaturizableWindowMask | NSClosableWindowMask);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   394
		style |= NSResizableWindowMask;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   395
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   396
		/* Manually create a window, avoids having a nib file resource */
8439
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
   397
		window = [ [ OTTD_QuickdrawWindow alloc ]
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   398
						initWithContentRect:contentRect
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   399
						styleMask:style
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   400
						backing:NSBackingStoreBuffered
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   401
						defer:NO ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   402
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   403
		if (window == nil) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   404
			DEBUG(driver, 0, "Could not create the Cocoa window.");
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   405
			setup = false;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   406
			return false;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   407
		}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   408
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   409
		[ window setDriver:this ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   410
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   411
		snprintf(caption, sizeof(caption), "OpenTTD %s", _openttd_revision);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   412
		nsscaption = [ [ NSString alloc ] initWithCString:caption ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   413
		[ window setTitle:nsscaption ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   414
		[ window setMiniwindowTitle:nsscaption ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   415
		[ nsscaption release ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   416
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   417
		[ window setAcceptsMouseMovedEvents:YES ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   418
		[ window setViewsNeedDisplay:NO ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   419
8439
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
   420
		delegate = [ [ OTTD_QuickdrawWindowDelegate alloc ] init ];
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   421
		[ delegate setDriver:this ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   422
		[ window setDelegate: [ delegate autorelease ] ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   423
	} else {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   424
		/* We already have a window, just change its size */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   425
		if (!isCustom) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   426
			[ window setContentSize:contentRect.size ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   427
			// Ensure frame height - title bar height >= view height
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   428
			contentRect.size.height = Clamp(height, 0, [ window frame ].size.height - 22 /* 22 is the height of title bar of window*/);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   429
			height = contentRect.size.height;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   430
			[ qdview setFrameSize:contentRect.size ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   431
		}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   432
	}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   433
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   434
	// Update again
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   435
	window_width = width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   436
	window_height = height;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   437
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   438
	[ window center ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   439
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   440
	/* Only recreate the view if it doesn't already exist */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   441
	if (qdview == nil) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   442
		qdview = [ [ NSQuickDrawView alloc ] initWithFrame:contentRect ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   443
		if (qdview == nil) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   444
			DEBUG(driver, 0, "Could not create the Quickdraw view.");
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   445
			setup = false;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   446
			return false;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   447
		}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   448
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   449
		[ qdview setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   450
		[ [ window contentView ] addSubview:qdview ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   451
		[ qdview release ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   452
		[ window makeKeyAndOrderFront:nil ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   453
	}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   454
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   455
	ret = WindowResized();
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   456
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   457
	UpdatePalette(0, 256);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   458
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   459
	setup = false;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   460
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   461
	return ret;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   462
}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   463
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   464
void WindowQuickdrawSubdriver::Blit32ToView32(int left, int top, int right, int bottom)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   465
{
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   466
	const uint32* src   = (uint32*)pixel_buffer;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   467
	uint32*       dst   = (uint32*)window_buffer;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   468
	uint          width = window_width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   469
	uint          pitch = window_pitch / 4;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   470
	int y;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   471
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   472
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   473
	dst += top * pitch + left;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   474
	src += top * width + left;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   475
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   476
	for (y = top; y < bottom; y++, dst+= pitch, src+= width) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   477
		memcpy(dst, src, (right - left) * 4);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   478
	}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   479
}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   480
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   481
void WindowQuickdrawSubdriver::BlitIndexedToView32(int left, int top, int right, int bottom)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   482
{
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   483
	const uint32* pal   = palette32;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   484
	const uint8*  src   = (uint8*)pixel_buffer;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   485
	uint32*       dst   = (uint32*)window_buffer;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   486
	uint          width = window_width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   487
	uint          pitch = window_pitch / 4;
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   488
	int x;
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   489
	int y;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   490
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   491
	for (y = top; y < bottom; y++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   492
		for (x = left; x < right; x++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   493
			dst[y * pitch + x] = pal[src[y * width + x]];
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   494
		}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   495
	}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   496
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   497
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   498
void WindowQuickdrawSubdriver::BlitIndexedToView16(int left, int top, int right, int bottom)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   499
{
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   500
	const uint16* pal   = palette16;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   501
	const uint8*  src   = (uint8*)pixel_buffer;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   502
	uint16*       dst   = (uint16*)window_buffer;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   503
	uint          width = window_width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   504
	uint          pitch = window_pitch / 2;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   505
	int x;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   506
	int y;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   507
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   508
	for (y = top; y < bottom; y++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   509
		for (x = left; x < right; x++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   510
			dst[y * pitch + x] = pal[src[y * width + x]];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   511
		}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   512
	}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   513
}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   514
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   515
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   516
inline void WindowQuickdrawSubdriver::BlitToView(int left, int top, int right, int bottom)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   517
{
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   518
	switch (device_depth) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   519
		case 32:
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   520
			switch(buffer_depth) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   521
				case 32:
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   522
					Blit32ToView32(left, top, right, bottom);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   523
					break;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   524
				case 8:
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   525
					BlitIndexedToView32(left, top, right, bottom);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   526
					break;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   527
			}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   528
			break;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   529
		case 16:
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   530
			BlitIndexedToView16(left, top, right, bottom);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   531
			break;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   532
	}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   533
}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   534
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   535
void WindowQuickdrawSubdriver::DrawResizeIcon()
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   536
{
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   537
	int xoff = window_width - _resize_icon_width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   538
	int yoff = window_height - _resize_icon_height;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   539
	int x;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   540
	int y;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   541
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   542
	switch (device_depth) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   543
		case 32:
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   544
			for (y = 0; y < _resize_icon_height; y++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   545
				uint32* trg = (uint32*)window_buffer + (yoff + y) * window_pitch / 4 + xoff;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   546
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   547
				for (x = 0; x < _resize_icon_width; x++, trg++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   548
					if (_resize_icon[y * _resize_icon_width + x]) *trg = 0xff000000;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   549
				}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   550
			}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   551
			break;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   552
		case 16:
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   553
			for (y = 0; y < _resize_icon_height; y++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   554
				uint16* trg = (uint16*)window_buffer + (yoff + y) * window_pitch / 2 + xoff;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   555
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   556
				for (x = 0; x < _resize_icon_width; x++, trg++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   557
					if (_resize_icon[y * _resize_icon_width + x]) *trg = 0x0000;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   558
				}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   559
			}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   560
			break;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   561
	}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   562
}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   563
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   564
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   565
WindowQuickdrawSubdriver::WindowQuickdrawSubdriver(int bpp)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   566
{
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   567
	window_width  = 0;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   568
	window_height = 0;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   569
	buffer_depth  = bpp;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   570
	pixel_buffer  = NULL;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   571
	active        = false;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   572
	setup         = false;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   573
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   574
	window = nil;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   575
	qdview = nil;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   576
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   577
	num_dirty_rects = MAX_DIRTY_RECTS;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   578
}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   579
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   580
WindowQuickdrawSubdriver::~WindowQuickdrawSubdriver()
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   581
{
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   582
	QZ_ShowMouse();
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   583
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   584
	/* Release window mode resources */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   585
	if (window != nil) [ window close ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   586
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   587
	free(pixel_buffer);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   588
}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   589
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   590
void WindowQuickdrawSubdriver::Draw()
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   591
{
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   592
	int i;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   593
	RgnHandle dirty, temp;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   594
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   595
	/* Check if we need to do anything */
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   596
	if (num_dirty_rects == 0 ||
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   597
		[ window isMiniaturized ]) {
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   598
		return;
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   599
	}
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   600
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   601
	if (num_dirty_rects >= MAX_DIRTY_RECTS) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   602
		num_dirty_rects = 1;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   603
		dirty_rects[0].left = 0;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   604
		dirty_rects[0].top = 0;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   605
		dirty_rects[0].right = window_width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   606
		dirty_rects[0].bottom = window_height;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   607
	}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   608
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   609
	dirty = NewRgn();
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   610
	temp  = NewRgn();
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   611
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   612
	SetEmptyRgn(dirty);
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   613
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   614
	/* Build the region of dirty rectangles */
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   615
	for (i = 0; i < num_dirty_rects; i++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   616
		BlitToView(
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   617
			dirty_rects[i].left,
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   618
			dirty_rects[i].top,
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   619
			dirty_rects[i].right,
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   620
			dirty_rects[i].bottom
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   621
		);
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   622
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   623
		MacSetRectRgn(
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   624
			temp,
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   625
			dirty_rects[i].left,
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   626
			dirty_rects[i].top,
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   627
			dirty_rects[i].right,
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   628
			dirty_rects[i].bottom
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   629
		);
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   630
		MacUnionRgn(dirty, temp, dirty);
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   631
	}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   632
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   633
	DrawResizeIcon();
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   634
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   635
	/* Flush the dirty region */
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   636
	QDFlushPortBuffer( (OpaqueGrafPtr*) [ qdview qdPort ], dirty);
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   637
	DisposeRgn(dirty);
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   638
	DisposeRgn(temp);
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   639
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   640
	num_dirty_rects = 0;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   641
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   642
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   643
void WindowQuickdrawSubdriver::MakeDirty(int left, int top, int width, int height)
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   644
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   645
	if (num_dirty_rects < MAX_DIRTY_RECTS) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   646
		dirty_rects[num_dirty_rects].left = left;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   647
		dirty_rects[num_dirty_rects].top = top;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   648
		dirty_rects[num_dirty_rects].right = left + width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   649
		dirty_rects[num_dirty_rects].bottom = top + height;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   650
	}
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   651
	num_dirty_rects++;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   652
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   653
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   654
void WindowQuickdrawSubdriver::UpdatePalette(uint first_color, uint num_colors)
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   655
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   656
	uint i;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   657
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   658
	if (buffer_depth != 8)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   659
		return;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   660
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   661
	switch (device_depth) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   662
		case 32:
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   663
			for (i = first_color; i < first_color + num_colors; i++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   664
				uint32 clr32 = 0xff000000;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   665
				clr32 |= (uint32)_cur_palette[i].r << 16;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   666
				clr32 |= (uint32)_cur_palette[i].g << 8;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   667
				clr32 |= (uint32)_cur_palette[i].b;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   668
				palette32[i] = clr32;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   669
			}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   670
			break;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   671
		case 16:
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   672
			for (i = first_color; i < first_color + num_colors; i++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   673
				uint16 clr16 = 0x0000;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   674
				clr16 |= (uint16)((_cur_palette[i].r >> 3) & 0x1f) << 10;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   675
				clr16 |= (uint16)((_cur_palette[i].g >> 3) & 0x1f) << 5;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   676
				clr16 |= (uint16)((_cur_palette[i].b >> 3) & 0x1f);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   677
				palette16[i] = clr16;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   678
			}
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   679
			break;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   680
	}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   681
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   682
	num_dirty_rects = MAX_DIRTY_RECTS;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   683
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   684
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   685
uint WindowQuickdrawSubdriver::ListModes(OTTDPoint* modes, uint max_modes)
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   686
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   687
	if (max_modes == 0) return 0;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   688
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   689
	modes[0].x = window_width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   690
	modes[0].y = window_height;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   691
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   692
	return 1;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   693
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   694
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   695
bool WindowQuickdrawSubdriver::ChangeResolution(int w, int h)
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   696
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   697
	int old_width  = window_width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   698
	int old_height = window_height;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   699
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   700
	if (SetVideoMode(w, h))
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   701
		return true;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   702
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   703
	if (old_width != 0 && old_height != 0)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   704
		SetVideoMode(old_width, old_height);
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   705
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   706
	return false;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   707
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   708
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   709
/* Convert local coordinate to window server (CoreGraphics) coordinate */
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   710
CGPoint WindowQuickdrawSubdriver::PrivateLocalToCG(NSPoint* p)
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   711
{
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   712
	CGPoint cgp;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   713
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   714
	*p = [ qdview convertPoint:*p toView: nil ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   715
	*p = [ window convertBaseToScreen:*p ];
8442
7adb0edfb909 (svn r11501) -Fix: [OSX] This remedies a problem with right click scrolling that was introduced in r11492.
egladil
parents: 8439
diff changeset
   716
	p->y = device_height - p->y;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   717
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   718
	cgp.x = p->x;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   719
	cgp.y = p->y;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   720
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   721
	return cgp;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   722
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   723
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   724
NSPoint WindowQuickdrawSubdriver::GetMouseLocation(NSEvent *event)
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   725
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   726
	NSPoint pt;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   727
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   728
	pt = [ event locationInWindow ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   729
	pt = [ qdview convertPoint:pt fromView:nil ];
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   730
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   731
	return pt;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   732
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   733
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   734
bool WindowQuickdrawSubdriver::MouseIsInsideView(NSPoint *pt)
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   735
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   736
	return [ qdview mouse:*pt inRect:[ qdview bounds ] ];
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   737
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   738
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   739
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   740
/* This function makes the *game region* of the window 100% opaque.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   741
 * The genie effect uses the alpha component. Otherwise,
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   742
 * it doesn't seem to matter what value it has.
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   743
 */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   744
void WindowQuickdrawSubdriver::SetPortAlphaOpaque()
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   745
{
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   746
	if (device_depth != 32)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   747
		return;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   748
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   749
	uint32* pixels = (uint32*)window_buffer;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   750
	uint32  pitch  = window_pitch / 4;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   751
	int x, y;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   752
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   753
	for (y = 0; y < window_height; y++)
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   754
		for (x = 0; x < window_width; x++) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   755
		pixels[y * pitch + x] |= 0xFF000000;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   756
	}
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   757
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   758
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   759
bool WindowQuickdrawSubdriver::WindowResized()
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   760
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   761
	if (window == nil || qdview == nil) return true;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   762
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   763
	NSRect   newframe = [ qdview frame ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   764
	CGrafPtr thePort  = (OpaqueGrafPtr*) [ qdview qdPort ];
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   765
	int voff, hoff;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   766
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   767
	LockPortBits(thePort);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   768
	window_buffer = GetPixBaseAddr(GetPortPixMap(thePort));
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   769
	window_pitch = GetPixRowBytes(GetPortPixMap(thePort));
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   770
	UnlockPortBits(thePort);
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   771
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   772
	/* _cocoa_video_data.realpixels now points to the window's pixels
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   773
	 * We want it to point to the *view's* pixels
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   774
	 */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   775
	voff = [ window frame ].size.height - newframe.size.height - newframe.origin.y;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   776
	hoff = [ qdview frame ].origin.x;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   777
	window_buffer = (uint8*)window_buffer + (voff * window_pitch) + hoff * (device_depth / 8);
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   778
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   779
	window_width = newframe.size.width;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   780
	window_height = newframe.size.height;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   781
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   782
	free(pixel_buffer);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   783
	pixel_buffer = malloc(window_width * window_height * buffer_depth / 8);
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   784
	if (pixel_buffer == NULL) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   785
		DEBUG(driver, 0, "Failed to allocate pixel buffer");
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   786
		return false;
3036
d6670ee6981f (svn r3616) Style sweep
tron
parents: 3035
diff changeset
   787
	}
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   788
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   789
	QZ_GameSizeChanged();
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   790
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   791
	/* Redraw screen */
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   792
	num_dirty_rects = MAX_DIRTY_RECTS;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   793
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   794
	return true;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   795
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   796
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   797
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   798
CocoaSubdriver *QZ_CreateWindowQuickdrawSubdriver(int width, int height, int bpp)
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   799
{
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   800
	WindowQuickdrawSubdriver *ret;
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   801
8535
cda5ffec8999 (svn r11599) -Change: [OSX] 10.4 will now use quickdraw for window mode instead of quartz
bjarni
parents: 8461
diff changeset
   802
	if (MacOSVersionIsAtLeast(10, 5, 0)) {
cda5ffec8999 (svn r11599) -Change: [OSX] 10.4 will now use quickdraw for window mode instead of quartz
bjarni
parents: 8461
diff changeset
   803
		DEBUG(driver, 0, "The cocoa quickdraw subdriver is not recommended for Mac OS X 10.5 or later.");
8461
385ca6f76feb (svn r11521) -Codechange: [OSX] Check what the running os version is in a cleaner way.
egladil
parents: 8448
diff changeset
   804
	}
385ca6f76feb (svn r11521) -Codechange: [OSX] Check what the running os version is in a cleaner way.
egladil
parents: 8448
diff changeset
   805
8439
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
   806
	if (bpp != 8 && bpp != 32) {
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
   807
		DEBUG(driver, 0, "The cocoa quickdraw subdriver only supports 8 and 32 bpp.");
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
   808
		return NULL;
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
   809
	}
bc2f9dfa0d40 (svn r11498) -Add [FS#1411]: [OSX] Added support for using Quartz instead of Quickdraw in windowed mode on OS X 10.4 and higher. Based on a patch by blackis.
egladil
parents: 8435
diff changeset
   810
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   811
	ret = new WindowQuickdrawSubdriver(bpp);
2827
61e2ac8b0801 (svn r3375) -Add: [ FS#29 ] show an error dialog for OSX cocoa driver (egladil)
truelight
parents: 2743
diff changeset
   812
8435
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   813
	if (!ret->ChangeResolution(width, height)) {
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   814
		delete ret;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   815
		return NULL;
38a1ab65d6e4 (svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
egladil
parents: 8423
diff changeset
   816
	}
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   817
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   818
	return ret;
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   819
}
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   820
8588
9a8122b510f9 (svn r11653) -Feature: [OSX] Allow windowed mode subdrivers to be disabled at compile time.
egladil
parents: 8535
diff changeset
   821
#endif /* ENABLE_COCOA_QUICKDRAW */
2736
1ea068235989 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   822
#endif /* WITH_COCOA */