Changeset - r3082:12642bff9b64
[Not reviewed]
master
0 1 0
bjarni - 19 years ago 2006-02-24 22:12:11
bjarni@openttd.org
(svn r3671) -Code cleanup: fixed style and removed commented out code in video/cocoa_v.m
1 file changed with 1 insertions and 11 deletions:
0 comments (0 inline, 0 general)
video/cocoa_v.m
Show inline comments
 
@@ -873,43 +873,41 @@ static void QZ_SetPortAlphaOpaque(void)
 
	_screen.height = _cocoa_video_data.height;
 
	_screen.pitch = _cocoa_video_data.width;
 

	
 
	GameSizeChanged();
 

	
 
	/* Redraw screen */
 
	_cocoa_video_data.num_dirty_rects = MAX_DIRTY_RECTS;
 
}
 

	
 
- (void)appDidHide:(NSNotification*)note
 
{
 
	_cocoa_video_data.active = false;
 
//	DEBUG(driver, 1)("cocoa_v: appDidHide");
 
}
 

	
 

	
 
- (void)appWillUnhide:(NSNotification*)note
 
{
 
	QZ_SetPortAlphaOpaque ();
 

	
 
	/* save current visible surface */
 
	[ self cacheImageInRect:[ _cocoa_video_data.qdview frame ] ];
 
}
 

	
 
- (void)appDidUnhide:(NSNotification*)note
 
{
 
	/* restore cached image, since it may not be current, post expose event too */
 
	[ self restoreCachedImage ];
 

	
 
	_cocoa_video_data.active = true;
 
//	DEBUG(driver, 1)("cocoa_v: appDidUnhide");
 
}
 

	
 

	
 
- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag
 
{
 
	/* Make our window subclass receive these application notifications */
 
	[ [ NSNotificationCenter defaultCenter ] addObserver:self
 
	selector:@selector(appDidHide:) name:NSApplicationDidHideNotification object:NSApp ];
 

	
 
	[ [ NSNotificationCenter defaultCenter ] addObserver:self
 
	selector:@selector(appDidUnhide:) name:NSApplicationDidUnhideNotification object:NSApp ];
 

	
 
@@ -923,43 +921,39 @@ static void QZ_SetPortAlphaOpaque(void)
 

	
 
@implementation OTTD_QuartzWindowDelegate
 
- (BOOL)windowShouldClose:(id)sender
 
{
 
	QZ_AskQuit();
 

	
 
	return NO;
 
}
 

	
 
- (void)windowDidBecomeKey:(NSNotification*)aNotification
 
{
 
	_cocoa_video_data.active = true;
 
//	DEBUG(driver, 1)("cocoa_v: windowDidBecomeKey");
 
}
 

	
 
- (void)windowDidResignKey:(NSNotification*)aNotification
 
{
 
	_cocoa_video_data.active = false;
 
//	DEBUG(driver, 1)("cocoa_v: windowDidResignKey");
 
}
 

	
 
- (void)windowDidBecomeMain:(NSNotification*)aNotification
 
{
 
	_cocoa_video_data.active = true;
 
//	DEBUG(driver, 1)("cocoa_v: windowDidBecomeMain");
 
}
 

	
 
- (void)windowDidResignMain:(NSNotification*)aNotification
 
{
 
	_cocoa_video_data.active = false;
 
//	DEBUG(driver, 1)("cocoa_v: windowDidResignMain");
 
}
 

	
 
@end
 

	
 

	
 
static void QZ_UpdateWindowPalette(uint start, uint count)
 
{
 
	uint i;
 

	
 
	switch (_cocoa_video_data.device_bpp) {
 
		case 32:
 
			for (i = start; i < start + count; i++) {
 
@@ -1474,27 +1468,25 @@ static void QZ_DrawScreen(void)
 
	uint length_drawn;
 
	uint left;
 
	uint i;
 

	
 
	src = _cocoa_video_data.pixels;
 
	dst = (uint8*)_cocoa_video_data.realpixels;
 
	height = _cocoa_video_data.height;
 
	width  = _cocoa_video_data.width;
 
	pitch  = _cocoa_video_data.pitch;
 
	num_dirty_rects = _cocoa_video_data.num_dirty_rects;
 

	
 
	/* Check if we need to do anything */
 
	if (_cocoa_video_data.num_dirty_rects == 0 ) {
 
		return;
 
	}
 
	if (_cocoa_video_data.num_dirty_rects == 0 ) return;
 

	
 
	if (num_dirty_rects >= MAX_DIRTY_RECTS) {
 
		num_dirty_rects = 1;
 
		_cocoa_video_data.dirty_rects[0].left = 0;
 
		_cocoa_video_data.dirty_rects[0].top = 0;
 
		_cocoa_video_data.dirty_rects[0].right = _cocoa_video_data.width;
 
		_cocoa_video_data.dirty_rects[0].bottom = _cocoa_video_data.height;
 
	}
 

	
 
	QZ_WaitForVerticalBlank();
 
	/* Build the region of dirty rectangles */
 
	for (i = 0; i < num_dirty_rects; i++) {
 
@@ -1798,25 +1790,24 @@ static void QZ_WarpCursor(int x, int y)
 
	/* Only allow warping when in foreground */
 
	if (![ NSApp isActive ]) return;
 

	
 
	p = NSMakePoint(x, y);
 
	cgp = QZ_PrivateLocalToCG(&p);
 

	
 
	/* this is the magic call that fixes cursor "freezing" after warp */
 
	CGSetLocalEventsSuppressionInterval(0.0);
 
	/* Do the actual warp */
 
	CGWarpMouseCursorPosition(cgp);
 

	
 
	/* Generate the mouse moved event */
 
//	SDL_PrivateMouseMotion(0, 0, x, y);
 
}
 

	
 
static void QZ_ShowMouse(void)
 
{
 
	if (!_cocoa_video_data.cursor_visible) {
 
		[ NSCursor unhide ];
 
		_cocoa_video_data.cursor_visible = true;
 
	}
 
}
 

	
 
static void QZ_HideMouse(void)
 
{
 
@@ -1839,25 +1830,24 @@ static void QZ_HideMouse(void)
 
- (void) applicationDidFinishLaunching: (NSNotification*) note
 
{
 
	/* Hand off to main application code */
 
	QZ_GameLoop();
 

	
 
	/* We're done, thank you for playing */
 
	[ NSApp stop:_ottd_main ];
 
}
 

	
 
/* Display the in game quit confirmation dialog */
 
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*) sender
 
{
 
//	DEBUG(driver, 1)("cocoa_v: applicationShouldTerminate");
 

	
 
	QZ_AskQuit();
 

	
 
	return NSTerminateCancel;		// NSTerminateLater ?
 
}
 
@end
 

	
 
static void setApplicationMenu(void)
 
{
 
	/* warning: this code is very odd */
 
	NSMenu *appleMenu;
 
	NSMenuItem *menuItem;
0 comments (0 inline, 0 general)