From: Mark Sibly Date: Mon, 21 Sep 2015 03:18:39 +0000 (+1200) Subject: Updated test system.macos.m X-Git-Tag: v151~3 X-Git-Url: https://jcornell.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=7fda1db11ca710f14a3feae36a5549d716f4a5a7;p=blitzmax.git Updated test system.macos.m --- diff --git a/mod/brl.mod/system.mod/_system.macos.m b/mod/brl.mod/system.mod/_system.macos.m index af1da7d..be1b104 100644 --- a/mod/brl.mod/system.mod/_system.macos.m +++ b/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];