From: <ka...@us...> - 2011-10-11 21:51:51
|
Revision: 3659 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3659&view=rev Author: kappa1 Date: 2011-10-11 21:51:45 +0000 (Tue, 11 Oct 2011) Log Message: ----------- Remove the use of Properties from Objective C code to allow binary compatibility on OS X < 10.5 Modified Paths: -------------- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m Modified: trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m =================================================================== --- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2011-10-11 19:24:55 UTC (rev 3658) +++ trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2011-10-11 21:51:45 UTC (rev 3659) @@ -55,8 +55,12 @@ BOOL canDraw; } -@property (nonatomic) MacOSXPeerInfo *peer_info; -@property (nonatomic) GLuint textureID; +- (MacOSXPeerInfo*) peer_info; +- (GLuint) textureID; + +- (void) setPeer_info: (MacOSXPeerInfo*)input; +- (void) setTextureID: (GLuint)input; + @end @@ -118,8 +122,8 @@ // rotates a red square when asked to draw @implementation PBufferGLLayer -@synthesize peer_info; -@synthesize textureID; +//@synthesize peer_info; +//@synthesize textureID; // override to draw custom GL content -(void)drawInCGLContext:(CGLContextObj)glContext @@ -191,4 +195,20 @@ return peer_info->canDrawGL ? YES : NO; } +- (MacOSXPeerInfo*) peer_info { + return peer_info; +} + +- (GLuint) textureID { + return textureID; +} + +- (void) setPeer_info: (MacOSXPeerInfo*)input { + peer_info = input; +} + +- (void) setTextureID: (GLuint)input { + textureID = input; +} + @end \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2011-10-21 22:51:00
|
Revision: 3684 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3684&view=rev Author: kappa1 Date: 2011-10-21 22:50:54 +0000 (Fri, 21 Oct 2011) Log Message: ----------- Fix crash on Mac OS X when using Display.setParent() and switching from fullscreen to windowed mode. Modified Paths: -------------- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m Modified: trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m =================================================================== --- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2011-10-20 10:36:42 UTC (rev 3683) +++ trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2011-10-21 22:50:54 UTC (rev 3684) @@ -52,7 +52,6 @@ @interface PBufferGLLayer : NSOpenGLLayer { MacOSXPeerInfo *peer_info; GLuint textureID; - BOOL canDraw; } - (MacOSXPeerInfo*) peer_info; @@ -78,7 +77,7 @@ jint width = surface->dsi->bounds.width; jint height = surface->dsi->bounds.height; - if(peer_info->pbuffer == NULL || width != [peer_info->pbuffer pixelsWide] || height != [peer_info->pbuffer pixelsHigh]) { + if(peer_info->pbuffer == NULL || peer_info->window || width != [peer_info->pbuffer pixelsWide] || height != [peer_info->pbuffer pixelsHigh]) { if(peer_info->pbuffer != NULL) { [peer_info->pbuffer release]; } @@ -193,7 +192,7 @@ pixelFormat:(CGLPixelFormatObj)pixelFormat forLayerTime:(CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp { - return peer_info->canDrawGL ? YES : NO; + return (peer_info->canDrawGL && !peer_info->window) ? YES : NO; } - (MacOSXPeerInfo*) peer_info { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2011-11-12 19:01:34
|
Revision: 3691 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3691&view=rev Author: kappa1 Date: 2011-11-12 19:01:28 +0000 (Sat, 12 Nov 2011) Log Message: ----------- MacOS: remove the use of 'Blocks' in the Cocoa native code by switching to 'Selectors', should allow natives to be binary compatible with OS X 10.5 now. Modified Paths: -------------- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m Modified: trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m =================================================================== --- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2011-11-10 18:46:43 UTC (rev 3690) +++ trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2011-11-12 19:01:28 UTC (rev 3691) @@ -62,7 +62,22 @@ @end +// forward declaration +@interface AttachLayerOnMainThread : NSObject { + MacOSXPeerInfo *peer_info; + JAWT_MacOSXDrawingSurfaceInfo *macosx_dsi; +} +- (void) attachLayer; + +- (MacOSXPeerInfo*) peer_info; +- (JAWT_MacOSXDrawingSurfaceInfo) macosx_dsi; + +- (void) setPeer_info: (MacOSXPeerInfo*)input; +- (void) setMacosx_dsi: (JAWT_MacOSXDrawingSurfaceInfo*)input; + +@end + JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle, jboolean allowCALayer) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; @@ -97,18 +112,15 @@ } if (macosx_dsi != NULL) { - [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ - // attach the "root layer" to the AWT Canvas surface layers - id <JAWT_SurfaceLayers> surfaceLayers = (id <JAWT_SurfaceLayers>)macosx_dsi;//dsi->platformInfo; - if(surfaceLayers.layer == NULL) { - PBufferGLLayer *caGLLayer = [[PBufferGLLayer new] autorelease]; - caGLLayer.peer_info = peer_info; - caGLLayer.asynchronous = YES; - caGLLayer.needsDisplayOnBoundsChange = YES; - caGLLayer.opaque = YES; - surfaceLayers.layer = caGLLayer; - } - }]; + + AttachLayerOnMainThread *attachLayerOnMainThread = [[AttachLayerOnMainThread new] autorelease]; + attachLayerOnMainThread.peer_info = peer_info; + attachLayerOnMainThread.macosx_dsi = macosx_dsi; + + [JNFRunLoop performOnMainThread:@selector(attachLayer) + on:attachLayerOnMainThread + withObject:nil + waitUntilDone:YES]; } [pool release]; @@ -122,6 +134,40 @@ [pool release]; } +// Object class to CALayer on AppKit Thread +@implementation AttachLayerOnMainThread + +- (void) attachLayer { + // attach the "root layer" to the AWT Canvas surface layers + id <JAWT_SurfaceLayers> surfaceLayers = (id <JAWT_SurfaceLayers>)macosx_dsi;//dsi->platformInfo; + if(surfaceLayers.layer == NULL) { + PBufferGLLayer *caGLLayer = [[PBufferGLLayer new] autorelease]; + caGLLayer.peer_info = peer_info; + caGLLayer.asynchronous = YES; + caGLLayer.needsDisplayOnBoundsChange = YES; + caGLLayer.opaque = YES; + surfaceLayers.layer = caGLLayer; + } +} + +- (MacOSXPeerInfo*) peer_info { + return peer_info; +} + +- (JAWT_MacOSXDrawingSurfaceInfo*) macosx_dsi { + return macosx_dsi; +} + +- (void) setPeer_info: (MacOSXPeerInfo*)input { + peer_info = input; +} + +- (void) setMacosx_dsi: (JAWT_MacOSXDrawingSurfaceInfo*)input { + macosx_dsi = input; +} + +@end + // rotates a red square when asked to draw @implementation PBufferGLLayer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2012-01-13 00:40:50
|
Revision: 3723 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3723&view=rev Author: kappa1 Date: 2012-01-13 00:40:43 +0000 (Fri, 13 Jan 2012) Log Message: ----------- OS X slight tweak to MacOSXCanvasPeerInfo in prep to make it compatible for 10.5 again Modified Paths: -------------- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m Modified: trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m =================================================================== --- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2012-01-11 20:46:57 UTC (rev 3722) +++ trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2012-01-13 00:40:43 UTC (rev 3723) @@ -48,21 +48,6 @@ #include "context.h" #include "common_tools.h" -// forward declaration -@interface PBufferGLLayer : NSOpenGLLayer { - MacOSXPeerInfo *peer_info; - GLuint textureID; -} - -- (MacOSXPeerInfo*) peer_info; -- (GLuint) textureID; - -- (void) setPeer_info: (MacOSXPeerInfo*)input; -- (void) setTextureID: (GLuint)input; - -@end - -// forward declaration @interface AttachLayerOnMainThread : NSObject { MacOSXPeerInfo *peer_info; JAWT_MacOSXDrawingSurfaceInfo *macosx_dsi; @@ -134,6 +119,19 @@ [pool release]; } +@interface PBufferGLLayer : NSOpenGLLayer { + MacOSXPeerInfo *peer_info; + GLuint textureID; +} + +- (MacOSXPeerInfo*) peer_info; +- (GLuint) textureID; + +- (void) setPeer_info: (MacOSXPeerInfo*)input; +- (void) setTextureID: (GLuint)input; + +@end + // Object class to CALayer on AppKit Thread @implementation AttachLayerOnMainThread This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |