Index: /OpenSceneGraph/trunk/src/osgViewer/DarwinUtils.h
===================================================================
--- /OpenSceneGraph/trunk/src/osgViewer/DarwinUtils.h (revision 9879)
+++ /OpenSceneGraph/trunk/src/osgViewer/DarwinUtils.h (revision 9895)
@@ -30,17 +30,17 @@
 
     public:
-		class WindowAdapter : public osg::Referenced {
-			
-			public:
-				WindowAdapter() : osg::Referenced() {}
-				
-				virtual bool valid() = 0;
-				virtual void getWindowBounds(CGRect& rect) = 0;
-				virtual osgViewer::GraphicsWindow* getWindow() = 0;
-				
-			protected:
-				virtual ~WindowAdapter() {}
-		};
-		
+        class WindowAdapter : public osg::Referenced {
+            
+            public:
+                WindowAdapter() : osg::Referenced() {}
+                
+                virtual bool valid() = 0;
+                virtual void getWindowBounds(CGRect& rect) = 0;
+                virtual osgViewer::GraphicsWindow* getWindow() = 0;
+                
+            protected:
+                virtual ~WindowAdapter() {}
+        };
+        
         MenubarController();        
         static MenubarController* instance();
@@ -52,9 +52,9 @@
     private: 
         typedef std::list< osg::ref_ptr< WindowAdapter > > WindowList;
-        WindowList				_list;
-        bool					_menubarShown;
-        CGRect					_availRect;
-        CGRect					_mainScreenBounds;
-        OpenThreads::Mutex		_mutex;
+        WindowList          _list;
+        bool                _menubarShown;
+        CGRect              _availRect;
+        CGRect              _mainScreenBounds;
+        OpenThreads::Mutex  _mutex;
         
 };
@@ -65,53 +65,53 @@
 {
     public:
-		DarwinWindowingSystemInterface();
-		
-		/** dtor */
-		~DarwinWindowingSystemInterface();
-		
-	/** @return a CGDirectDisplayID for a ScreenIdentifier */
-	CGDirectDisplayID getDisplayID(const osg::GraphicsContext::ScreenIdentifier& si);
-	
-	/** @return count of attached screens */
-	virtual unsigned int getNumScreens(const osg::GraphicsContext::ScreenIdentifier& si) ;
-	
-	virtual void getScreenSettings(const osg::GraphicsContext::ScreenIdentifier& si, osg::GraphicsContext::ScreenSettings & resolution);
+        DarwinWindowingSystemInterface();
 
-	virtual void enumerateScreenSettings(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, osg::GraphicsContext::ScreenSettingsList & resolutionList);
+        /** dtor */
+        ~DarwinWindowingSystemInterface();
 
-	/** return the top left coord of a specific screen in global screen space */
-	void getScreenTopLeft(const osg::GraphicsContext::ScreenIdentifier& si, int& x, int& y);
-	
-	/** implementation of setScreenResolution */
-	virtual bool setScreenResolution(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, unsigned int width, unsigned int height) ;
+        /** @return a CGDirectDisplayID for a ScreenIdentifier */
+        CGDirectDisplayID getDisplayID(const osg::GraphicsContext::ScreenIdentifier& si);
 
-	/** implementation of setScreenRefreshRate */
-	virtual bool setScreenRefreshRate(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, double refreshRate);
-	
-	
-	/** returns screen-ndx containing rect x,y,w,h */
-	unsigned int getScreenContaining(int x, int y, int w, int h);
-	
-	protected:
-	
-		template<class PixelBufferImplementation, class GraphicsWindowImplementation>
-		osg::GraphicsContext* createGraphicsContextImplementation(osg::GraphicsContext::Traits* traits)
-		{
-			if (traits->pbuffer)
-			{
-				osg::ref_ptr<PixelBufferImplementation> pbuffer = new PixelBufferImplementation(traits);
-				if (pbuffer->valid()) return pbuffer.release();
-				else return 0;
-			}
-			else
-			{
-				osg::ref_ptr<GraphicsWindowImplementation> window = new GraphicsWindowImplementation(traits);
-				if (window->valid()) return window.release();
-				else return 0;
-			}
-		}
-	
+        /** @return count of attached screens */
+        virtual unsigned int getNumScreens(const osg::GraphicsContext::ScreenIdentifier& si) ;
+
+        virtual void getScreenSettings(const osg::GraphicsContext::ScreenIdentifier& si, osg::GraphicsContext::ScreenSettings & resolution);
+
+        virtual void enumerateScreenSettings(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, osg::GraphicsContext::ScreenSettingsList & resolutionList);
+
+        /** return the top left coord of a specific screen in global screen space */
+        void getScreenTopLeft(const osg::GraphicsContext::ScreenIdentifier& si, int& x, int& y);
+
+        /** implementation of setScreenResolution */
+        virtual bool setScreenResolution(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, unsigned int width, unsigned int height) ;
+
+        /** implementation of setScreenRefreshRate */
+        virtual bool setScreenRefreshRate(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, double refreshRate);
+
+
+        /** returns screen-ndx containing rect x,y,w,h */
+        unsigned int getScreenContaining(int x, int y, int w, int h);
     
-	private:
+    protected:
+    
+        template<class PixelBufferImplementation, class GraphicsWindowImplementation>
+        osg::GraphicsContext* createGraphicsContextImplementation(osg::GraphicsContext::Traits* traits)
+        {
+            if (traits->pbuffer)
+            {
+                osg::ref_ptr<PixelBufferImplementation> pbuffer = new PixelBufferImplementation(traits);
+                if (pbuffer->valid()) return pbuffer.release();
+                else return 0;
+            }
+            else
+            {
+                osg::ref_ptr<GraphicsWindowImplementation> window = new GraphicsWindowImplementation(traits);
+                if (window->valid()) return window.release();
+                else return 0;
+            }
+        }
+    
+    
+    private:
         CGDisplayCount        _displayCount;
         CGDirectDisplayID*    _displayIds;
Index: /OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowCocoa.mm
===================================================================
--- /OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowCocoa.mm (revision 9879)
+++ /OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowCocoa.mm (revision 9895)
@@ -143,6 +143,6 @@
 std::ostream& operator<<(std::ostream& os, const NSRect& rect) 
 {
-	os << rect.origin.x << "/" << rect.origin.y << " " << rect.size.width << "x" << rect.size.height;
-	return os;
+    os << rect.origin.x << "/" << rect.origin.y << " " << rect.size.width << "x" << rect.size.height;
+    return os;
 }
 
@@ -158,8 +158,8 @@
     NSRect frame = [[[NSScreen screens] objectAtIndex: 0] frame];
     float y = frame.size.height - rect.origin.y - rect.size.height;
-	NSRect converted = NSMakeRect(rect.origin.x, y, rect.size.width, rect.size.height);
-	
-	// std::cout << "converting from Quartz " << rect << " to " << converted << " using screen rect " << frame << std::endl;
-	
+    NSRect converted = NSMakeRect(rect.origin.x, y, rect.size.width, rect.size.height);
+    
+    // std::cout << "converting from Quartz " << rect << " to " << converted << " using screen rect " << frame << std::endl;
+    
     return converted;
 }
@@ -170,8 +170,8 @@
     
     float y = frame.size.height - (rect.origin.y + rect.size.height);
-	NSRect converted = NSMakeRect(rect.origin.x, y, rect.size.width, rect.size.height);
-	
-	// std::cout << "converting To Quartz   " << rect << " to " << converted << " using screen rect " << frame << std::endl;
-	
+    NSRect converted = NSMakeRect(rect.origin.x, y, rect.size.width, rect.size.height);
+    
+    // std::cout << "converting To Quartz   " << rect << " to " << converted << " using screen rect " << frame << std::endl;
+    
     return converted;
 }
@@ -245,5 +245,5 @@
         BOOL _isUsingCtrlClick, _isUsingOptionClick;
         unsigned int _cachedModifierFlags;
-		BOOL _handleTabletEvents;
+        BOOL _handleTabletEvents;
         
 }
@@ -362,5 +362,5 @@
 
 - (void)flagsChanged:(NSEvent *)theEvent {
-	[self handleModifiers: theEvent];
+    [self handleModifiers: theEvent];
 }
 
@@ -393,9 +393,9 @@
         [self doLeftMouseButtonDown:theEvent];
     }
-	
-	if ([theEvent subtype] == NSTabletPointEventSubtype) {
-		_handleTabletEvents = true;
-		[self handleTabletEvents:theEvent];
-	}
+    
+    if ([theEvent subtype] == NSTabletPointEventSubtype) {
+        _handleTabletEvents = true;
+        [self handleTabletEvents:theEvent];
+    }
 }
 
@@ -405,7 +405,7 @@
     NSPoint converted_point = [self getLocalPoint: theEvent];    
     _win->getEventQueue()->mouseMotion(converted_point.x, converted_point.y);
-	
-	if (_handleTabletEvents)
-		[self handleTabletEvents:theEvent];
+    
+    if (_handleTabletEvents)
+        [self handleTabletEvents:theEvent];
 }
 
@@ -431,5 +431,5 @@
         [self doLeftMouseButtonUp:theEvent];
     }
-	_handleTabletEvents = false;
+    _handleTabletEvents = false;
 }
 
@@ -449,5 +449,5 @@
 {
     [self doRightMouseButtonUp:theEvent];
-	_handleTabletEvents = false;
+    _handleTabletEvents = false;
 }
 
@@ -638,15 +638,15 @@
 - (void)tabletPoint:(NSEvent *)theEvent
 {
-	//_handleTabletEvents = YES;
-	//[self handleTabletEvents:theEvent];
+    //_handleTabletEvents = YES;
+    //[self handleTabletEvents:theEvent];
 }
 
 -(void)handleTabletEvents:(NSEvent *)theEvent
 {
-	float pressure = [theEvent pressure];
-	_win->getEventQueue()->penPressure(pressure);
-	NSPoint tilt = [theEvent tilt];
-	
-	_win->getEventQueue()->penOrientation (tilt.x, tilt.y, [theEvent rotation]);
+    float pressure = [theEvent pressure];
+    _win->getEventQueue()->penPressure(pressure);
+    NSPoint tilt = [theEvent tilt];
+    
+    _win->getEventQueue()->penOrientation (tilt.x, tilt.y, [theEvent rotation]);
 }
 
@@ -654,19 +654,19 @@
 - (void)tabletProximity:(NSEvent *)theEvent
 {
-	osgGA::GUIEventAdapter::TabletPointerType pt(osgGA::GUIEventAdapter::UNKNOWN);
-	switch ([theEvent pointingDeviceType]) {
-		case NSPenPointingDevice:
-			pt = osgGA::GUIEventAdapter::PEN;
-			break;
-		case NSCursorPointingDevice:
-			pt = osgGA::GUIEventAdapter::PUCK;
-			break;
-		case NSEraserPointingDevice:
-			pt = osgGA::GUIEventAdapter::ERASER;
-			break;
-		default:
-			break;
-	}
-	_win->getEventQueue()->penProximity(pt, [theEvent isEnteringProximity]); 
+    osgGA::GUIEventAdapter::TabletPointerType pt(osgGA::GUIEventAdapter::UNKNOWN);
+    switch ([theEvent pointingDeviceType]) {
+        case NSPenPointingDevice:
+            pt = osgGA::GUIEventAdapter::PEN;
+            break;
+        case NSCursorPointingDevice:
+            pt = osgGA::GUIEventAdapter::PUCK;
+            break;
+        case NSEraserPointingDevice:
+            pt = osgGA::GUIEventAdapter::ERASER;
+            break;
+        default:
+            break;
+    }
+    _win->getEventQueue()->penProximity(pt, [theEvent isEnteringProximity]); 
 }
 
@@ -762,5 +762,5 @@
     
     virtual bool valid() { return (_win.valid() && _win->valid()); }
-	
+    
     virtual void getWindowBounds(CGRect& rect) 
     {
@@ -773,5 +773,5 @@
         rect.size.height = nsrect.size.height;
     }
-	
+    
     virtual osgViewer::GraphicsWindow* getWindow() {return _win.get(); }
 private:
@@ -808,9 +808,9 @@
 
     [win setReleasedWhenClosed:NO];
-	[win setDisplaysWhenScreenProfileChanges:YES];	
+    [win setDisplaysWhenScreenProfileChanges:YES];    
     GraphicsWindowCocoaDelegate* delegate = [[GraphicsWindowCocoaDelegate alloc] initWith: this];
     [win setDelegate: delegate ];
     //[delegate autorelease];
-	    
+        
     [win makeKeyAndOrderFront:nil];
     [win setAcceptsMouseMovedEvents: YES];
@@ -836,5 +836,5 @@
             style |= NSResizableWindowMask;
     }
-    	
+        
     DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
     int screenLeft(0), screenTop(0);
@@ -843,8 +843,8 @@
     }
     
-	NSRect rect = NSMakeRect(_traits->x + screenLeft, _traits->y + screenTop, _traits->width, _traits->height);
-    
-	_window = [[GraphicsWindowCocoaWindow alloc] initWithContentRect: rect styleMask: style backing: NSBackingStoreBuffered defer: NO];
-	
+    NSRect rect = NSMakeRect(_traits->x + screenLeft, _traits->y + screenTop, _traits->width, _traits->height);
+    
+    _window = [[GraphicsWindowCocoaWindow alloc] initWithContentRect: rect styleMask: style backing: NSBackingStoreBuffered defer: NO];
+    
     if (!_window) {
         osg::notify(osg::WARN) << "GraphicsWindowCocoa::realizeImplementation :: could not create window" << std::endl;
@@ -854,6 +854,6 @@
     rect = convertFromQuartzCoordinates(rect);
     [_window setFrameOrigin: rect.origin];
-	 
-	NSOpenGLPixelFormatAttribute attr[32];
+     
+    NSOpenGLPixelFormatAttribute attr[32];
     int i = 0;
     
@@ -902,6 +902,6 @@
         }
     }
-	
-	NSOpenGLPixelFormat* pixelformat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr ];
+    
+    NSOpenGLPixelFormat* pixelformat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr ];
     _context = [[NSOpenGLContext alloc] initWithFormat: pixelformat shareContext: sharedContext];
     
@@ -910,15 +910,15 @@
         return false;
     }
-	GraphicsWindowCocoaGLView* theView = [[ GraphicsWindowCocoaGLView alloc ] initWithFrame:[ _window frame ] ];
+    GraphicsWindowCocoaGLView* theView = [[ GraphicsWindowCocoaGLView alloc ] initWithFrame:[ _window frame ] ];
     [theView setAutoresizingMask:  (NSViewWidthSizable | NSViewHeightSizable) ];
     [theView setGraphicsWindowCocoa: this];
     [theView setOpenGLContext:_context];
-	[_window setContentView: theView];
-	
+    [_window setContentView: theView];
+    
     setupNSWindow(_window);
     
     [theView release];
     [pool release];
-	
+    
     MenubarController::instance()->attachWindow( new CocoaWindowAdapter(this) );
     
@@ -951,5 +951,5 @@
     if (mbc) mbc->detachWindow(this);
     
-	[_window close];
+    [_window close];
     [_window release];
 }
@@ -962,6 +962,6 @@
 bool GraphicsWindowCocoa:: makeCurrentImplementation()
 {
-	[_context makeCurrentContext];
-	return true;
+    [_context makeCurrentContext];
+    return true;
 }
 
@@ -973,6 +973,6 @@
 bool GraphicsWindowCocoa::releaseContextImplementation()
 {
-	[NSOpenGLContext clearCurrentContext];
-	return true;
+    [NSOpenGLContext clearCurrentContext];
+    return true;
 }
 
@@ -984,5 +984,5 @@
 void GraphicsWindowCocoa::swapBuffersImplementation()
 {
-	[_context flushBuffer];
+    [_context flushBuffer];
 }
 
@@ -994,5 +994,5 @@
 void GraphicsWindowCocoa::checkEvents()
 {
-	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     
     while(1)
@@ -1013,5 +1013,5 @@
             break;
         [[NSApplication sharedApplication] sendEvent: event];
-    }	
+    }    
     
     if (_closeRequested)
@@ -1023,5 +1023,5 @@
     }
         
-	[pool release];
+    [pool release];
 }
 
@@ -1038,5 +1038,5 @@
 {
     if (!_realized) return false;
-	
+    
     unsigned int style(NSBorderlessWindowMask);
     
@@ -1048,6 +1048,6 @@
             style |= NSResizableWindowMask;
     }
-	NSRect rect = [_window contentRectForFrameRect: [_window frame] ];
-	GraphicsWindowCocoaWindow* new_win = [[GraphicsWindowCocoaWindow alloc] initWithContentRect: rect styleMask: style backing: NSBackingStoreBuffered defer: NO];
+    NSRect rect = [_window contentRectForFrameRect: [_window frame] ];
+    GraphicsWindowCocoaWindow* new_win = [[GraphicsWindowCocoaWindow alloc] initWithContentRect: rect styleMask: style backing: NSBackingStoreBuffered defer: NO];
     
     if (new_win) {
@@ -1062,5 +1062,5 @@
     }
     
-	return true;
+    return true;
 }
 
@@ -1071,5 +1071,5 @@
 void GraphicsWindowCocoa::grabFocus()
 {
-	[_window makeKeyAndOrderFront: nil];
+    [_window makeKeyAndOrderFront: nil];
 }
 
@@ -1080,5 +1080,5 @@
 void GraphicsWindowCocoa::grabFocusIfPointerInWindow()
 {
-	osg::notify(osg::INFO) << "GraphicsWindowCocoa :: grabFocusIfPointerInWindow not implemented yet " << std::endl;
+    osg::notify(osg::INFO) << "GraphicsWindowCocoa :: grabFocusIfPointerInWindow not implemented yet " << std::endl;
 }
 
@@ -1090,10 +1090,10 @@
 void GraphicsWindowCocoa::resizedImplementation(int x, int y, int width, int height)
 {
-	std::cout << "resized implementation" << x << " " << y << " " << width << " " << height << std::endl; 
-	GraphicsContext::resizedImplementation(x, y, width, height);
+    std::cout << "resized implementation" << x << " " << y << " " << width << " " << height << std::endl; 
+    GraphicsContext::resizedImplementation(x, y, width, height);
    
     [_context update];
     MenubarController::instance()->update();
-	getEventQueue()->windowResize(x,y,width, height, getEventQueue()->getTime());
+    getEventQueue()->windowResize(x,y,width, height, getEventQueue()->getTime());
 }
 
@@ -1106,5 +1106,5 @@
 bool GraphicsWindowCocoa::setWindowRectangleImplementation(int x, int y, int width, int height)
 {
-	DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
+    DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
     int screenLeft(0), screenTop(0);
     if (wsi) {
@@ -1131,19 +1131,19 @@
 {
 
-	DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
+    DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
     int screenLeft(0), screenTop(0);
     if (wsi) {
-		
-		// get the screen containing the window
-		unsigned int screenNdx = wsi->getScreenContaining(x,y,w,h);
-		
-		// update traits
-		_traits->screenNum = screenNdx;
-		
-		// get top left of screen
+        
+        // get the screen containing the window
+        unsigned int screenNdx = wsi->getScreenContaining(x,y,w,h);
+        
+        // update traits
+        _traits->screenNum = screenNdx;
+        
+        // get top left of screen
         wsi->getScreenTopLeft((*_traits), screenLeft, screenTop);
     }
-	
-	resized(x-screenLeft,y-screenTop,w,h);
+    
+    resized(x-screenLeft,y-screenTop,w,h);
 }
 
@@ -1155,9 +1155,9 @@
 void GraphicsWindowCocoa::setWindowName (const std::string & name)
 {
-	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     
     NSString* title = [NSString stringWithCString: name.c_str() encoding: NSUTF8StringEncoding];
-	[_window setTitle: title];
-	[title release];
+    [_window setTitle: title];
+    [title release];
     [pool release];
 }
@@ -1170,5 +1170,5 @@
 void GraphicsWindowCocoa::useCursor(bool cursorOn)
 {
-	if (_traits.valid())
+    if (_traits.valid())
         _traits->useCursor = cursorOn;
     DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
@@ -1201,5 +1201,5 @@
 void GraphicsWindowCocoa::setCursor(MouseCursor mouseCursor)
 {
-	switch (mouseCursor) 
+    switch (mouseCursor) 
     {
 
@@ -1233,5 +1233,5 @@
 {
     GLint VBL(f?1:0);
-	[_context setValues:&VBL forParameter:NSOpenGLCPSwapInterval];
+    [_context setValues:&VBL forParameter:NSOpenGLCPSwapInterval];
 }
 
@@ -1254,23 +1254,23 @@
 
 struct CocoaWindowingSystemInterface : public DarwinWindowingSystemInterface {
-	
-	CocoaWindowingSystemInterface()
-	:	DarwinWindowingSystemInterface() 
-	{
-		localPool = [[NSAutoreleasePool alloc] init];
+    
+    CocoaWindowingSystemInterface()
+    :    DarwinWindowingSystemInterface() 
+    {
+        localPool = [[NSAutoreleasePool alloc] init];
         [[NSApplication sharedApplication] setDelegate: [[CocoaAppDelegate alloc] init] ];
-	}
-	
-	virtual osg::GraphicsContext* createGraphicsContext(osg::GraphicsContext::Traits* traits) 
-	{
-		return createGraphicsContextImplementation<PixelBufferCocoa, GraphicsWindowCocoa>(traits);
-	}
-	
-	virtual ~CocoaWindowingSystemInterface() 
-	{
-		[localPool release];
-	}
-	
-	NSAutoreleasePool *localPool;
+    }
+    
+    virtual osg::GraphicsContext* createGraphicsContext(osg::GraphicsContext::Traits* traits) 
+    {
+        return createGraphicsContextImplementation<PixelBufferCocoa, GraphicsWindowCocoa>(traits);
+    }
+    
+    virtual ~CocoaWindowingSystemInterface() 
+    {
+        [localPool release];
+    }
+    
+    NSAutoreleasePool *localPool;
 
 };
Index: /OpenSceneGraph/trunk/src/osgViewer/DarwinUtils.mm
===================================================================
--- /OpenSceneGraph/trunk/src/osgViewer/DarwinUtils.mm (revision 9879)
+++ /OpenSceneGraph/trunk/src/osgViewer/DarwinUtils.mm (revision 9895)
@@ -18,36 +18,36 @@
 static inline CGRect toCGRect(NSRect nsRect)
 {
-	CGRect cgRect;
-
-	cgRect.origin.x = nsRect.origin.x;
-	cgRect.origin.y = nsRect.origin.y;
-	cgRect.size.width = nsRect.size.width;
-	cgRect.size.height = nsRect.size.height;
-
-	return cgRect;
+    CGRect cgRect;
+
+    cgRect.origin.x = nsRect.origin.x;
+    cgRect.origin.y = nsRect.origin.y;
+    cgRect.size.width = nsRect.size.width;
+    cgRect.size.height = nsRect.size.height;
+
+    return cgRect;
 }
 
 
 MenubarController::MenubarController()
-:	osg::Referenced(), 
+:    osg::Referenced(), 
     _list(), 
     _menubarShown(false),
     _mutex() 
 {
-	// the following code will query the system for the available rect on the main-display (typically the displaying showing the menubar + the dock
-
-	NSRect rect = [[[NSScreen screens] objectAtIndex: 0] visibleFrame];
-	_availRect = toCGRect(rect);
-	
-	// now we need the rect of the main-display including the menubar and the dock
-	_mainScreenBounds = CGDisplayBounds( CGMainDisplayID() );
-
-
-	// NSRect 0/0 is bottom/left, _mainScreenBounds 0/0 is top/left
-	_availRect.origin.y = _mainScreenBounds.size.height - _availRect.size.height - _availRect.origin.y;
-	
-		
-	// hide the menubar initially
-	SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
+    // the following code will query the system for the available rect on the main-display (typically the displaying showing the menubar + the dock
+
+    NSRect rect = [[[NSScreen screens] objectAtIndex: 0] visibleFrame];
+    _availRect = toCGRect(rect);
+    
+    // now we need the rect of the main-display including the menubar and the dock
+    _mainScreenBounds = CGDisplayBounds( CGMainDisplayID() );
+
+
+    // NSRect 0/0 is bottom/left, _mainScreenBounds 0/0 is top/left
+    _availRect.origin.y = _mainScreenBounds.size.height - _availRect.size.height - _availRect.origin.y;
+    
+        
+    // hide the menubar initially
+    SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
 }
 
@@ -90,14 +90,14 @@
     unsigned int windowsIntersectingMainScreen = 0;
     for(WindowList::iterator i = _list.begin(); i != _list.end(); ) {
-		WindowAdapter* wi = (*i).get();
+        WindowAdapter* wi = (*i).get();
         if (wi->valid()) {
             CGRect windowBounds;
-			wi->getWindowBounds(windowBounds);
-			
-			if (CGRectIntersectsRect(_mainScreenBounds, windowBounds))
+            wi->getWindowBounds(windowBounds);
+            
+            if (CGRectIntersectsRect(_mainScreenBounds, windowBounds))
             {
                 ++windowsIntersectingMainScreen;
                 // osg::notify(osg::ALWAYS) << "testing rect " << windowBounds.origin.x << "/" << windowBounds.origin.y << " " << windowBounds.size.width << "x" << windowBounds.size.height << std::endl;
-				// osg::notify(osg::ALWAYS) << "against      " << _availRect.origin.x << "/" << _availRect.origin.y << " " << _availRect.size.width << "x" << _availRect.size.height << std::endl;
+                // osg::notify(osg::ALWAYS) << "against      " << _availRect.origin.x << "/" << _availRect.origin.y << " " << _availRect.size.width << "x" << _availRect.size.height << std::endl;
                 // the window intersects the main-screen, does it intersect with the menubar/dock?
                 if (((_availRect.origin.y > _mainScreenBounds.origin.y) && (_availRect.origin.y > windowBounds.origin.y)) ||
@@ -133,11 +133,11 @@
 static double getDictDouble (CFDictionaryRef refDict, CFStringRef key)
 {
-	double value;
-	CFNumberRef number_value = (CFNumberRef) CFDictionaryGetValue(refDict, key);
-	if (!number_value) // if can't get a number for the dictionary
-		return -1;  // fail
-	if (!CFNumberGetValue(number_value, kCFNumberDoubleType, &value)) // or if cant convert it
-		return -1; // fail
-	return value; // otherwise return the long value
+    double value;
+    CFNumberRef number_value = (CFNumberRef) CFDictionaryGetValue(refDict, key);
+    if (!number_value) // if can't get a number for the dictionary
+        return -1;  // fail
+    if (!CFNumberGetValue(number_value, kCFNumberDoubleType, &value)) // or if cant convert it
+        return -1; // fail
+    return value; // otherwise return the long value
 }
 
@@ -145,11 +145,11 @@
 static long getDictLong(CFDictionaryRef refDict, CFStringRef key)        // const void* key?
 {
-	long value = 0;
-	CFNumberRef number_value = (CFNumberRef)CFDictionaryGetValue(refDict, key); 
-	if (!number_value) // if can't get a number for the dictionary
-		return -1;  // fail
-	if (!CFNumberGetValue(number_value, kCFNumberLongType, &value)) // or if cant convert it
-		return -1; // fail
-	return value;
+    long value = 0;
+    CFNumberRef number_value = (CFNumberRef)CFDictionaryGetValue(refDict, key); 
+    if (!number_value) // if can't get a number for the dictionary
+        return -1;  // fail
+    if (!CFNumberGetValue(number_value, kCFNumberLongType, &value)) // or if cant convert it
+        return -1; // fail
+    return value;
 }
 
@@ -158,41 +158,41 @@
 /** ctor, get a list of all attached displays */
 DarwinWindowingSystemInterface::DarwinWindowingSystemInterface() :
-	_displayCount(0),
-	_displayIds(NULL)
-{
-	ProcessSerialNumber sn = { 0, kCurrentProcess };
-	TransformProcessType(&sn,kProcessTransformToForegroundApplication);
-	SetFrontProcess(&sn);
-	
-	if( CGGetActiveDisplayList( 0, NULL, &_displayCount ) != CGDisplayNoErr )
-		osg::notify(osg::WARN) << "DarwinWindowingSystemInterface: could not get # of screens" << std::endl;
-		
-	_displayIds = new CGDirectDisplayID[_displayCount];
-	if( CGGetActiveDisplayList( _displayCount, _displayIds, &_displayCount ) != CGDisplayNoErr )
-		osg::notify(osg::WARN) << "DarwinWindowingSystemInterface: CGGetActiveDisplayList failed" << std::endl;
-	
-	}
+    _displayCount(0),
+    _displayIds(NULL)
+{
+    ProcessSerialNumber sn = { 0, kCurrentProcess };
+    TransformProcessType(&sn,kProcessTransformToForegroundApplication);
+    SetFrontProcess(&sn);
+    
+    if( CGGetActiveDisplayList( 0, NULL, &_displayCount ) != CGDisplayNoErr )
+        osg::notify(osg::WARN) << "DarwinWindowingSystemInterface: could not get # of screens" << std::endl;
+        
+    _displayIds = new CGDirectDisplayID[_displayCount];
+    if( CGGetActiveDisplayList( _displayCount, _displayIds, &_displayCount ) != CGDisplayNoErr )
+        osg::notify(osg::WARN) << "DarwinWindowingSystemInterface: CGGetActiveDisplayList failed" << std::endl;
+    
+    }
 
 /** dtor */
 DarwinWindowingSystemInterface::~DarwinWindowingSystemInterface()
 {
-	if (osg::Referenced::getDeleteHandler())
-	{
-		osg::Referenced::getDeleteHandler()->setNumFramesToRetainObjects(0);
-		osg::Referenced::getDeleteHandler()->flushAll();
-	}
-
-	if (_displayIds) delete[] _displayIds;
-	_displayIds = NULL;
+    if (osg::Referenced::getDeleteHandler())
+    {
+        osg::Referenced::getDeleteHandler()->setNumFramesToRetainObjects(0);
+        osg::Referenced::getDeleteHandler()->flushAll();
+    }
+
+    if (_displayIds) delete[] _displayIds;
+    _displayIds = NULL;
 }
 
 /** @return a CGDirectDisplayID for a ScreenIdentifier */
 CGDirectDisplayID DarwinWindowingSystemInterface::getDisplayID(const osg::GraphicsContext::ScreenIdentifier& si) {
-	if (si.screenNum < static_cast<int>(_displayCount))
-		return _displayIds[si.screenNum];
-	else {
-		osg::notify(osg::WARN) << "GraphicsWindowCarbon :: invalid screen # " << si.screenNum << ", returning main-screen instead" << std::endl;
-		return _displayIds[0];
-	}
+    if (si.screenNum < static_cast<int>(_displayCount))
+        return _displayIds[si.screenNum];
+    else {
+        osg::notify(osg::WARN) << "GraphicsWindowCarbon :: invalid screen # " << si.screenNum << ", returning main-screen instead" << std::endl;
+        return _displayIds[0];
+    }
 }
 
@@ -200,15 +200,15 @@
 unsigned int DarwinWindowingSystemInterface::getNumScreens(const osg::GraphicsContext::ScreenIdentifier& si) 
 {
-	return _displayCount;
+    return _displayCount;
 }
 
 void DarwinWindowingSystemInterface::getScreenSettings(const osg::GraphicsContext::ScreenIdentifier& si, osg::GraphicsContext::ScreenSettings & resolution)
 {
-	CGDirectDisplayID id = getDisplayID(si);
-	resolution.width = CGDisplayPixelsWide(id);
-	resolution.height = CGDisplayPixelsHigh(id);
-	resolution.colorDepth = CGDisplayBitsPerPixel(id);
-	resolution.refreshRate = getDictDouble (CGDisplayCurrentMode(id), kCGDisplayRefreshRate);        // Not tested
-	if (resolution.refreshRate<0) resolution.refreshRate = 0;
+    CGDirectDisplayID id = getDisplayID(si);
+    resolution.width = CGDisplayPixelsWide(id);
+    resolution.height = CGDisplayPixelsHigh(id);
+    resolution.colorDepth = CGDisplayBitsPerPixel(id);
+    resolution.refreshRate = getDictDouble (CGDisplayCurrentMode(id), kCGDisplayRefreshRate);        // Not tested
+    if (resolution.refreshRate<0) resolution.refreshRate = 0;
 }
 
@@ -241,9 +241,9 @@
 /** return the top left coord of a specific screen in global screen space */
 void DarwinWindowingSystemInterface::getScreenTopLeft(const osg::GraphicsContext::ScreenIdentifier& si, int& x, int& y) {
-	CGRect bounds = CGDisplayBounds( getDisplayID(si) );
-	x = static_cast<int>(bounds.origin.x);
-	y = static_cast<int>(bounds.origin.y);
-	
-	// osg::notify(osg::DEBUG_INFO) << "topleft of screen " << si.screenNum <<" " << bounds.origin.x << "/" << bounds.origin.y << std::endl;
+    CGRect bounds = CGDisplayBounds( getDisplayID(si) );
+    x = static_cast<int>(bounds.origin.x);
+    y = static_cast<int>(bounds.origin.y);
+    
+    // osg::notify(osg::DEBUG_INFO) << "topleft of screen " << si.screenNum <<" " << bounds.origin.x << "/" << bounds.origin.y << std::endl;
 }
 
@@ -253,44 +253,44 @@
 bool DarwinWindowingSystemInterface::setScreenResolution(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, unsigned int width, unsigned int height) 
 { 
-	CGDirectDisplayID displayID = getDisplayID(screenIdentifier);
-	
-	// add next line and on following line replace hard coded depth and refresh rate
-	CGRefreshRate refresh =  getDictDouble (CGDisplayCurrentMode(displayID), kCGDisplayRefreshRate);  
-	CFDictionaryRef display_mode_values =
-		CGDisplayBestModeForParametersAndRefreshRate(
-						displayID, 
-						CGDisplayBitsPerPixel(displayID), 
-						width, height,  
-						refresh,  
-						NULL);
-
-									  
-	CGDisplaySwitchToMode(displayID, display_mode_values);    
-	return true; 
+    CGDirectDisplayID displayID = getDisplayID(screenIdentifier);
+    
+    // add next line and on following line replace hard coded depth and refresh rate
+    CGRefreshRate refresh =  getDictDouble (CGDisplayCurrentMode(displayID), kCGDisplayRefreshRate);  
+    CFDictionaryRef display_mode_values =
+        CGDisplayBestModeForParametersAndRefreshRate(
+                        displayID, 
+                        CGDisplayBitsPerPixel(displayID), 
+                        width, height,  
+                        refresh,  
+                        NULL);
+
+                                      
+    CGDisplaySwitchToMode(displayID, display_mode_values);    
+    return true; 
 }
 
 /** implementation of setScreenRefreshRate */
 bool DarwinWindowingSystemInterface::setScreenRefreshRate(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, double refreshRate) { 
-	
-	boolean_t  success(false);
-	unsigned width, height;
-	getScreenResolution(screenIdentifier, width, height);
-	
-	CGDirectDisplayID displayID = getDisplayID(screenIdentifier);
-	
-	// add next line and on following line replace hard coded depth and refresh rate
-	CFDictionaryRef display_mode_values =
-		CGDisplayBestModeForParametersAndRefreshRate(
-						displayID, 
-						CGDisplayBitsPerPixel(displayID), 
-						width, height,  
-						refreshRate,  
-						&success);
-
-									  
-	if (success)
-		CGDisplaySwitchToMode(displayID, display_mode_values);    
-		
-	return (success != 0);
+    
+    boolean_t  success(false);
+    unsigned width, height;
+    getScreenResolution(screenIdentifier, width, height);
+    
+    CGDirectDisplayID displayID = getDisplayID(screenIdentifier);
+    
+    // add next line and on following line replace hard coded depth and refresh rate
+    CFDictionaryRef display_mode_values =
+        CGDisplayBestModeForParametersAndRefreshRate(
+                        displayID, 
+                        CGDisplayBitsPerPixel(displayID), 
+                        width, height,  
+                        refreshRate,  
+                        &success);
+
+                                      
+    if (success)
+        CGDisplaySwitchToMode(displayID, display_mode_values);    
+        
+    return (success != 0);
 }
 
@@ -298,19 +298,19 @@
 unsigned int DarwinWindowingSystemInterface::getScreenContaining(int x, int y, int w, int h)
 {
-	CGRect rect = CGRectMake(x,y,w,h);
-	for(unsigned int i = 0; i < _displayCount; ++i) {
-		CGRect bounds = CGDisplayBounds( getDisplayID(i) );
-		if (CGRectIntersectsRect(bounds, rect)) {
-			return i;
-		}
-	}
-	
-	return 0;
-}
-
-
-
-
-
-
-}
+    CGRect rect = CGRectMake(x,y,w,h);
+    for(unsigned int i = 0; i < _displayCount; ++i) {
+        CGRect bounds = CGDisplayBounds( getDisplayID(i) );
+        if (CGRectIntersectsRect(bounds, rect)) {
+            return i;
+        }
+    }
+    
+    return 0;
+}
+
+
+
+
+
+
+}
