[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53663] trunk/blender/intern/ghost/intern/ GHOST_WindowCocoa.mm: Macbook HiDPI support: reshuffled code to make it compile for 10.6 and work

Ton Roosendaal ton at blender.org
Tue Jan 8 18:27:15 CET 2013


Revision: 53663
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53663
Author:   ton
Date:     2013-01-08 17:27:11 +0000 (Tue, 08 Jan 2013)
Log Message:
-----------
Macbook HiDPI support: reshuffled code to make it compile for 10.6 and work
in 10.7 and later. OS X Gurus might check though :)

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2013-01-08 16:56:04 UTC (rev 53662)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2013-01-08 17:27:11 UTC (rev 53663)
@@ -428,6 +428,13 @@
 
 #pragma mark initialization / finalization
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
+ at interface NSView (NSOpenGLSurfaceResolution)
+- (BOOL)wantsBestResolutionOpenGLSurface;
+- (void)setWantsBestResolutionOpenGLSurface;
+ at end
+#endif
+
 NSOpenGLContext* GHOST_WindowCocoa::s_firstOpenGLcontext = nil;
 
 GHOST_WindowCocoa::GHOST_WindowCocoa(
@@ -579,13 +586,15 @@
 	setDrawingContextType(type);
 	updateDrawingContext();
 	activateDrawingContext();
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070	// retina support started with 10.7.4 afaik
+
 	if (m_systemCocoa->m_nativePixel) {
-		[m_openGLView setWantsBestResolutionOpenGLSurface:YES];
-		NSRect backingBounds = [m_openGLView convertRectToBacking:[m_openGLView bounds]];
-		m_systemCocoa->m_nativePixelSize = (float)backingBounds.size.width / (float)rect.size.width;
+		if ([m_openGLView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {
+			[m_openGLView setWantsBestResolutionOpenGLSurface:YES];
+		
+			NSRect backingBounds = [m_openGLView convertRectToBacking:[m_openGLView bounds]];
+			m_systemCocoa->m_nativePixelSize = (float)backingBounds.size.width / (float)rect.size.width;
+		}
 	}
-#endif
 	
 	m_tablet.Active = GHOST_kTabletModeNone;
 	




More information about the Bf-blender-cvs mailing list