Parcourir la source

Updated test system.macos.m

Mark Sibly il y a 10 ans
Parent
commit
7fda1db11c
1 fichiers modifiés avec 19 ajouts et 22 suppressions
  1. 19 22
      mod/brl.mod/system.mod/_system.macos.m

+ 19 - 22
mod/brl.mod/system.mod/_system.macos.m

@@ -154,40 +154,37 @@ static int mouseViewPos( NSView *view,int *x,int *y ){
 	NSRect rect;
 	NSPoint point;
 	NSWindow *window;
-
-	if( displayCaptured ){
 	
-		Point point;
+	if( !view ){
+
+		NSPoint point;
+		NSRect frame;
 		CGLContextObj gl;
 		
-		GetMouse( &point );
+		point=[NSEvent mouseLocation];
+		frame=[[NSScreen mainScreen] frame];
 
-		if( gl=CGLGetCurrentContext() ){
+		point.y=frame.size.height-point.y-1;
 		
+		//yurk...
+		if( gl=CGLGetCurrentContext() ){
+
 			GLint enabled=0;
-			CGLIsEnabled( gl,kCGLCESurfaceBackingSize,&enabled );
-			
-			if( enabled ){
+			if( !CGLIsEnabled( gl,kCGLCESurfaceBackingSize,&enabled ) && enabled ){
 			
-				NSRect frame;
-				GLint size[2];
+				GLint size[2]={0,0};
+				if( !CGLGetParameter( gl,kCGLCPSurfaceBackingSize,size ) ){
 				
-				frame=[[NSScreen mainScreen] frame];
-				CGLGetParameter( gl,kCGLCPSurfaceBackingSize,size );
-				
-				*x=point.h * size[0] / frame.size.width;
-				*y=point.v * size[1] / frame.size.height;
-				return 1;
-			} 
+					point.x=point.x*size[0]/frame.size.width;
+					point.y=point.y*size[1]/frame.size.height;
+				}
+			}
 		}
-		
-		*x=point.h;
-		*y=point.v;
+		*x=point.x;
+		*y=point.y;
 		return 1;
 	}
 	
-	if( !view ) return *x=*y=0;
-	
 	window=[view window];
 	point=[window mouseLocationOutsideOfEventStream];
 	rect=[view bounds];