changeset 4725:f977c4806f4c

Merge
author michaelm
date Wed, 01 Feb 2012 04:45:04 -0800
parents 391dafd30fba 9824fb300575
children 8878d25cce64
files
diffstat 14 files changed, 133 insertions(+), 429 deletions(-) [+]
line wrap: on
line diff
--- a/make/sun/lwawt/Makefile	Wed Feb 01 04:43:47 2012 -0800
+++ b/make/sun/lwawt/Makefile	Wed Feb 01 04:45:04 2012 -0800
@@ -82,7 +82,6 @@
 	-framework JavaNativeFoundation \
 	-framework JavaRuntimeSupport \
 	-framework OpenGL \
-	-framework IOSurface \
         -framework QuartzCore
 CPPFLAGS += \
         -I$(CLASSHDRDIR) \
--- a/src/macosx/classes/com/apple/laf/AquaInternalFrameUI.java	Wed Feb 01 04:43:47 2012 -0800
+++ b/src/macosx/classes/com/apple/laf/AquaInternalFrameUI.java	Wed Feb 01 04:45:04 2012 -0800
@@ -256,19 +256,16 @@
         return map;
     }
 
-    public Dimension minimumLayoutSize(final Container c) {
-        // The minimum size of the internal frame only takes into account the
-        // title pane since you are allowed to resize the frames to the point
-        // where just the title pane is visible.
-        Dimension result = new Dimension();
-        if (getNorthPane() != null) {
-            result = new Dimension(getNorthPane().getMinimumSize());
+    public Dimension getPreferredSize(JComponent x) {
+        Dimension preferredSize = super.getMinimumSize(x);
+        Dimension minimumSize = frame.getMinimumSize();
+        if (preferredSize.width < minimumSize.width) {
+            preferredSize.width = minimumSize.width;
         }
-        final Insets i = frame.getInsets();
-        result.width += i.left + i.right;
-        result.height += i.top + i.bottom;
-
-        return result;
+        if (preferredSize.height < minimumSize.height) {
+            preferredSize.height = minimumSize.height;
+        }
+        return preferredSize;
     }
 
     public void setNorthPane(final JComponent c) {
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Feb 01 04:43:47 2012 -0800
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Feb 01 04:45:04 2012 -0800
@@ -225,15 +225,15 @@
     }
 
     @Override
-    public void setVisible(final boolean v) {
+    public void setVisible(final boolean visible) {
         if (getSurfaceData() == null) {
             replaceSurfaceData();
         }
 
-        if (isVisible() == v) {
+        if (isVisible() == visible) {
             return;
         }
-        super.setVisible(v);
+        super.setVisible(visible);
 
         // TODO: update graphicsConfig, see 4868278
         // TODO: don't notify the delegate if our visibility is unchanged
@@ -247,10 +247,23 @@
         SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
-                platformWindow.setVisible(v);
+                platformWindow.setVisible(visible);
                 if (isSimpleWindow()) {
-                    updateFocusableWindowState();
-                    changeFocusedWindow(v, v);
+                    LWKeyboardFocusManagerPeer manager = LWKeyboardFocusManagerPeer.
+                        getInstance(getAppContext());
+
+                    if (visible) {
+                        updateFocusableWindowState();
+                        changeFocusedWindow(true, true);
+
+                    // Focus the owner in case this window is focused.
+                    } else if (manager.getCurrentFocusedWindow() == getTarget()) {
+                        LWWindowPeer owner = getOwnerFrameDialog(LWWindowPeer.this);
+                        if (owner != null) {
+                            // KFM will do all the rest.
+                            owner.changeFocusedWindow(true, false);
+                        }
+                    }
                 }
             }
         });
@@ -617,7 +630,7 @@
     public void notifyNCMouseDown() {
         // Ungrab except for a click on a Dialog with the grabbing owner
         if (grabbingWindow != null &&
-            grabbingWindow.getTarget() != getOwnerFrameDialog(this))
+            grabbingWindow != getOwnerFrameDialog(this))
         {
             grabbingWindow.ungrab();
         }
@@ -714,7 +727,7 @@
 
                 // Ungrab only if this window is not an owned window of the grabbing one.
                 if (!isGrabbing() && grabbingWindow != null &&
-                    grabbingWindow.getTarget() != getOwnerFrameDialog(this))
+                    grabbingWindow != getOwnerFrameDialog(this))
                 {
                     grabbingWindow.ungrab();
                 }
@@ -1073,14 +1086,13 @@
 
         // Make the owner active window.
         if (isSimpleWindow()) {
-            Window owner = getOwnerFrameDialog(this);
-            LWWindowPeer ownerPeer = (owner != null ? (LWWindowPeer)owner.getPeer() : null);
+            LWWindowPeer owner = getOwnerFrameDialog(this);
 
             // If owner is not natively active, request native
             // activation on it w/o sending events up to java.
-            if (ownerPeer != null && !ownerPeer.platformWindow.isActive()) {
+            if (owner != null && !owner.platformWindow.isActive()) {
                 if (focusLog.isLoggable(PlatformLogger.FINE)) {
-                    focusLog.fine("requesting native focus to the owner " + ownerPeer);
+                    focusLog.fine("requesting native focus to the owner " + owner);
                 }
                 LWWindowPeer currentActivePeer = (currentActive != null ?
                     (LWWindowPeer)currentActive.getPeer() : null);
@@ -1092,9 +1104,9 @@
                     }
                     currentActivePeer.skipNextFocusChange = true;
                 }
-                ownerPeer.skipNextFocusChange = true;
+                owner.skipNextFocusChange = true;
 
-                ownerPeer.platformWindow.requestWindowFocus();
+                owner.platformWindow.requestWindowFocus();
             }
 
             // DKFM will synthesize all the focus/activation events correctly.
@@ -1158,7 +1170,7 @@
         // - when the opposite (gaining focus) window is an owned/owner window.
         // - for a simple window in any case.
         if (!becomesFocused &&
-            (isGrabbing() || getOwnerFrameDialog(grabbingWindow) == getTarget()))
+            (isGrabbing() || getOwnerFrameDialog(grabbingWindow) == this))
         {
             focusLog.fine("ungrabbing on " + grabbingWindow);
             // ungrab a simple window if its owner looses activation.
@@ -1174,12 +1186,12 @@
         postEvent(windowEvent);
     }
 
-    private static Window getOwnerFrameDialog(LWWindowPeer peer) {
+    private static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) {
         Window owner = (peer != null ? peer.getTarget().getOwner() : null);
         while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) {
             owner = owner.getOwner();
         }
-        return owner;
+        return owner != null ? (LWWindowPeer)owner.getPeer() : null;
     }
 
     /**
--- a/src/macosx/native/sun/awt/AWTView.m	Wed Feb 01 04:43:47 2012 -0800
+++ b/src/macosx/native/sun/awt/AWTView.m	Wed Feb 01 04:45:04 2012 -0800
@@ -87,37 +87,30 @@
         [self.layer addSublayer: (CALayer *)cglLayer];
         [self setLayerContentsRedrawPolicy: NSViewLayerContentsRedrawDuringViewResize];
         [self setLayerContentsPlacement: NSViewLayerContentsPlacementTopLeft];
-        [self setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable];    
+        [self setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable];
+        
+#ifdef REMOTELAYER
+        CGLLayer *parentLayer = (CGLLayer*)self.cglLayer;
+        parentLayer.parentLayer = NULL;
+        parentLayer.remoteLayer = NULL;
+        if (JRSRemotePort != 0 && remoteSocketFD > 0) {
+            CGLLayer *remoteLayer = [[CGLLayer alloc] initWithJavaLayer: parentLayer.javaLayer];
+            remoteLayer.target = GL_TEXTURE_2D;
+            NSLog(@"Creating Parent=%p, Remote=%p", parentLayer, remoteLayer);
+            parentLayer.remoteLayer = remoteLayer;
+            remoteLayer.parentLayer = parentLayer;
+            remoteLayer.remoteLayer = NULL;
+            remoteLayer.jrsRemoteLayer = [remoteLayer createRemoteLayerBoundTo:JRSRemotePort];
+            CFRetain(remoteLayer);  // REMIND
+            remoteLayer.frame = CGRectMake(0, 0, 720, 500); // REMIND
+            CFRetain(remoteLayer.jrsRemoteLayer); // REMIND
+            int layerID = [remoteLayer.jrsRemoteLayer layerID];
+            NSLog(@"layer id to send = %d", layerID);
+            sendLayerID(layerID);
+        }
+#endif /* REMOTELAYER */        
     }
-    
-#if USE_INTERMEDIATE_BUFFER
-    self.cglLayer = windowLayer;
-    [self setWantsLayer: YES];
-    [self.layer addSublayer: (CALayer *)cglLayer];
-    [self setLayerContentsRedrawPolicy: NSViewLayerContentsRedrawDuringViewResize];
-    [self setLayerContentsPlacement: NSViewLayerContentsPlacementTopLeft];
-    [self setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable];
-#ifdef REMOTELAYER
-    CGLLayer *parentLayer = (CGLLayer*)self.cglLayer;
-    parentLayer.parentLayer = NULL;
-    parentLayer.remoteLayer = NULL;
-    if (JRSRemotePort != 0 && remoteSocketFD > 0) {
-        CGLLayer *remoteLayer = [CGLLayer layer];
-        remoteLayer.target = GL_TEXTURE_2D;
-        NSLog(@"Creating Parent=%p, Remote=%p", parentLayer, remoteLayer);
-        parentLayer.remoteLayer = remoteLayer;
-        remoteLayer.parentLayer = parentLayer;
-        remoteLayer.remoteLayer = NULL;
-        remoteLayer.jrsRemoteLayer = [remoteLayer createRemoteLayerBoundTo:JRSRemotePort];
-        CFRetain(remoteLayer);  // REMIND
-        remoteLayer.frame = CGRectMake(0, 0, 720, 500); // REMIND
-        CFRetain(remoteLayer.jrsRemoteLayer); // REMIND
-        int layerID = [remoteLayer.jrsRemoteLayer layerID];
-        NSLog(@"layer id to send = %d", layerID);
-        sendLayerID(layerID);
-    }
-#endif /* REMOTELAYER */
-#endif
+
     return self;
 }
 
@@ -125,9 +118,6 @@
 AWT_ASSERT_APPKIT_THREAD;
 
     self.cglLayer = nil;
-#if USE_INTERMEDIATE_BUFFER
-    self.cglLayer = nil;
-#endif
 
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     (*env)->DeleteGlobalRef(env, m_cPlatformView);
@@ -372,6 +362,11 @@
                                        assumeInside:NO];
 }
 
+- (void)updateTrackingAreas {
+    [super updateTrackingAreas];
+    [self resetTrackingRect];
+}
+
 - (void) resetCursorRects {
     [super resetCursorRects];
     [self resetTrackingRect];
--- a/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.h	Wed Feb 01 04:43:47 2012 -0800
+++ b/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.h	Wed Feb 01 04:45:04 2012 -0800
@@ -36,23 +36,6 @@
 + (void) _getCGLConfigInfo: (NSMutableArray *)argValue;
 @end
 
-// Prototyped CAOpenGLLayer drawing directly from Java2D OpenGL rendering
-// pipe fails to draw entire scene. So, the following enables alternative
-// codepath that uses a FBO backed with a texture as an intermediate buffer.
-// Java2D OpenGL rendering pipe performs rendering to the intermediate buffer
-// and CAOpenGLLayer copies the entire intermediate buffer to layer.
-
-// The prototype implementation creates a CAOpenGLLayer tied to a NSView/NSWindow.
-// To provide purely offscreen CAOpenGLLayer, disable the prototype and
-// enable the alternative codepath implemented as a part of MACOSX_PORT-766.
-//#define USE_INTERMEDIATE_BUFFER 1
-
-// Uncomment the next line to enable using IO Surface based drawing.
-// It has to be used *in conjunction* with USE_INTERMEDIATE_BUFFERS
-// It presently has more artifacts than the straight 2D texture drawing
-// but both seem to have some of the same issues.
-//#define USE_IOS 1
-
 // REMIND: Using an NSOpenGLPixelBuffer as the scratch surface has been
 // problematic thus far (seeing garbage and flickering when switching
 // between an NSView and the scratch surface), so the following enables
@@ -61,8 +44,8 @@
 // situations.  It appears that calling [NSOpenGLContext setView] too
 // frequently contributes to the bad behavior, so we should try to avoid
 // switching to the scratch surface whenever possible.
-#ifndef USE_IOS
-/* Do we we need this if we are using all off-screen drawing ? */
+
+/* Do we need this if we are using all off-screen drawing ? */
 #define USE_NSVIEW_FOR_SCRATCH 1
 
 /* Uncomment to have an additional CAOGLLayer instance tied to
@@ -72,9 +55,7 @@
  * This is only for testing purposes and can be removed if/when no
  * longer needed.
  */
-//#ifdef USE_INTERMEDIATE_BUFFER
 //#define REMOTELAYER 1
-//#endif
 
 #ifdef REMOTELAYER
 #import <JavaRuntimeSupport/JRSRemoteLayer.h>
@@ -90,9 +71,6 @@
 
 #endif /* REMOTELAYER */
 
-#endif
-
-
 
 /**
  * The CGLGraphicsConfigInfo structure contains information specific to a
--- a/src/macosx/native/sun/java2d/opengl/CGLLayer.h	Wed Feb 01 04:43:47 2012 -0800
+++ b/src/macosx/native/sun/java2d/opengl/CGLLayer.h	Wed Feb 01 04:45:04 2012 -0800
@@ -31,7 +31,7 @@
 @interface CGLLayer : CAOpenGLLayer
 {
 @private
-    jobject javaLayer;
+    JNFJObjectWrapper *javaLayer;
 
     // intermediate buffer, used the RQ lock to synchronize
     GLuint textureID;
@@ -45,6 +45,7 @@
 #endif /* REMOTELAYER */
 }
 
+@property (nonatomic, retain) JNFJObjectWrapper *javaLayer;
 @property (readwrite, assign) GLuint textureID;
 @property (readwrite, assign) GLenum target;
 @property (readwrite, assign) float textureWidth;
@@ -56,7 +57,7 @@
 @property (nonatomic, retain) NSObject<JRSRemoteLayer> *jrsRemoteLayer;
 #endif
 
-- (id) initWithJavaLayer:(jobject)javaLayer;
+- (id) initWithJavaLayer:(JNFJObjectWrapper *)javaLayer;
 - (void) blitTexture;
 @end
 
--- a/src/macosx/native/sun/java2d/opengl/CGLLayer.m	Wed Feb 01 04:43:47 2012 -0800
+++ b/src/macosx/native/sun/java2d/opengl/CGLLayer.m	Wed Feb 01 04:45:04 2012 -0800
@@ -35,6 +35,7 @@
 
 @implementation CGLLayer
 
+@synthesize javaLayer;
 @synthesize textureID;
 @synthesize target;
 @synthesize textureWidth;
@@ -45,14 +46,14 @@
 @synthesize jrsRemoteLayer;
 #endif
 
-- (id) initWithJavaLayer:(jobject)layer;
+- (id) initWithJavaLayer:(JNFJObjectWrapper *)layer;
 {
 AWT_ASSERT_APPKIT_THREAD;
     // Initialize ourselves
     self = [super init];
     if (self == nil) return self;
 
-    javaLayer = layer;
+    self.javaLayer = layer;
     
     // NOTE: async=YES means that the layer is re-cached periodically
     self.asynchronous = FALSE;
@@ -65,11 +66,8 @@
     return self;
 }
 
-- (void) dealloc {
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
-    (*env)->DeleteGlobalRef(env, javaLayer);
-    javaLayer = NULL;
-    
+- (void) dealloc {    
+    self.javaLayer = nil;
     [super dealloc];
 }
 
@@ -114,7 +112,7 @@
 -(void)drawInCGLContext:(CGLContextObj)glContext pixelFormat:(CGLPixelFormatObj)pixelFormat forLayerTime:(CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp
 {
     AWT_ASSERT_APPKIT_THREAD;
-
+    
     // Set the current context to the one given to us.
     CGLSetCurrentContext(glContext);
 
@@ -123,7 +121,10 @@
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     static JNF_CLASS_CACHE(jc_JavaLayer, "sun/java2d/opengl/CGLLayer");
     static JNF_MEMBER_CACHE(jm_drawInCGLContext, jc_JavaLayer, "drawInCGLContext", "()V");
-    JNFCallVoidMethod(env, javaLayer, jm_drawInCGLContext);
+
+    jobject javaLayerLocalRef = [self.javaLayer jObjectWithEnv:env];
+    JNFCallVoidMethod(env, javaLayerLocalRef, jm_drawInCGLContext);
+    (*env)->DeleteLocalRef(env, javaLayerLocalRef);
 
     // Call super to finalize the drawing. By default all it does is call glFlush().
     [super drawInCGLContext:glContext pixelFormat:pixelFormat forLayerTime:timeInterval displayTime:timeStamp];
@@ -147,7 +148,7 @@
 JNF_COCOA_ENTER(env);
 AWT_ASSERT_NOT_APPKIT_THREAD;
 
-    jobject javaLayer = (*env)->NewGlobalRef(env, obj);
+    JNFJObjectWrapper *javaLayer = [JNFJObjectWrapper wrapperWithJObject:obj withEnv:env];
     
     [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
         AWT_ASSERT_APPKIT_THREAD;
--- a/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.h	Wed Feb 01 04:43:47 2012 -0800
+++ b/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.h	Wed Feb 01 04:45:04 2012 -0800
@@ -26,8 +26,6 @@
 #ifndef CGLSurfaceData_h_Included
 #define CGLSurfaceData_h_Included
 
-#import <IOSurface/IOSurface.h>
-
 #import "OGLSurfaceData.h"
 #import "CGLGraphicsConfig.h"
 #import "AWTWindow.h"
@@ -43,7 +41,6 @@
     GLclampf              argb[4]; // background clear color
     NSOpenGLPixelBuffer   *pbuffer;
     CGLGraphicsConfigInfo *configInfo;
-    IOSurfaceRef          surfaceRef;
 } CGLSDOps;
 
 #endif /* CGLSurfaceData_h_Included */
--- a/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m	Wed Feb 01 04:43:47 2012 -0800
+++ b/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m	Wed Feb 01 04:45:04 2012 -0800
@@ -132,27 +132,11 @@
             cglsdo->pbuffer = NULL;
         }
     } else if (oglsdo->drawableType == OGLSD_WINDOW) {
-#if USE_INTERMEDIATE_BUFFER
-        // REMIND: duplicates code in OGLSD_Delete invoked from the Dispose thread
-        if (oglsdo->textureID != 0) {
-            j2d_glDeleteTextures(1, &oglsdo->textureID);
-            oglsdo->textureID = 0;
-        }
-        if (oglsdo->depthID != 0) {
-            j2d_glDeleteRenderbuffersEXT(1, &oglsdo->depthID);
-            oglsdo->depthID = 0;
-        }
-        if (oglsdo->fbobjectID != 0) {
-            j2d_glDeleteFramebuffersEXT(1, &oglsdo->fbobjectID);
-            oglsdo->fbobjectID = 0;
-        }
-#else
         // detach the NSView from the NSOpenGLContext
         CGLGraphicsConfigInfo *cglInfo = cglsdo->configInfo;
         OGLContext *oglc = cglInfo->context;
         CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo;
         [ctxinfo->context clearDrawable];
-#endif
     }
 
     oglsdo->drawableType = OGLSD_UNDEFINED;
@@ -279,13 +263,7 @@
         // this means that all rendering will go into the fbobject destination
         // (note that we unbind the currently bound texture first; this is
         // recommended procedure when binding an fbobject)
-#ifndef USE_IOS
         j2d_glBindTexture(GL_TEXTURE_2D, 0);
-#else
-        GLenum target = GL_TEXTURE_RECTANGLE_ARB;
-        j2d_glBindTexture(target, 0);
-        j2d_glDisable(target);
-#endif
         j2d_glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, dstOps->fbobjectID);
 
         return oglc;
@@ -303,16 +281,6 @@
                 mipMapLevel: 0
                 currentVirtualScreen: [ctxinfo->context currentVirtualScreen]];
     } else {
-#if USE_INTERMEDIATE_BUFFER
-#ifndef USE_IOS
-        j2d_glBindTexture(GL_TEXTURE_2D, 0);
-#else
-    GLenum target = GL_TEXTURE_RECTANGLE_ARB;
-    j2d_glBindTexture(target, 0);
-    j2d_glDisable(target);
-#endif
-        j2d_glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, dstOps->fbobjectID);
-#else
         CGLSDOps *cglsdo = (CGLSDOps *)dstOps->privOps;
         NSView *nsView = (NSView *)cglsdo->peerData;
 
@@ -320,17 +288,14 @@
             [ctxinfo->context makeCurrentContext];
             [ctxinfo->context setView: nsView];
         }
-#endif
     }
 
-#ifndef USE_INTERMEDIATE_BUFFER
     if (OGLC_IS_CAP_PRESENT(oglc, CAPS_EXT_FBOBJECT)) {
         // the GL_EXT_framebuffer_object extension is present, so we
         // must bind to the default (windowing system provided)
         // framebuffer
         j2d_glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
     }
-#endif
 
     if ((srcOps != dstOps) && (srcOps->drawableType == OGLSD_PBUFFER)) {
         // bind pbuffer to the render texture object (since we are preparing
@@ -348,202 +313,6 @@
 }
 
 /**
- * Returns true if OpenGL textures can have non-power-of-two dimensions
- * when using the basic GL_TEXTURE_2D target.
- */
-BOOL isTexNonPow2Available(CGLGraphicsConfigInfo *cglinfo) {
-    jint caps;
-    if ((cglinfo == NULL) || (cglinfo->context == NULL)) {
-        return FALSE;
-    } else {
-        caps = cglinfo->context->caps;
-    }
-    return ((caps & CAPS_TEXNONPOW2) != 0);
-}
-
-/**
- * Returns true if OpenGL textures can have non-power-of-two dimensions
- * when using the GL_TEXTURE_RECTANGLE_ARB target (only available when the
- * GL_ARB_texture_rectangle extension is present).
- */
-BOOL isTexRectAvailable(CGLGraphicsConfigInfo *cglinfo) {
-    jint caps;
-    if ((cglinfo == NULL) || (cglinfo->context == NULL)) {
-        return FALSE;
-    } else {
-        caps = cglinfo->context->caps;
-    }
-    return ((caps & CAPS_EXT_TEXRECT) != 0);
-}
-
-/**
- * Recreates the intermediate buffer associated with the given OGLSDOps
- * and with the buffer's new size specified in OGLSDOps.
- */
-jboolean RecreateBuffer(JNIEnv *env, OGLSDOps *oglsdo)
-{
-    // destroy previous buffer first
-    OGLSD_DestroyOGLSurface(env, oglsdo);
-
-    CGLSDOps *cglsdo = (CGLSDOps *)oglsdo->privOps;
-    jboolean result =
-        OGLSurfaceData_initFBObject(env, NULL, ptr_to_jlong(oglsdo), oglsdo->isOpaque,
-                                    isTexNonPow2Available(cglsdo->configInfo),
-                                    isTexRectAvailable(cglsdo->configInfo),
-                                    oglsdo->width, oglsdo->height);
-
-    // NOTE: OGLSD_WINDOW type is reused for offscreen rendering
-    //       when intermediate buffer is enabled
-    oglsdo->drawableType = OGLSD_WINDOW;
-
-    AWTView *view = cglsdo->peerData;
-    CGLLayer *layer = (CGLLayer *)view.cglLayer;
-    layer.textureID = oglsdo->textureID;
-    layer.target = GL_TEXTURE_2D;
-    layer.textureWidth = oglsdo->width;
-    layer.textureHeight = oglsdo->height;
-
-    return result;
-}
-
-
-static inline IOSurfaceRef createIoSurface(int width, int height)
-{
-    // Get an error return for 0 size. Maybe should skip creation
-    // for that case, but for now make a 1X1 surface
-    if (width <= 0) width = 1;
-    if (height <= 0) height = 1;
-
-    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-    NSMutableDictionary *properties = [NSMutableDictionary dictionaryWithCapacity:4];
-    [properties setObject:[NSNumber numberWithInt:width] forKey:(id)kIOSurfaceWidth];
-    [properties setObject:[NSNumber numberWithInt:height] forKey:(id)kIOSurfaceHeight];
-    [properties setObject:[NSNumber numberWithInt:4] forKey:(id)kIOSurfaceBytesPerElement];
-    IOSurfaceRef surface = IOSurfaceCreate((CFDictionaryRef)properties);
-    CFRetain(surface); // REMIND: do I need to do this ?
-    [pool drain];
-
-    if (surface == NULL) {
-        NSLog(@"IOSurfaceCreate error, surface: %p", surface);
-    } else {
-        //NSLog(@"Plugin iosurface OK");
-        //NSLog(@"    surface: %p", surface);
-        //NSLog(@"    IOSurfaceGetID(self->surface): %d", IOSurfaceGetID(surface));
-    }
-    return surface;
-}
-
-/**
- * Recreates the intermediate buffer associated with the given OGLSDOps
- * and with the buffer's new size specified in OGLSDOps.
- */
-jboolean RecreateIOSBuffer(JNIEnv *env, OGLSDOps *oglsdo)
-{
-    CGLSDOps *cglsdo = (CGLSDOps *)oglsdo->privOps;
-    // destroy previous buffer first
-    if (oglsdo->textureID != 0) {
-        OGLSD_DestroyOGLSurface(env, oglsdo);
-        if (cglsdo->surfaceRef != NULL) {
-            CFRelease(cglsdo->surfaceRef);
-            cglsdo->surfaceRef = NULL;
-        }
-    }
-
-    oglsdo->textureID = 0;
-    cglsdo->surfaceRef = NULL;
-    int width = oglsdo->width;
-    int height = oglsdo->height;
-    if (width <= 0) width = 1;
-    if (height <= 0) height = 1;
-    IOSurfaceRef _surfaceRef = createIoSurface(width, height);
-    if (_surfaceRef == NULL) {
-        return JNI_FALSE;
-    }
-
-    GLenum target = GL_TEXTURE_RECTANGLE_ARB;
-    glEnable(target);
-    GLuint texture;
-    glGenTextures(1, &texture);
-    glBindTexture(target, texture);
-    glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-    glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-    glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-    glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
-    OGLContext *oglc = cglsdo->configInfo->context;
-    CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo;
-    CGLContextObj context = ctxinfo->context.CGLContextObj;
-
-    /* These parameters are documented only in the header file
-     * and apart from the requirement that it must be one of
-     * the combinations listed there its not as clear as I'd like
-     * what the choices mean.
-     */
-    GLenum format = GL_BGRA;
-    GLenum internal_format = GL_RGB;
-    GLenum type = GL_UNSIGNED_INT_8_8_8_8_REV;
-
-    CGLError err =
-    CGLTexImageIOSurface2D(context, target, internal_format,
-         width, height, format, type, _surfaceRef, 0);
-
-    if (err != kCGLNoError) {
-        J2dRlsTraceLn(J2D_TRACE_ERROR,
-                      "OGLSurfaceData_RecreateIOSBuffer: could not init texture");
-        j2d_glDeleteTextures(1, &texture);
-        CFRelease(_surfaceRef);
-        return JNI_FALSE;
-    }
-
-    oglsdo->drawableType = OGLSD_FBOBJECT;
-    oglsdo->xOffset = 0;
-    oglsdo->yOffset = 0;
-    oglsdo->width = width;
-    oglsdo->height = height;
-    oglsdo->textureID = texture;
-    oglsdo->textureWidth = width;
-    oglsdo->textureHeight = height;
-    // init_FBO fails if we don't use target GL_TEXTURE_RECTANGLE_ARB for the IOS texture.
-    oglsdo->textureTarget = target;
-    OGLSD_INIT_TEXTURE_FILTER(oglsdo, GL_NEAREST);
-    OGLSD_RESET_TEXTURE_WRAP(target);
-
-    // initialize framebuffer object using color texture created above
-    GLuint fbobjectID, depthID;
-    if (!OGLSD_InitFBObject(&fbobjectID, &depthID,
-                            oglsdo->textureID, oglsdo->textureTarget,
-                            oglsdo->textureWidth, oglsdo->textureHeight))
-    {
-        J2dRlsTraceLn(J2D_TRACE_ERROR,
-                      "OGLSurfaceData_RecreateIOSBuffer: could not init fbobject");
-        j2d_glDeleteTextures(1, &oglsdo->textureID);
-        CFRelease(_surfaceRef);
-        return JNI_FALSE;
-    }
-
-    oglsdo->fbobjectID = fbobjectID;
-    oglsdo->depthID = depthID;
-    // NOTE: OGLSD_WINDOW type is reused for offscreen rendering
-    //       when intermediate buffer is enabled
-    oglsdo->drawableType = OGLSD_WINDOW;
-
-    OGLSD_SetNativeDimensions(env, oglsdo,
-                              oglsdo->textureWidth, oglsdo->textureHeight);
-
-    cglsdo->surfaceRef = _surfaceRef;
-    AWTView *view = cglsdo->peerData;
-    CGLLayer *layer = (CGLLayer *)view.cglLayer;
-    layer.textureID = oglsdo->textureID;
-    layer.target = target;
-    layer.textureWidth = oglsdo->width;
-    layer.textureHeight = oglsdo->height;
-
-    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-
-    return JNI_TRUE;
-}
-
-/**
  * This function initializes a native window surface and caches the window
  * bounds in the given OGLSDOps.  Returns JNI_TRUE if the operation was
  * successful; JNI_FALSE otherwise.
@@ -573,27 +342,14 @@
 JNF_COCOA_ENTER(env);
     NSRect surfaceBounds = [v bounds];
     oglsdo->drawableType = OGLSD_WINDOW;
-#ifndef USE_INTERMEDIATE_BUFFER
     oglsdo->isOpaque = JNI_TRUE;
-#endif
-
     oglsdo->width = surfaceBounds.size.width;
     oglsdo->height = surfaceBounds.size.height;
 JNF_COCOA_EXIT(env);
 
-    jboolean result = JNI_TRUE;
-
-#if USE_INTERMEDIATE_BUFFER
-#ifdef USE_IOS
-    result = RecreateIOSBuffer(env, oglsdo);
-#else
-    result = RecreateBuffer(env, oglsdo);
-#endif
-#endif
-
     J2dTraceLn2(J2D_TRACE_VERBOSE, "  created window: w=%d h=%d", oglsdo->width, oglsdo->height);
-
-    return result;
+    
+    return JNI_TRUE;
 }
 
 void
@@ -617,37 +373,26 @@
             [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
                 AWT_ASSERT_APPKIT_THREAD;
                 [layer setNeedsDisplay];
+
+#ifdef REMOTELAYER
+                /* If there's a remote layer (being used for testing)
+                 * then we want to have that also receive the texture.
+                 * First sync. up its dimensions with that of the layer
+                 * we have attached to the local window and tell it that
+                 * it also needs to copy the texture.
+                 */
+                if (layer.remoteLayer != nil) {
+                    CGLLayer* remoteLayer = layer.remoteLayer;
+                    remoteLayer.target = GL_TEXTURE_2D;
+                    remoteLayer.textureID = layer.textureID;
+                    remoteLayer.textureWidth = layer.textureWidth;
+                    remoteLayer.textureHeight = layer.textureHeight;
+                    [remoteLayer setNeedsDisplay];
+                }
+#endif /* REMOTELAYER */                
             }];
         }
     }
-#if USE_INTERMEDIATE_BUFFER
-    OGLSDOps *dstOps = OGLRenderQueue_GetCurrentDestination();
-    if (dstOps != NULL) {
-        [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
-            AWT_ASSERT_APPKIT_THREAD;
-            CGLSDOps *dstCGLOps = (CGLSDOps *)dstOps->privOps;
-            AWTView *view = dstCGLOps->peerData;
-            [view.cglLayer setNeedsDisplay];
-#ifdef REMOTELAYER
-            /* If there's a remote layer (being used for testing)
-             * then we want to have that also receive the texture.
-             * First sync. up its dimensions with that of the layer
-             * we have attached to the local window and tell it that
-             * it also needs to copy the texture.
-             */
-             CGLLayer* cglLayer = (CGLLayer*)view.cglLayer;
-             if (cglLayer.remoteLayer != nil) {
-                 CGLLayer* remoteLayer = cglLayer.remoteLayer;
-                 remoteLayer.target = GL_TEXTURE_2D;
-                 remoteLayer.textureID = cglLayer.textureID;
-                 remoteLayer.textureWidth = cglLayer.textureWidth;
-                 remoteLayer.textureHeight = cglLayer.textureHeight;
-                 [remoteLayer setNeedsDisplay];
-            }
-#endif /* REMOTELAYER */
-        }];
-    }
-#endif
 }
 
 #pragma mark -
@@ -828,26 +573,11 @@
     oglsdo->xOffset = xoff;
     oglsdo->yOffset = yoff;
 
-    BOOL newSize = (oglsdo->width != width || oglsdo->height != height);
-    BOOL newOpaque = (oglsdo->isOpaque != isOpaque);
-
     oglsdo->width = width;
     oglsdo->height = height;
     oglsdo->isOpaque = isOpaque;
 
     if (oglsdo->drawableType == OGLSD_WINDOW) {
-JNF_COCOA_ENTER(env);
-#ifdef USE_INTERMEDIATE_BUFFER
-        if (newSize || newOpaque) {
-#ifdef USE_IOS
-            RecreateIOSBuffer(env, oglsdo);
-#else
-            RecreateBuffer(env, oglsdo);
-#endif
-        }
-#endif
-JNF_COCOA_EXIT(env);
-
         OGLContext_SetSurfaces(env, ptr_to_jlong(oglsdo), ptr_to_jlong(oglsdo));
 
         // we have to explicitly tell the NSOpenGLContext that its target
@@ -857,9 +587,7 @@
         CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo;
 
 JNF_COCOA_ENTER(env);
-#ifndef USE_INTERMEDIATE_BUFFER
         [ctxinfo->context update];
-#endif
 JNF_COCOA_EXIT(env);
     }
 }
--- a/src/share/native/sun/java2d/opengl/OGLSurfaceData.c	Wed Feb 01 04:43:47 2012 -0800
+++ b/src/share/native/sun/java2d/opengl/OGLSurfaceData.c	Wed Feb 01 04:45:04 2012 -0800
@@ -396,16 +396,6 @@
      jboolean texNonPow2, jboolean texRect,
      jint width, jint height)
 {
-    return OGLSurfaceData_initFBObject(env, oglsd, pData, isOpaque,
-                                       texNonPow2, texRect, width, height);
-}
-
-jboolean OGLSurfaceData_initFBObject
-    (JNIEnv *env, jobject oglsd,
-     jlong pData, jboolean isOpaque,
-     jboolean texNonPow2, jboolean texRect,
-     jint width, jint height)
-{
     OGLSDOps *oglsdo = (OGLSDOps *)jlong_to_ptr(pData);
     GLuint fbobjectID, depthID;
 
--- a/src/share/native/sun/java2d/opengl/OGLSurfaceData.h	Wed Feb 01 04:43:47 2012 -0800
+++ b/src/share/native/sun/java2d/opengl/OGLSurfaceData.h	Wed Feb 01 04:45:04 2012 -0800
@@ -291,11 +291,5 @@
 jboolean OGLSD_InitFBObject(GLuint *fbobjectID, GLuint *depthID,
                             GLuint textureID, GLenum textureTarget,
                             jint textureWidth, jint textureHeight);
-// needed by Mac OS X port
-jboolean OGLSurfaceData_initFBObject(JNIEnv *env, jobject oglsd,
-                                     jlong pData, jboolean isOpaque,
-                                     jboolean texNonPow2, jboolean texRect,
-                                     jint width, jint height);
-void OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo, jint w, jint h);
 
 #endif /* OGLSurfaceData_h_Included */
--- a/test/ProblemList.txt	Wed Feb 01 04:43:47 2012 -0800
+++ b/test/ProblemList.txt	Wed Feb 01 04:45:04 2012 -0800
@@ -386,6 +386,11 @@
 # 6963118
 java/nio/channels/Selector/Wakeup.java                          windows-all
 
+# 7133499, 7133497
+java/nio/channels/AsyncCloseAndInterrupt.java 			macosx-all
+java/nio/channels/AsynchronousFileChannel/Lock.java 		macosx-all
+java/nio/channels/FileChannel/Transfer.java 			macosx-all
+
 ############################################################################
 
 # jdk_rmi
@@ -668,6 +673,9 @@
 
 # jdk_util
 
+# Need 7094995 back-ported from jdk8
+java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java	macosx-all
+
 # Filed 7027061
 java/util/Locale/Bug6989440.java                                windows-all
 
--- a/test/javax/swing/AbstractButton/6711682/bug6711682.java	Wed Feb 01 04:43:47 2012 -0800
+++ b/test/javax/swing/AbstractButton/6711682/bug6711682.java	Wed Feb 01 04:45:04 2012 -0800
@@ -61,30 +61,38 @@
             robot.mousePress(InputEvent.BUTTON1_MASK);
             robot.mouseRelease(InputEvent.BUTTON1_MASK);
         }
-        // Without pressing F2 the last table's cell
-        // reported <code>false</code> value
-        // note that I can't press it inside the for loop
-        // because it doesn't reproduce the bug
-        robot.keyPress(KeyEvent.VK_F2);
-        robot.keyRelease(KeyEvent.VK_F2);
+        toolkit.realSync();
 
-        for (int i = 0; i < 3; i++) {
-            if (!Boolean.TRUE.equals(table.getValueAt(i, 0))) {
-                throw new RuntimeException("Row #" + i + " checkbox is not selected");
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                table.getCellEditor().stopCellEditing();
+                for (int i = 0; i < 3; i++) {
+                    if (!Boolean.TRUE.equals(table.getValueAt(i, 0))) {
+                        throw new RuntimeException("Row #" + i + " checkbox is not selected");
+                    }
+                }
             }
-        }
+        });
+
         for (int i = 2; i >= 0; i--) {
             robot.mouseMove(l.x + 5, l.y + 5 + i * h);
             robot.mousePress(InputEvent.BUTTON1_MASK);
             robot.mouseRelease(InputEvent.BUTTON1_MASK);
         }
-        robot.keyPress(KeyEvent.VK_F2);
-        robot.keyRelease(KeyEvent.VK_F2);
-        for (int i = 0; i < 3; i++) {
-            if (Boolean.TRUE.equals(table.getValueAt(i, 0))) {
-                throw new RuntimeException("Row #" + i + " checkbox is selected");
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                table.getCellEditor().stopCellEditing();
+                for (int i = 0; i < 3; i++) {
+                    if (Boolean.TRUE.equals(table.getValueAt(i, 0))) {
+                        throw new RuntimeException("Row #" + i + " checkbox is selected");
+                    }
+                }
             }
-        }
+        });
     }
 
     private static void createAndShowGUI() {
--- a/test/javax/swing/JFileChooser/6489130/bug6489130.java	Wed Feb 01 04:43:47 2012 -0800
+++ b/test/javax/swing/JFileChooser/6489130/bug6489130.java	Wed Feb 01 04:45:04 2012 -0800
@@ -84,10 +84,6 @@
                 new bug6489130().run();
             }
         });
-
-        if (!MUX.await(10, TimeUnit.SECONDS)) {
-            throw new RuntimeException("Timeout");
-        }
     }
 
     private void run() {