OpenJDK / jigsaw / jake / jdk
changeset 13449:29706fa052d1
Merge
author | ddehaven |
---|---|
date | Tue, 14 Jul 2015 15:18:26 -0700 |
parents | 9fc099204b88 2b749e7a079b |
children | 0abae966fdf1 5b7c04474d88 |
files | |
diffstat | 154 files changed, 1949 insertions(+), 1044 deletions(-) [+] |
line wrap: on
line diff
--- a/make/mapfiles/libawt/mapfile-mawt-vers Tue Jul 14 20:14:29 2015 +0100 +++ b/make/mapfiles/libawt/mapfile-mawt-vers Tue Jul 14 15:18:26 2015 -0700 @@ -196,7 +196,6 @@ Java_sun_java2d_opengl_GLXGraphicsConfig_initConfig; Java_sun_java2d_opengl_GLXGraphicsConfig_getOGLCapabilities; Java_sun_java2d_opengl_GLXSurfaceData_initOps; - Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer; Java_sun_print_CUPSPrinter_initIDs; Java_sun_print_CUPSPrinter_getCupsServer;
--- a/make/mapfiles/libawt/mapfile-vers Tue Jul 14 20:14:29 2015 +0100 +++ b/make/mapfiles/libawt/mapfile-vers Tue Jul 14 15:18:26 2015 -0700 @@ -37,7 +37,6 @@ Java_sun_awt_image_DataBufferNative_getElem; Java_sun_awt_image_DataBufferNative_setElem; Java_java_awt_image_ColorModel_initIDs; - Java_java_awt_image_ComponentSampleModel_initIDs; Java_java_awt_image_IndexColorModel_initIDs; Java_java_awt_image_Kernel_initIDs; Java_java_awt_image_Raster_initIDs; @@ -89,7 +88,6 @@ Java_java_awt_Choice_initIDs; Java_java_awt_Dimension_initIDs; Java_java_awt_event_MouseEvent_initIDs; - Java_java_awt_image_DataBufferInt_initIDs; Java_java_awt_image_SinglePixelPackedSampleModel_initIDs; Java_java_awt_Rectangle_initIDs; Java_sun_awt_image_BufImgSurfaceData_initIDs;
--- a/make/mapfiles/libawt/mapfile-vers-linux Tue Jul 14 20:14:29 2015 +0100 +++ b/make/mapfiles/libawt/mapfile-vers-linux Tue Jul 14 15:18:26 2015 -0700 @@ -37,7 +37,6 @@ Java_sun_awt_image_DataBufferNative_getElem; Java_sun_awt_image_DataBufferNative_setElem; Java_java_awt_image_ColorModel_initIDs; - Java_java_awt_image_ComponentSampleModel_initIDs; Java_java_awt_image_IndexColorModel_initIDs; Java_java_awt_image_Kernel_initIDs; Java_java_awt_image_Raster_initIDs; @@ -89,7 +88,6 @@ Java_java_awt_Choice_initIDs; Java_java_awt_Dimension_initIDs; Java_java_awt_event_MouseEvent_initIDs; - Java_java_awt_image_DataBufferInt_initIDs; Java_java_awt_image_SinglePixelPackedSampleModel_initIDs; Java_java_awt_Rectangle_initIDs; Java_sun_awt_image_BufImgSurfaceData_getSurfaceData;
--- a/make/mapfiles/libawt_xawt/mapfile-vers Tue Jul 14 20:14:29 2015 +0100 +++ b/make/mapfiles/libawt_xawt/mapfile-vers Tue Jul 14 15:18:26 2015 -0700 @@ -337,7 +337,6 @@ Java_sun_java2d_opengl_GLXGraphicsConfig_initConfig; Java_sun_java2d_opengl_GLXGraphicsConfig_getOGLCapabilities; Java_sun_java2d_opengl_GLXSurfaceData_initOps; - Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer; Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit;
--- a/src/java.base/share/classes/sun/misc/ManagedLocalsThread.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.base/share/classes/sun/misc/ManagedLocalsThread.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,6 +48,11 @@ eraseThreadLocals(); } + public ManagedLocalsThread(ThreadGroup group, Runnable target) { + super(group, target); + eraseThreadLocals(); + } + public ManagedLocalsThread(Runnable target, String name) { super(target, name); eraseThreadLocals();
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -383,11 +383,7 @@ this.currentDirectory = currentDirectory; this.fid = fid; String name = "Aqua L&F File Loading Thread"; - if (System.getSecurityManager() == null) { - this.loadThread = new Thread(FilesLoader.this, name); - } else { - this.loadThread = new ManagedLocalsThread(FilesLoader.this, name); - } + this.loadThread = new ManagedLocalsThread(this, name); this.loadThread.start(); }
--- a/src/java.desktop/macosx/classes/sun/font/CFontManager.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/classes/sun/font/CFontManager.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import sun.awt.HeadlessToolkit; import sun.awt.util.ThreadGroupUtils; import sun.lwawt.macosx.*; -import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; public final class CFontManager extends SunFontManager { private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>(); @@ -213,17 +213,12 @@ } }; AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - if (System.getSecurityManager() == null) { - /* The thread must be a member of a thread group - * which will not get GCed before VM exit. - * Make its parent the top-level thread group. - */ - ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup(); - fileCloser = new Thread(rootTG, fileCloserRunnable); - } else { - /* InnocuousThread is a member of a correct TG by default */ - fileCloser = new InnocuousThread(fileCloserRunnable); - } + /* The thread must be a member of a thread group + * which will not get GCed before VM exit. + * Make its parent the top-level thread group. + */ + ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup(); + fileCloser = new ManagedLocalsThread(rootTG, fileCloserRunnable); fileCloser.setContextClassLoader(null); Runtime.getRuntime().addShutdownHook(fileCloser); return null;
--- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -379,23 +379,11 @@ public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency, int type) { - if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED || - transparency == Transparency.BITMASK) - { + if ((type != FBOBJECT && type != TEXTURE) + || transparency == Transparency.BITMASK + || type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) { return null; } - - if (type == FBOBJECT) { - if (!isCapPresent(CAPS_EXT_FBOBJECT)) { - return null; - } - } else if (type == PBUFFER) { - boolean isOpaque = transparency == Transparency.OPAQUE; - if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) { - return null; - } - } - SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height, transparency, type); Surface sd = vi.getDestSurface();
--- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,9 +51,6 @@ private native void initOps(long pConfigInfo, long pPeerData, long layerPtr, int xoff, int yoff, boolean isOpaque); - protected native boolean initPbuffer(long pData, long pConfigInfo, - boolean isOpaque, int width, int height); - protected CGLSurfaceData(CGLGraphicsConfig gc, ColorModel cm, int type, int width, int height) { super(gc, cm, type); @@ -139,7 +136,7 @@ /** * Creates a SurfaceData object representing an off-screen buffer (either a - * Pbuffer or Texture). + * FBO or Texture). */ public static CGLOffScreenSurfaceData createData(CGLGraphicsConfig gc, int width, int height, ColorModel cm, Image image, int type) {
--- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java Tue Jul 14 15:18:26 2015 -0700 @@ -45,7 +45,7 @@ public class CGLVolatileSurfaceManager extends VolatileSurfaceManager { - private boolean accelerationEnabled; + private final boolean accelerationEnabled; public CGLVolatileSurfaceManager(SunVolatileImage vImg, Object context) { super(vImg, context); @@ -53,18 +53,13 @@ /* * We will attempt to accelerate this image only under the * following conditions: - * - the image is opaque OR - * - the image is translucent AND - * - the GraphicsConfig supports the FBO extension OR - * - the GraphicsConfig has a stored alpha channel + * - the image is not bitmask AND the GraphicsConfig supports the FBO + * extension */ int transparency = vImg.getTransparency(); - CGLGraphicsConfig gc = (CGLGraphicsConfig)vImg.getGraphicsConfig(); - accelerationEnabled = - (transparency == Transparency.OPAQUE) || - ((transparency == Transparency.TRANSLUCENT) && - (gc.isCapPresent(CAPS_EXT_FBOBJECT) || - gc.isCapPresent(CAPS_STORED_ALPHA))); + CGLGraphicsConfig gc = (CGLGraphicsConfig) vImg.getGraphicsConfig(); + accelerationEnabled = gc.isCapPresent(CAPS_EXT_FBOBJECT) + && transparency != Transparency.BITMASK; } protected boolean isAccelerationEnabled() { @@ -72,7 +67,7 @@ } /** - * Create a pbuffer-based SurfaceData object (or init the backbuffer + * Create a FBO-based SurfaceData object (or init the backbuffer * of an existing window if this is a double buffered GraphicsConfig) */ protected SurfaceData initAcceleratedSurface() { @@ -113,10 +108,9 @@ ColorModel cm = gc.getColorModel(vImg.getTransparency()); int type = vImg.getForcedAccelSurfaceType(); // if acceleration type is forced (type != UNDEFINED) then - // use the forced type, otherwise choose one based on caps + // use the forced type, otherwise choose FBOBJECT if (type == OGLSurfaceData.UNDEFINED) { - type = gc.isCapPresent(CAPS_EXT_FBOBJECT) ? - OGLSurfaceData.FBOBJECT : OGLSurfaceData.PBUFFER; + type = OGLSurfaceData.FBOBJECT; } if (createVSynced) { // TODO: modify parameter to delegate
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java Tue Jul 14 15:18:26 2015 -0700 @@ -35,7 +35,7 @@ import java.util.*; import sun.awt.*; -import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; import sun.print.*; import sun.awt.util.ThreadGroupUtils; @@ -77,22 +77,13 @@ shutdown(); waitForRunState(STATE_CLEANUP); }; - Thread shutdown; - if (System.getSecurityManager() == null) { - shutdown = new Thread(ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable); - } else { - shutdown = new InnocuousThread(shutdownRunnable); - } + Thread shutdown = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable); shutdown.setContextClassLoader(null); Runtime.getRuntime().addShutdownHook(shutdown); - String name = "AWT-LW"; - Thread toolkitThread; - if (System.getSecurityManager() == null) { - toolkitThread = new Thread(ThreadGroupUtils.getRootThreadGroup(), LWToolkit.this, name); - } else { - toolkitThread = new InnocuousThread(LWToolkit.this, name); - } + Thread toolkitThread = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), this, name); toolkitThread.setDaemon(true); toolkitThread.setPriority(Thread.NORM_PRIORITY + 1); toolkitThread.start();
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Tue Jul 14 15:18:26 2015 -0700 @@ -181,13 +181,7 @@ } } }; - Thread dragThread; - if (System.getSecurityManager() == null) { - dragThread = new Thread(dragRunnable); - } else { - dragThread = new ManagedLocalsThread(dragRunnable); - } - dragThread.start(); + new ManagedLocalsThread(dragRunnable).start(); } catch (Exception e) { final long nativeDragSource = getNativeContext(); setNativeContext(0);
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFileDialog.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFileDialog.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -120,11 +120,7 @@ if (visible) { // Java2 Dialog class requires peer to run code in a separate thread // and handles keeping the call modal - if (System.getSecurityManager() == null) { - new Thread(new Task()).start(); - } else { - new ManagedLocalsThread(new Task()).start(); - } + new ManagedLocalsThread(new Task()).start(); } // We hide ourself before "show" returns - setVisible(false) // doesn't apply
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java Tue Jul 14 15:18:26 2015 -0700 @@ -59,11 +59,7 @@ printerDialog.setRetVal(printerDialog.showDialog()); printerDialog.setVisible(false); }; - if (System.getSecurityManager() == null) { - new Thread(task).start(); - } else { - new ManagedLocalsThread(task).start(); - } + new ManagedLocalsThread(task).start(); } }
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -736,12 +736,7 @@ // upcall from native private static void detachPrintLoop(final long target, final long arg) { - Runnable task = () -> _safePrintLoop(target, arg); - if (System.getSecurityManager() == null) { - new Thread(task).start(); - } else { - new ManagedLocalsThread(task).start(); - } + new ManagedLocalsThread(() -> _safePrintLoop(target, arg)).start(); } private static native void _safePrintLoop(long target, long arg); @@ -779,4 +774,4 @@ (float) (paper.getImageableHeight() / dpi), MediaPrintableArea.INCH); } -} \ No newline at end of file +}
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m Tue Jul 14 15:18:26 2015 -0700 @@ -376,7 +376,7 @@ if ([sharedApp isKindOfClass:[NSApplicationAWT class]]) { NSApplicationAWT* theApp = (NSApplicationAWT*)sharedApp; [theApp postDummyEvent]; - [theApp waitForDummyEvent]; + [theApp waitForDummyEvent:timeout]; } else { // could happen if we are embedded inside SWT application, // in this case just spin a single empty block through
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,7 +63,7 @@ CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo; if (ctxinfo != NULL) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; [NSOpenGLContext clearCurrentContext]; [ctxinfo->context clearDrawable]; [ctxinfo->context release]; @@ -342,18 +342,10 @@ if (value != 0) { caps |= CAPS_DOUBLEBUFFERED; } - [sharedPixelFormat - getValues: &value - forAttribute: NSOpenGLPFAAlphaSize - forVirtualScreen: contextVirtualScreen]; - if (value != 0) { - caps |= CAPS_STORED_ALPHA; - } - J2dRlsTraceLn2(J2D_TRACE_INFO, - "CGLGraphicsConfig_getCGLConfigInfo: db=%d alpha=%d", - (caps & CAPS_DOUBLEBUFFERED) != 0, - (caps & CAPS_STORED_ALPHA) != 0); + J2dRlsTraceLn1(J2D_TRACE_INFO, + "CGLGraphicsConfig_getCGLConfigInfo: db=%d", + (caps & CAPS_DOUBLEBUFFERED) != 0); // remove before shipping (?) #if 1
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.h Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.h Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,6 @@ AWTView *peerData; CGLLayer *layer; GLclampf argb[4]; // background clear color - NSOpenGLPixelBuffer *pbuffer; CGLGraphicsConfigInfo *configInfo; } CGLSDOps;
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -110,9 +110,7 @@ /** * This function disposes of any native windowing system resources associated - * with this surface. For instance, if the given OGLSDOps is of type - * OGLSD_PBUFFER, this method implementation will destroy the actual pbuffer - * surface. + * with this surface. */ void OGLSD_DestroyOGLSurface(JNIEnv *env, OGLSDOps *oglsdo) @@ -122,16 +120,7 @@ JNF_COCOA_ENTER(env); CGLSDOps *cglsdo = (CGLSDOps *)oglsdo->privOps; - if (oglsdo->drawableType == OGLSD_PBUFFER) { - if (oglsdo->textureID != 0) { - j2d_glDeleteTextures(1, &oglsdo->textureID); - oglsdo->textureID = 0; - } - if (cglsdo->pbuffer != NULL) { - [cglsdo->pbuffer release]; - cglsdo->pbuffer = NULL; - } - } else if (oglsdo->drawableType == OGLSD_WINDOW) { + if (oglsdo->drawableType == OGLSD_WINDOW) { // detach the NSView from the NSOpenGLContext CGLGraphicsConfigInfo *cglInfo = cglsdo->configInfo; OGLContext *oglc = cglInfo->context; @@ -277,23 +266,12 @@ JNF_COCOA_ENTER(env); - // set the current surface - if (dstOps->drawableType == OGLSD_PBUFFER) { - // REMIND: pbuffers are not fully tested yet... - [ctxinfo->context clearDrawable]; + CGLSDOps *cglsdo = (CGLSDOps *)dstOps->privOps; + NSView *nsView = (NSView *)cglsdo->peerData; + + if ([ctxinfo->context view] != nsView) { [ctxinfo->context makeCurrentContext]; - [ctxinfo->context setPixelBuffer: dstCGLOps->pbuffer - cubeMapFace: 0 - mipMapLevel: 0 - currentVirtualScreen: [ctxinfo->context currentVirtualScreen]]; - } else { - CGLSDOps *cglsdo = (CGLSDOps *)dstOps->privOps; - NSView *nsView = (NSView *)cglsdo->peerData; - - if ([ctxinfo->context view] != nsView) { - [ctxinfo->context makeCurrentContext]; - [ctxinfo->context setView: nsView]; - } + [ctxinfo->context setView: nsView]; } if (OGLC_IS_CAP_PRESENT(oglc, CAPS_EXT_FBOBJECT)) { @@ -303,16 +281,6 @@ j2d_glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); } - if ((srcOps != dstOps) && (srcOps->drawableType == OGLSD_PBUFFER)) { - // bind pbuffer to the render texture object (since we are preparing - // to copy from the pbuffer) - CGLSDOps *srcCGLOps = (CGLSDOps *)srcOps->privOps; - j2d_glBindTexture(GL_TEXTURE_2D, srcOps->textureID); - [ctxinfo->context - setTextureImageToPixelBuffer: srcCGLOps->pbuffer - colorBuffer: GL_FRONT]; - } - JNF_COCOA_EXIT(env); return oglc; @@ -464,105 +432,6 @@ cglsdo->layer = NULL; } -JNIEXPORT jboolean JNICALL -Java_sun_java2d_opengl_CGLSurfaceData_initPbuffer - (JNIEnv *env, jobject cglsd, - jlong pData, jlong pConfigInfo, jboolean isOpaque, - jint width, jint height) -{ - J2dTraceLn3(J2D_TRACE_INFO, "CGLSurfaceData_initPbuffer: w=%d h=%d opq=%d", width, height, isOpaque); - - OGLSDOps *oglsdo = (OGLSDOps *)jlong_to_ptr(pData); - if (oglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: ops are null"); - return JNI_FALSE; - } - - CGLSDOps *cglsdo = (CGLSDOps *)oglsdo->privOps; - if (cglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: cgl ops are null"); - return JNI_FALSE; - } - - CGLGraphicsConfigInfo *cglInfo = (CGLGraphicsConfigInfo *) - jlong_to_ptr(pConfigInfo); - if (cglInfo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: cgl config info is null"); - return JNI_FALSE; - } - - // find the maximum allowable texture dimensions (this value ultimately - // determines our maximum pbuffer size) - int pbMax = 0; - j2d_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &pbMax); - - int pbWidth = 0; - int pbHeight = 0; - if (OGLC_IS_CAP_PRESENT(cglInfo->context, CAPS_TEXNONPOW2)) { - // use non-power-of-two dimensions directly - pbWidth = (width <= pbMax) ? width : 0; - pbHeight = (height <= pbMax) ? height : 0; - } else { - // find the appropriate power-of-two dimensions - pbWidth = OGLSD_NextPowerOfTwo(width, pbMax); - pbHeight = OGLSD_NextPowerOfTwo(height, pbMax); - } - - J2dTraceLn3(J2D_TRACE_VERBOSE, " desired pbuffer dimensions: w=%d h=%d max=%d", pbWidth, pbHeight, pbMax); - - // if either dimension is 0, we cannot allocate a pbuffer/texture with the - // requested dimensions - if (pbWidth == 0 || pbHeight == 0) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: dimensions too large"); - return JNI_FALSE; - } - - int format = isOpaque ? GL_RGB : GL_RGBA; - -JNF_COCOA_ENTER(env); - - cglsdo->pbuffer = - [[NSOpenGLPixelBuffer alloc] - initWithTextureTarget: GL_TEXTURE_2D - textureInternalFormat: format - textureMaxMipMapLevel: 0 - pixelsWide: pbWidth - pixelsHigh: pbHeight]; - if (cglsdo->pbuffer == nil) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: could not create pbuffer"); - return JNI_FALSE; - } - - // make sure the actual dimensions match those that we requested - GLsizei actualWidth = [cglsdo->pbuffer pixelsWide]; - GLsizei actualHeight = [cglsdo->pbuffer pixelsHigh]; - if (actualWidth != pbWidth || actualHeight != pbHeight) { - J2dRlsTraceLn2(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: actual (w=%d h=%d) != requested", actualWidth, actualHeight); - [cglsdo->pbuffer release]; - return JNI_FALSE; - } - - GLuint texID = 0; - j2d_glGenTextures(1, &texID); - j2d_glBindTexture(GL_TEXTURE_2D, texID); - - oglsdo->drawableType = OGLSD_PBUFFER; - oglsdo->isOpaque = isOpaque; - oglsdo->width = width; - oglsdo->height = height; - oglsdo->textureID = texID; - oglsdo->textureWidth = pbWidth; - oglsdo->textureHeight = pbHeight; - oglsdo->activeBuffer = GL_FRONT; - oglsdo->needsInit = JNI_TRUE; - - OGLSD_INIT_TEXTURE_FILTER(oglsdo, GL_NEAREST); - -JNF_COCOA_EXIT(env); - - return JNI_TRUE; -} - #pragma mark - #pragma mark "--- CGLSurfaceData methods - Mac OS X specific ---"
--- a/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.h Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.h Tue Jul 14 15:18:26 2015 -0700 @@ -38,7 +38,7 @@ - (void) setDockIconWithEnv:(JNIEnv *)env; - (void) postDummyEvent; - (void) postRunnableEvent:(void (^)())block; -- (void) waitForDummyEvent; +- (void) waitForDummyEvent:(long long) timeout; + (void) runAWTLoopWithApp:(NSApplication*)app;
--- a/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m Tue Jul 14 15:18:26 2015 -0700 @@ -398,8 +398,14 @@ [pool drain]; } -- (void)waitForDummyEvent { - [seenDummyEventLock lockWhenCondition:YES]; +- (void)waitForDummyEvent:(long long) timeout { + if (timeout >= 0) { + double sec = ((double) timeout)/1000; + [seenDummyEventLock lockWhenCondition:YES + beforeDate:[NSDate dateWithTimeIntervalSinceNow:sec]]; + } else { + [seenDummyEventLock lockWhenCondition:YES]; + } [seenDummyEventLock unlock]; [seenDummyEventLock release];
--- a/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m Tue Jul 14 15:18:26 2015 -0700 @@ -275,7 +275,6 @@ [image addRepresentation: rep]; float scaleFactor = splash->scaleFactor; if (scaleFactor > 0 && scaleFactor != 1) { - [image setScalesWhenResized:YES]; NSSize size = [image size]; size.width /= scaleFactor; size.height /= scaleFactor;
--- a/src/java.desktop/share/classes/com/sun/imageio/stream/StreamCloser.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/com/sun/imageio/stream/StreamCloser.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ package com.sun.imageio.stream; import sun.awt.util.ThreadGroupUtils; -import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; import java.io.IOException; import java.security.AccessController; @@ -87,17 +87,13 @@ }; AccessController.doPrivileged((PrivilegedAction<Object>) () -> { - if (System.getSecurityManager() == null) { - /* The thread must be a member of a thread group - * which will not get GCed before VM exit. - * Make its parent the top-level thread group. - */ - ThreadGroup tg = ThreadGroupUtils.getRootThreadGroup(); - streamCloser = new Thread(tg, streamCloserRunnable); - } else { - /* InnocuousThread is a member of a correct TG by default */ - streamCloser = new InnocuousThread(streamCloserRunnable); - } + /* The thread must be a member of a thread group + * which will not get GCed before VM exit. + * Make its parent the top-level thread group. + */ + ThreadGroup tg = ThreadGroupUtils.getRootThreadGroup(); + streamCloser = new ManagedLocalsThread(tg, + streamCloserRunnable); /* Set context class loader to null in order to avoid * keeping a strong reference to an application classloader. */
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2038,11 +2038,7 @@ if (audioRunnable != null) { // Runnable appears to block until completed playing, hence // start up another thread to handle playing. - if (System.getSecurityManager() == null) { - new Thread(audioRunnable).start(); - } else { - new ManagedLocalsThread(audioRunnable).start(); - } + new ManagedLocalsThread(audioRunnable).start(); } } }
--- a/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ package com.sun.media.sound; -import sun.misc.InnocuousThread; import sun.misc.ManagedLocalsThread; import java.io.BufferedInputStream; @@ -147,12 +146,7 @@ final String threadName, final boolean isDaemon, final int priority, final boolean doStart) { - Thread thread; - if (System.getSecurityManager() == null) { - thread = new Thread(runnable); - } else { - thread = new ManagedLocalsThread(runnable); - } + Thread thread = new ManagedLocalsThread(runnable); if (threadName != null) { thread.setName(threadName);
--- a/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,11 +55,7 @@ if (active) return; active = true; - if (System.getSecurityManager() == null) { - audiothread = new Thread(this); - } else { - audiothread = new ManagedLocalsThread(this); - } + audiothread = new ManagedLocalsThread(this); audiothread.setDaemon(true); audiothread.setPriority(Thread.MAX_PRIORITY); audiothread.start();
--- a/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -216,11 +216,7 @@ } }; - if (System.getSecurityManager() == null) { - thread = new Thread(runnable); - } else { - thread = new ManagedLocalsThread(runnable); - } + thread = new ManagedLocalsThread(runnable); thread.setDaemon(true); thread.setPriority(Thread.MAX_PRIORITY); thread.start();
--- a/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -141,11 +141,7 @@ pusher = null; jitter_stream = null; sourceDataLine = null; - if (System.getSecurityManager() == null) { - new Thread(runnable).start(); - } else { - new ManagedLocalsThread(runnable).start(); - } + new ManagedLocalsThread(runnable).start(); } return len; }
--- a/src/java.desktop/share/classes/java/awt/EventDispatchThread.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/java/awt/EventDispatchThread.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,7 +67,7 @@ private ArrayList<EventFilter> eventFilters = new ArrayList<EventFilter>(); EventDispatchThread(ThreadGroup group, String name, EventQueue queue) { - super(group, null, name); + super(group, name); setEventQueue(queue); }
--- a/src/java.desktop/share/classes/java/awt/image/ComponentSampleModel.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/java/awt/image/ComponentSampleModel.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,12 +104,6 @@ */ protected int pixelStride; - static private native void initIDs(); - static { - ColorModel.loadLibraries(); - initIDs(); - } - /** * Constructs a ComponentSampleModel with the specified parameters. * The number of bands will be given by the length of the bandOffsets array.
--- a/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImageProducer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImageProducer.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -137,12 +137,7 @@ addConsumer(ic); // Need to build a runnable object for the Thread. String name = "RenderableImageProducer Thread"; - Thread thread; - if (System.getSecurityManager() == null) { - thread = new Thread(this, name); - } else { - thread = new ManagedLocalsThread(this); - } + Thread thread = new ManagedLocalsThread(this, name); thread.start(); }
--- a/src/java.desktop/share/classes/javax/swing/JTable.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/javax/swing/JTable.java Tue Jul 14 15:18:26 2015 -0700 @@ -6402,12 +6402,7 @@ }; // start printing on another thread - Thread th; - if (System.getSecurityManager() == null) { - th = new Thread(runnable); - } else { - th = new ManagedLocalsThread(runnable); - } + Thread th = new ManagedLocalsThread(runnable); th.start(); printingStatus.showModal(true);
--- a/src/java.desktop/share/classes/javax/swing/JTree.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/javax/swing/JTree.java Tue Jul 14 15:18:26 2015 -0700 @@ -1365,6 +1365,13 @@ child = getPathForRow(index); parent = child.getParentPath(); + TreePath prev = getPathForRow(row).getParentPath(); + if (prev != null && !prev.equals(parent)) { + location = new DropLocation(p, prev, + model.getChildCount(prev.getLastPathComponent())); + break; + } + } else { assert checkOn; location = new DropLocation(p, getPathForRow(row), -1);
--- a/src/java.desktop/share/classes/javax/swing/TimerQueue.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/javax/swing/TimerQueue.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,8 +36,7 @@ import java.util.concurrent.locks.*; import java.util.concurrent.atomic.AtomicLong; import sun.awt.AppContext; -import sun.misc.InnocuousThread; - +import sun.misc.ManagedLocalsThread; /** * Internal class to manage all Timers using one thread. @@ -99,12 +98,8 @@ final ThreadGroup threadGroup = AppContext.getAppContext().getThreadGroup(); AccessController.doPrivileged((PrivilegedAction<Object>) () -> { String name = "TimerQueue"; - Thread timerThread; - if (System.getSecurityManager() == null) { - timerThread = new Thread(threadGroup, TimerQueue.this, name); - } else { - timerThread = new InnocuousThread(threadGroup, TimerQueue.this, name); - } + Thread timerThread = new ManagedLocalsThread(threadGroup, + this, name); timerThread.setDaemon(true); timerThread.setPriority(Thread.NORM_PRIORITY); timerThread.start();
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java Tue Jul 14 15:18:26 2015 -0700 @@ -271,11 +271,7 @@ this.currentDirectory = currentDirectory; this.fid = fid; String name = "Basic L&F File Loading Thread"; - if (System.getSecurityManager() == null) { - this.loadThread = new Thread(this, name); - } else { - this.loadThread = new ManagedLocalsThread(this, name); - } + this.loadThread = new ManagedLocalsThread(this, name); this.loadThread.start(); }
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,7 @@ import sun.awt.AppContext; import java.util.Enumeration; import java.util.HashSet; +import java.util.Set; /** * RadioButtonUI implementation for BasicRadioButtonUI @@ -582,23 +583,32 @@ */ private class KeyHandler implements KeyListener { - // This listener checks if the key event is a KeyEvent.VK_TAB - // or shift + KeyEvent.VK_TAB event on a radio button, consume the event - // if so and move the focus to next/previous component + // This listener checks if the key event is a focus traversal key event + // on a radio button, consume the event if so and move the focus + // to next/previous component public void keyPressed(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_TAB) { - // Get the source of the event. - Object eventSrc = e.getSource(); - - // Check whether the source is a visible and enabled JRadioButton - if (isValidRadioButtonObj(eventSrc)) { + AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e); + if (stroke != null && e.getSource() instanceof JRadioButton) { + JRadioButton source = (JRadioButton) e.getSource(); + boolean next = isFocusTraversalKey(source, + KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, + stroke); + if (next || isFocusTraversalKey(source, + KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, + stroke)) { e.consume(); - ButtonGroupInfo btnGroupInfo = new ButtonGroupInfo((JRadioButton)eventSrc); - btnGroupInfo.jumpToNextComponent(!e.isShiftDown()); + ButtonGroupInfo btnGroupInfo = new ButtonGroupInfo(source); + btnGroupInfo.jumpToNextComponent(next); } } } + private boolean isFocusTraversalKey(JComponent c, int id, + AWTKeyStroke stroke) { + Set<AWTKeyStroke> keys = c.getFocusTraversalKeys(id); + return keys != null && keys.contains(stroke); + } + public void keyReleased(KeyEvent e) { }
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1497,8 +1497,16 @@ rect.x = xRect.x; rect.width = xRect.width; } else { - rect = tree.getPathBounds(path.pathByAddingChild( - model.getChild(path.getLastPathComponent(), index))); + if (index >= model.getChildCount(path.getLastPathComponent())) { + rect = tree.getPathBounds(path.pathByAddingChild( + model.getChild(path.getLastPathComponent(), + index - 1))); + rect.y = rect.y + rect.height; + } else { + rect = tree.getPathBounds(path.pathByAddingChild( + model.getChild(path.getLastPathComponent(), + index))); + } } }
--- a/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java Tue Jul 14 15:18:26 2015 -0700 @@ -2365,11 +2365,7 @@ runnablePrinting.run(); } else { if (isEventDispatchThread) { - if (System.getSecurityManager() == null) { - new Thread(runnablePrinting).start(); - } else { - new ManagedLocalsThread(runnablePrinting).start(); - } + new ManagedLocalsThread(runnablePrinting).start(); printingStatus.showModal(true); } else { printingStatus.showModal(false);
--- a/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java Tue Jul 14 15:18:26 2015 -0700 @@ -92,12 +92,7 @@ } } while (work != null); }; - String name = "text-layout"; - if (System.getSecurityManager() == null) { - worker = new Thread(workerRunnable, name); - } else { - worker = new ManagedLocalsThread(workerRunnable, name); - } + worker = new ManagedLocalsThread(workerRunnable, "text-layout"); worker.setPriority(Thread.MIN_PRIORITY); worker.start(); }
--- a/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -862,7 +862,7 @@ volatile boolean created = false; AppContextCreator(ThreadGroup group) { - super(group, null, "AppContextCreator"); + super(group, "AppContextCreator"); } public void run() {
--- a/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ import java.util.Set; import sun.awt.util.ThreadGroupUtils; -import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; import sun.util.logging.PlatformLogger; /** @@ -336,14 +336,9 @@ */ private void activateBlockerThread() { AccessController.doPrivileged((PrivilegedAction<Thread>) () -> { - Thread thread; String name = "AWT-Shutdown"; - if (System.getSecurityManager() == null) { - thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this, - name); - } else { - thread = new InnocuousThread(this, name); - } + Thread thread = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), this, name); thread.setContextClassLoader(null); thread.setDaemon(false); blockerThread = thread;
--- a/src/java.desktop/share/classes/sun/awt/AppContext.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/awt/AppContext.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ import java.beans.PropertyChangeListener; import java.lang.ref.SoftReference; -import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; import sun.util.logging.PlatformLogger; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; @@ -591,13 +591,9 @@ } public Thread run() { - Thread t; - if (System.getSecurityManager() == null) { - t = new Thread(appContext.getThreadGroup(), runnable); - } else { - t = new InnocuousThread(appContext.getThreadGroup(), runnable, "AppContext Disposer"); - } - t.setContextClassLoader(null); + Thread t = new ManagedLocalsThread(appContext.getThreadGroup(), + runnable, "AppContext Disposer"); + t.setContextClassLoader(appContext.getContextClassLoader()); t.setPriority(Thread.NORM_PRIORITY + 1); t.setDaemon(true); return t;
--- a/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -167,12 +167,7 @@ // to choose from. Otherwise, just keep the instance. if (imm.hasMultipleInputMethods()) { imm.initialize(); - Thread immThread; - if (System.getSecurityManager() == null) { - immThread = new Thread(imm, threadName); - } else { - immThread = new ManagedLocalsThread(imm, threadName); - } + Thread immThread = new ManagedLocalsThread(imm, threadName); immThread.setDaemon(true); immThread.setPriority(Thread.NORM_PRIORITY + 1); immThread.start();
--- a/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,7 +55,7 @@ * Constructor for ImageFetcher -- only called by add() below. */ private ImageFetcher(ThreadGroup threadGroup, int index) { - super(threadGroup, null, "Image Fetcher " + index); + super(threadGroup, "Image Fetcher " + index); setDaemon(true); }
--- a/src/java.desktop/share/classes/sun/awt/image/VolatileSurfaceManager.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/awt/image/VolatileSurfaceManager.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -246,7 +246,7 @@ * SurfaceData object, or null if the surface creation was not successful. * * Platform-specific subclasses should initialize an accelerated - * surface (e.g. a DirectDraw surface on Windows, an OpenGL pbuffer, + * surface (e.g. a DirectDraw surface on Windows, an OpenGL FBO, * or an X11 pixmap). */ protected abstract SurfaceData initAcceleratedSurface();
--- a/src/java.desktop/share/classes/sun/font/CreatedFontTracker.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/font/CreatedFontTracker.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ import sun.awt.AppContext; import sun.awt.util.ThreadGroupUtils; -import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; public class CreatedFontTracker { @@ -117,17 +117,13 @@ if (t == null) { // Add a shutdown hook to remove the temp file. AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - if (System.getSecurityManager() == null) { - /* The thread must be a member of a thread group - * which will not get GCed before VM exit. - * Make its parent the top-level thread group. - */ - ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup(); - t = new Thread(rootTG, TempFileDeletionHook::runHooks); - } else { - /* InnocuousThread is a member of a correct TG by default */ - t = new InnocuousThread(TempFileDeletionHook::runHooks); - } + /* The thread must be a member of a thread group + * which will not get GCed before VM exit. + * Make its parent the top-level thread group. + */ + ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup(); + t = new ManagedLocalsThread(rootTG, + TempFileDeletionHook::runHooks); /* Set context class loader to null in order to avoid * keeping a strong reference to an application classloader. */
--- a/src/java.desktop/share/classes/sun/font/SunFontManager.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/font/SunFontManager.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,6 +55,7 @@ import sun.awt.util.ThreadGroupUtils; import sun.java2d.FontSupport; import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; import sun.util.logging.PlatformLogger; /** @@ -2501,12 +2502,9 @@ } }; AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - if (System.getSecurityManager() == null) { - ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup(); - fileCloser = new Thread(rootTG, fileCloserRunnable); - } else { - fileCloser = new InnocuousThread(fileCloserRunnable); - } + ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup(); + fileCloser = new ManagedLocalsThread(rootTG, + fileCloserRunnable); fileCloser.setContextClassLoader(null); Runtime.getRuntime().addShutdownHook(fileCloser); return null;
--- a/src/java.desktop/share/classes/sun/java2d/Disposer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/java2d/Disposer.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ package sun.java2d; import sun.awt.util.ThreadGroupUtils; -import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; @@ -84,13 +84,8 @@ disposerInstance = new Disposer(); AccessController.doPrivileged((PrivilegedAction<Void>) () -> { String name = "Java2D Disposer"; - Thread t; - if (System.getSecurityManager() == null) { - ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup(); - t = new Thread(rootTG, disposerInstance, name); - } else { - t = new InnocuousThread(disposerInstance, name); - } + ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup(); + Thread t = new ManagedLocalsThread(rootTG, disposerInstance, name); t.setContextClassLoader(null); t.setDaemon(true); t.setPriority(Thread.MAX_PRIORITY);
--- a/src/java.desktop/share/classes/sun/java2d/loops/GraphicsPrimitive.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/java2d/loops/GraphicsPrimitive.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ import java.security.AccessController; import java.security.PrivilegedAction; -import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; import sun.security.action.GetPropertyAction; /** @@ -420,12 +420,8 @@ public static void setShutdownHook() { AccessController.doPrivileged((PrivilegedAction<Void>) () -> { TraceReporter t = new TraceReporter(); - Thread thread; - if (System.getSecurityManager() == null) { - thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), t); - } else { - thread = new InnocuousThread(t); - } + Thread thread = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), t); thread.setContextClassLoader(null); Runtime.getRuntime().addShutdownHook(thread); return null;
--- a/src/java.desktop/share/classes/sun/java2d/opengl/OGLContext.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/java2d/opengl/OGLContext.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -164,9 +164,6 @@ @Native static final int CAPS_EXT_FBOBJECT = (CAPS_RT_TEXTURE_ALPHA | CAPS_RT_TEXTURE_OPAQUE); - /** Indicates that the context supports a stored alpha channel. */ - @Native - static final int CAPS_STORED_ALPHA = CAPS_RT_PLAIN_ALPHA; /** Indicates that the context is doublebuffered. */ @Native static final int CAPS_DOUBLEBUFFERED = (FIRST_PRIVATE_CAP << 0); @@ -205,9 +202,6 @@ if ((caps & CAPS_EXT_FBOBJECT) != 0) { sb.append("CAPS_EXT_FBOBJECT|"); } - if ((caps & CAPS_STORED_ALPHA) != 0) { - sb.append("CAPS_STORED_ALPHA|"); - } if ((caps & CAPS_DOUBLEBUFFERED) != 0) { sb.append("CAPS_DOUBLEBUFFERED|"); }
--- a/src/java.desktop/share/classes/sun/java2d/opengl/OGLRenderQueue.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/java2d/opengl/OGLRenderQueue.java Tue Jul 14 15:18:26 2015 -0700 @@ -29,6 +29,7 @@ import sun.java2d.pipe.RenderBuffer; import sun.java2d.pipe.RenderQueue; import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; import static sun.java2d.pipe.BufferedOpCodes.*; import java.security.AccessController; @@ -161,11 +162,7 @@ public QueueFlusher() { String name = "Java2D Queue Flusher"; - if (System.getSecurityManager() == null) { - this.thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this, name); - } else { - this.thread = new InnocuousThread(this, name); - } + thread = new ManagedLocalsThread(ThreadGroupUtils.getRootThreadGroup(), this, name); thread.setDaemon(true); thread.setPriority(Thread.MAX_PRIORITY); thread.start();
--- a/src/java.desktop/share/classes/sun/java2d/opengl/OGLSurfaceData.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/java2d/opengl/OGLSurfaceData.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,7 +91,6 @@ * OGL Type Corresponding SurfaceType * -------- ------------------------- * WINDOW OpenGLSurface - * PBUFFER OpenGLSurface * TEXTURE OpenGLTexture * FLIP_BACKBUFFER OpenGLSurface * FBOBJECT OpenGLSurfaceRTT @@ -104,7 +103,6 @@ * * @see sun.java2d.pipe.hw.AccelSurface */ - public static final int PBUFFER = RT_PLAIN; public static final int FBOBJECT = RT_TEXTURE; /** @@ -172,9 +170,6 @@ boolean texRect, int width, int height); protected native boolean initFlipBackbuffer(long pData); - protected abstract boolean initPbuffer(long pData, long pConfigInfo, - boolean isOpaque, - int width, int height); private native int getTextureTarget(long pData); private native int getTextureID(long pData); @@ -250,7 +245,6 @@ return OpenGLTexture; case FBOBJECT: return OpenGLSurfaceRTT; - case PBUFFER: default: return OpenGLSurface; } @@ -266,13 +260,6 @@ boolean success = false; switch (type) { - case PBUFFER: - success = initPbuffer(getNativeOps(), - graphicsConfig.getNativeConfigInfo(), - isOpaque, - width, height); - break; - case TEXTURE: success = initTexture(getNativeOps(), isOpaque, isTexNonPow2Available(), @@ -311,10 +298,9 @@ try { switch (type) { case TEXTURE: - case PBUFFER: case FBOBJECT: // need to make sure the context is current before - // creating the texture (or pbuffer, or fbobject) + // creating the texture or fbobject OGLContext.setScratchSurface(graphicsConfig); break; default:
--- a/src/java.desktop/share/classes/sun/java2d/opengl/OGLUtilities.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/java2d/opengl/OGLUtilities.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,6 @@ */ public static final int UNDEFINED = OGLSurfaceData.UNDEFINED; public static final int WINDOW = OGLSurfaceData.WINDOW; - public static final int PBUFFER = OGLSurfaceData.PBUFFER; public static final int TEXTURE = OGLSurfaceData.TEXTURE; public static final int FLIP_BACKBUFFER = OGLSurfaceData.FLIP_BACKBUFFER; public static final int FBOBJECT = OGLSurfaceData.FBOBJECT;
--- a/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelSurface.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelSurface.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,8 +43,7 @@ */ @Native public static final int WINDOW = 1; /** - * Render-To Plain surface (pbuffer for OpenGL, Render Target surface - * for Direct3D) + * Render-To Plain surface (Render Target surface for Direct3D) */ @Native public static final int RT_PLAIN = 2; /**
--- a/src/java.desktop/share/classes/sun/print/PrintJob2D.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/print/PrintJob2D.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -987,12 +987,7 @@ } private void startPrinterJobThread() { - String name = "printerJobThread"; - if (System.getSecurityManager() == null) { - printerJobThread = new Thread(this, name); - } else { - printerJobThread = new ManagedLocalsThread(this, name); - } + printerJobThread = new ManagedLocalsThread(this, "printerJobThread"); printerJobThread.start(); }
--- a/src/java.desktop/share/classes/sun/print/ServiceNotifier.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/classes/sun/print/ServiceNotifier.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ private PrintServiceAttributeSet lastSet; ServiceNotifier(PrintService service) { - super((Runnable) null, service.getName() + " notifier"); + super(service.getName() + " notifier"); this.service = service; listeners = new Vector<>(); try {
--- a/src/java.desktop/share/native/common/java2d/opengl/OGLContext.h Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLContext.h Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -122,8 +122,6 @@ sun_java2d_opengl_OGLContext_OGLContextCaps_LAST_SHARED_CAP #define CAPS_EXT_FBOBJECT \ sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_EXT_FBOBJECT -#define CAPS_STORED_ALPHA \ - sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_STORED_ALPHA #define CAPS_DOUBLEBUFFERED \ sun_java2d_opengl_OGLContext_OGLContextCaps_CAPS_DOUBLEBUFFERED #define CAPS_EXT_LCD_SHADER \
--- a/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.h Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.h Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -118,7 +118,7 @@ * x/yOffset would be (0,0) (the same applies to pbuffers). * * jint width/height; - * The cached surface bounds. For offscreen surface types (OGLSD_PBUFFER, + * The cached surface bounds. For offscreen surface types (OGLSD_FBOBJECT, * OGLSD_TEXTURE, etc.) these values must remain constant. Onscreen window * surfaces (OGLSD_WINDOW, OGLSD_FLIP_BACKBUFFER, etc.) may have their * bounds changed in response to a programmatic or user-initiated event, so @@ -218,7 +218,6 @@ */ #define OGLSD_UNDEFINED sun_java2d_pipe_hw_AccelSurface_UNDEFINED #define OGLSD_WINDOW sun_java2d_pipe_hw_AccelSurface_WINDOW -#define OGLSD_PBUFFER sun_java2d_pipe_hw_AccelSurface_RT_PLAIN #define OGLSD_TEXTURE sun_java2d_pipe_hw_AccelSurface_TEXTURE #define OGLSD_FLIP_BACKBUFFER sun_java2d_pipe_hw_AccelSurface_FLIP_BACKBUFFER #define OGLSD_FBOBJECT sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE
--- a/src/java.desktop/share/native/libawt/awt/image/awt_parseImage.c Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/native/libawt/awt/image/awt_parseImage.c Tue Jul 14 15:18:26 2015 -0700 @@ -852,7 +852,7 @@ hintP->needToExpand = TRUE; hintP->expandToNbits = cmodelP->maxNbits; } - else if (rasterP->sppsm.offsets != NULL) { + else { for (i=0; i < rasterP->numBands; i++) { if (!(rasterP->sppsm.offsets[i] % 8)) { hintP->needToExpand = TRUE;
--- a/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.c Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.c Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,8 +45,6 @@ CHECK_NULL(g_RasterWidthID = (*env)->GetFieldID(env, cls, "width", "I")); CHECK_NULL(g_RasterHeightID = (*env)->GetFieldID(env, cls, "height", "I")); CHECK_NULL(g_RasterNumBandsID = (*env)->GetFieldID(env, cls, "numBands", "I")); - CHECK_NULL(g_RasterGetDataMID = (*env)->GetMethodID(env, cls, "getDataElements", - "(IIIILjava/lang/Object;)Ljava/lang/Object;")); CHECK_NULL(g_RasterMinXID = (*env)->GetFieldID(env, cls, "minX", "I")); CHECK_NULL(g_RasterMinYID = (*env)->GetFieldID(env, cls, "minY", "I")); CHECK_NULL(g_RasterBaseOriginXID = (*env)->GetFieldID(env, cls, @@ -67,7 +65,6 @@ CHECK_NULL(g_BCRdataID = (*env)->GetFieldID(env, cls, "data", "[B")); CHECK_NULL(g_BCRscanstrID = (*env)->GetFieldID(env, cls, "scanlineStride", "I")); CHECK_NULL(g_BCRpixstrID = (*env)->GetFieldID(env, cls, "pixelStride", "I")); - CHECK_NULL(g_BCRbandoffsID = (*env)->GetFieldID(env, cls, "bandOffset", "I")); CHECK_NULL(g_BCRdataOffsetsID = (*env)->GetFieldID(env, cls, "dataOffsets", "[I")); CHECK_NULL(g_BCRtypeID = (*env)->GetFieldID(env, cls, "type", "I")); } @@ -86,7 +83,6 @@ CHECK_NULL(g_SCRdataID = (*env)->GetFieldID(env, cls, "data", "[S")); CHECK_NULL(g_SCRscanstrID = (*env)->GetFieldID(env, cls, "scanlineStride", "I")); CHECK_NULL(g_SCRpixstrID = (*env)->GetFieldID(env, cls, "pixelStride", "I")); - CHECK_NULL(g_SCRbandoffsID = (*env)->GetFieldID(env, cls, "bandOffset", "I")); CHECK_NULL(g_SCRdataOffsetsID = (*env)->GetFieldID(env, cls, "dataOffsets", "[I")); CHECK_NULL(g_SCRtypeID = (*env)->GetFieldID(env, cls, "type", "I")); } @@ -96,9 +92,6 @@ CHECK_NULL(g_ICRscanstrID = (*env)->GetFieldID(env, cls, "scanlineStride", "I")); CHECK_NULL(g_ICRpixstrID = (*env)->GetFieldID(env, cls, "pixelStride", "I")); CHECK_NULL(g_ICRdataOffsetsID = (*env)->GetFieldID(env, cls, "dataOffsets", "[I")); - CHECK_NULL(g_ICRbandoffsID = (*env)->GetFieldID(env, cls, "bandOffset", "I")); - CHECK_NULL(g_ICRputDataMID = (*env)->GetMethodID(env, cls, "setDataElements", - "(IIIILjava/lang/Object;)V")); CHECK_NULL(g_ICRtypeID = (*env)->GetFieldID(env, cls, "type", "I")); } @@ -121,8 +114,6 @@ CHECK_NULL(g_CMisAlphaPreID = (*env)->GetFieldID(env, cls, "isAlphaPremultiplied", "Z")); CHECK_NULL(g_CMtransparencyID = (*env)->GetFieldID(env, cls, "transparency", "I")); - CHECK_NULL(g_CMgetRGBMID = (*env)->GetMethodID(env, cls, "getRGB", - "(Ljava/lang/Object;)I")); CHECK_NULL(g_CMcsTypeID = (*env)->GetFieldID(env, cls, "colorSpaceType", "I")); CHECK_NULL(g_CMis_sRGBID = (*env)->GetFieldID(env, cls, "is_sRGB", "Z")); CHECK_NULL(g_CMgetRGBdefaultMID = (*env)->GetStaticMethodID(env, cls, @@ -148,20 +139,8 @@ } JNIEXPORT void JNICALL -Java_java_awt_image_ComponentSampleModel_initIDs(JNIEnv *env, jclass cls) { - CHECK_NULL(g_CSMPixStrideID = (*env)->GetFieldID(env, cls, "pixelStride", "I")); - CHECK_NULL(g_CSMScanStrideID = (*env)->GetFieldID(env, cls, "scanlineStride", "I")); - CHECK_NULL(g_CSMBandOffsetsID = (*env)->GetFieldID(env, cls, "bandOffsets", "[I")); -} - -JNIEXPORT void JNICALL Java_java_awt_image_Kernel_initIDs(JNIEnv *env, jclass cls) { CHECK_NULL(g_KernelWidthID = (*env)->GetFieldID(env, cls, "width", "I")); CHECK_NULL(g_KernelHeightID = (*env)->GetFieldID(env, cls, "height", "I")); CHECK_NULL(g_KernelDataID = (*env)->GetFieldID(env, cls, "data", "[F")); } - -JNIEXPORT void JNICALL -Java_java_awt_image_DataBufferInt_initIDs(JNIEnv *env, jclass cls) { - CHECK_NULL(g_DataBufferIntPdataID = (*env)->GetFieldID(env, cls, "pData", "J")); -}
--- a/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,6 @@ /* Raster ids */ IMGEXTERN jfieldID g_RasterWidthID; IMGEXTERN jfieldID g_RasterHeightID; -IMGEXTERN jfieldID g_RasterNumBandsID; IMGEXTERN jfieldID g_RasterBaseRasterID; IMGEXTERN jfieldID g_RasterMinXID; IMGEXTERN jfieldID g_RasterMinYID; @@ -52,12 +51,10 @@ IMGEXTERN jfieldID g_RasterDataBufferID; IMGEXTERN jfieldID g_RasterNumDataElementsID; IMGEXTERN jfieldID g_RasterNumBandsID; -IMGEXTERN jmethodID g_RasterGetDataMID; IMGEXTERN jfieldID g_BCRdataID; IMGEXTERN jfieldID g_BCRscanstrID; IMGEXTERN jfieldID g_BCRpixstrID; -IMGEXTERN jfieldID g_BCRbandoffsID; IMGEXTERN jfieldID g_BCRdataOffsetsID; IMGEXTERN jfieldID g_BCRtypeID; IMGEXTERN jfieldID g_BPRdataID; @@ -68,16 +65,13 @@ IMGEXTERN jfieldID g_SCRdataID; IMGEXTERN jfieldID g_SCRscanstrID; IMGEXTERN jfieldID g_SCRpixstrID; -IMGEXTERN jfieldID g_SCRbandoffsID; IMGEXTERN jfieldID g_SCRdataOffsetsID; IMGEXTERN jfieldID g_SCRtypeID; IMGEXTERN jfieldID g_ICRdataID; IMGEXTERN jfieldID g_ICRscanstrID; IMGEXTERN jfieldID g_ICRpixstrID; -IMGEXTERN jfieldID g_ICRbandoffsID; IMGEXTERN jfieldID g_ICRdataOffsetsID; IMGEXTERN jfieldID g_ICRtypeID; -IMGEXTERN jmethodID g_ICRputDataMID; /* Color Model ids */ IMGEXTERN jfieldID g_CMpDataID; @@ -87,7 +81,6 @@ IMGEXTERN jfieldID g_CMsuppAlphaID; IMGEXTERN jfieldID g_CMisAlphaPreID; IMGEXTERN jfieldID g_CMtransparencyID; -IMGEXTERN jmethodID g_CMgetRGBMID; IMGEXTERN jfieldID g_CMcsTypeID; IMGEXTERN jfieldID g_CMis_sRGBID; IMGEXTERN jmethodID g_CMgetRGBdefaultMID; @@ -108,19 +101,9 @@ IMGEXTERN jfieldID g_SPPSMnBitsID; IMGEXTERN jfieldID g_SPPSMmaxBitID; -/* Component Sample Model ids */ -IMGEXTERN jfieldID g_CSMPixStrideID; -IMGEXTERN jfieldID g_CSMScanStrideID; -IMGEXTERN jfieldID g_CSMBandOffsetsID; - /* Kernel ids */ IMGEXTERN jfieldID g_KernelWidthID; IMGEXTERN jfieldID g_KernelHeightID; -IMGEXTERN jfieldID g_KernelXOriginID; -IMGEXTERN jfieldID g_KernelYOriginD; IMGEXTERN jfieldID g_KernelDataID; -/* DataBufferInt ids */ -IMGEXTERN jfieldID g_DataBufferIntPdataID; - #endif /* IMAGEINITIDS_H */
--- a/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c Tue Jul 14 15:18:26 2015 -0700 @@ -48,8 +48,8 @@ int stride; ImageFormat srcFormat; png_uint_32 i, rowbytes; - png_bytepp row_pointers = NULL; - png_bytep image_data = NULL; + volatile png_bytepp row_pointers = NULL; + volatile png_bytep image_data = NULL; int success = 0; double gamma;
--- a/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -116,12 +116,7 @@ showNativeDialog(); fd.setVisible(false); }; - if (System.getSecurityManager() == null) { - new Thread(task).start(); - } else { - new ManagedLocalsThread(task).start(); - } - + new ManagedLocalsThread(task).start(); } else { quit(); fd.setVisible(false);
--- a/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ import java.awt.event.*; import java.awt.peer.TrayIconPeer; import sun.awt.*; -import sun.misc.InnocuousThread; import sun.misc.ManagedLocalsThread; import java.awt.image.*; @@ -455,11 +454,7 @@ final Thread thread; Displayer() { - if (System.getSecurityManager() == null) { - this.thread = new Thread(this); - } else { - this.thread = new ManagedLocalsThread(this); - } + this.thread = new ManagedLocalsThread(this); this.thread.setDaemon(true); }
--- a/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -138,6 +138,7 @@ setScrollBarVisibility(); // After this line we should not change the component's text firstChangeSkipped = true; + compAccessor.setPeer(textPane, this); } @Override @@ -146,7 +147,6 @@ // visible caret has a timer thread which must be stopped jtext.getCaret().setVisible(false); jtext.removeNotify(); - textPane.removeNotify(); super.dispose(); }
--- a/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,6 +95,7 @@ // After this line we should not change the component's text firstChangeSkipped = true; + AWTAccessor.getComponentAccessor().setPeer(xtext, this); } @Override @@ -102,7 +103,6 @@ XToolkit.specialPeerMap.remove(xtext); // visible caret has a timer thread which must be stopped xtext.getCaret().setVisible(false); - xtext.removeNotify(); super.dispose(); } @@ -259,7 +259,9 @@ } background = c; if (xtext != null) { - xtext.setBackground(c); + if (xtext.getBackground() != c) { + xtext.setBackground(c); + } xtext.setSelectedTextColor(c); } repaintText(); @@ -269,7 +271,9 @@ public void setForeground(Color c) { foreground = c; if (xtext != null) { - xtext.setForeground(foreground); + if (xtext.getForeground() != c) { + xtext.setForeground(foreground); + } xtext.setSelectionColor(foreground); xtext.setCaretColor(foreground); } @@ -280,7 +284,7 @@ public void setFont(Font f) { synchronized (getStateLock()) { font = f; - if (xtext != null) { + if (xtext != null && xtext.getFont() != f) { xtext.setFont(font); } }
--- a/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java Tue Jul 14 15:18:26 2015 -0700 @@ -281,12 +281,8 @@ } }; String name = "XToolkt-Shutdown-Thread"; - Thread shutdownThread; - if (System.getSecurityManager() == null) { - shutdownThread = new Thread(ThreadGroupUtils.getRootThreadGroup(), r, name); - } else { - shutdownThread = new InnocuousThread(r, name); - } + Thread shutdownThread = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), r, name); shutdownThread.setContextClassLoader(null); Runtime.getRuntime().addShutdownHook(shutdownThread); return null; @@ -333,12 +329,8 @@ toolkitThread = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> { String name = "AWT-XAWT"; - Thread thread; - if (System.getSecurityManager() == null) { - thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), XToolkit.this, name); - } else { - thread = new InnocuousThread(XToolkit.this, name); - } + Thread thread = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), this, name); thread.setContextClassLoader(null); thread.setPriority(Thread.NORM_PRIORITY + 1); thread.setDaemon(true);
--- a/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java Tue Jul 14 15:18:26 2015 -0700 @@ -682,28 +682,33 @@ GraphicsConfiguration newGC = null; Rectangle screenBounds; - for (int i = 0; i < gds.length; i++) { - screenBounds = gds[i].getDefaultConfiguration().getBounds(); - if (newBounds.intersects(screenBounds)) { - horizAmt = Math.min(newBounds.x + newBounds.width, - screenBounds.x + screenBounds.width) - - Math.max(newBounds.x, screenBounds.x); - vertAmt = Math.min(newBounds.y + newBounds.height, - screenBounds.y + screenBounds.height)- - Math.max(newBounds.y, screenBounds.y); - intAmt = horizAmt * vertAmt; - if (intAmt == area) { - // Completely on this screen - done! - newScreenNum = i; - newGC = gds[i].getDefaultConfiguration(); - break; - } - if (intAmt > largestAmt) { - largestAmt = intAmt; - newScreenNum = i; - newGC = gds[i].getDefaultConfiguration(); + XToolkit.awtUnlock(); + try { + for (int i = 0; i < gds.length; i++) { + screenBounds = gds[i].getDefaultConfiguration().getBounds(); + if (newBounds.intersects(screenBounds)) { + horizAmt = Math.min(newBounds.x + newBounds.width, + screenBounds.x + screenBounds.width) - + Math.max(newBounds.x, screenBounds.x); + vertAmt = Math.min(newBounds.y + newBounds.height, + screenBounds.y + screenBounds.height)- + Math.max(newBounds.y, screenBounds.y); + intAmt = horizAmt * vertAmt; + if (intAmt == area) { + // Completely on this screen - done! + newScreenNum = i; + newGC = gds[i].getDefaultConfiguration(); + break; + } + if (intAmt > largestAmt) { + largestAmt = intAmt; + newScreenNum = i; + newGC = gds[i].getDefaultConfiguration(); + } } } + } finally { + XToolkit.awtLock(); } if (newScreenNum != curScreenNum) { if (log.isLoggable(PlatformLogger.Level.FINEST)) {
--- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java Tue Jul 14 15:18:26 2015 -0700 @@ -43,7 +43,7 @@ import sun.java2d.loops.SurfaceType; import sun.awt.util.ThreadGroupUtils; -import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; /** * This is an implementation of a GraphicsDevice object for a single @@ -284,7 +284,6 @@ * Returns true only if: * - the Xrandr extension is present * - the necessary Xrandr functions were loaded successfully - * - XINERAMA is not enabled */ private static synchronized boolean isXrandrExtensionSupported() { if (xrandrExtSupported == null) { @@ -316,7 +315,9 @@ @Override public boolean isDisplayChangeSupported() { - return (isFullScreenSupported() && (getFullScreenWindow() != null)); + return (isFullScreenSupported() + && !((X11GraphicsEnvironment) GraphicsEnvironment + .getLocalGraphicsEnvironment()).runningXinerama()); } private static void enterFullScreenExclusive(Window w) { @@ -346,7 +347,9 @@ if (fsSupported && old != null) { // enter windowed mode (and restore original display mode) exitFullScreenExclusive(old); - setDisplayMode(origDisplayMode); + if (isDisplayChangeSupported()) { + setDisplayMode(origDisplayMode); + } } super.setFullScreenWindow(w); @@ -428,16 +431,14 @@ Window old = getFullScreenWindow(); if (old != null) { exitFullScreenExclusive(old); - setDisplayMode(origDisplayMode); + if (isDisplayChangeSupported()) { + setDisplayMode(origDisplayMode); + } } }; String name = "Display-Change-Shutdown-Thread-" + screen; - Thread t; - if (System.getSecurityManager() == null) { - t = new Thread(ThreadGroupUtils.getRootThreadGroup(), r, name); - } else { - t = new InnocuousThread(r, name); - } + Thread t = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), r, name); t.setContextClassLoader(null); Runtime.getRuntime().addShutdownHook(t); return null;
--- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -399,23 +399,11 @@ createCompatibleVolatileImage(int width, int height, int transparency, int type) { - if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED || - transparency == Transparency.BITMASK) - { + if ((type != FBOBJECT && type != TEXTURE) + || transparency == Transparency.BITMASK + || type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) { return null; } - - if (type == FBOBJECT) { - if (!isCapPresent(CAPS_EXT_FBOBJECT)) { - return null; - } - } else if (type == PBUFFER) { - boolean isOpaque = transparency == Transparency.OPAQUE; - if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) { - return null; - } - } - SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height, transparency, type); Surface sd = vi.getDestSurface();
--- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,11 +30,10 @@ import java.awt.GraphicsEnvironment; import java.awt.Image; import java.awt.Rectangle; -import java.awt.Transparency; import java.awt.image.ColorModel; + import sun.awt.X11ComponentPeer; import sun.java2d.SurfaceData; -import sun.java2d.loops.SurfaceType; public abstract class GLXSurfaceData extends OGLSurfaceData { @@ -42,9 +41,6 @@ private GLXGraphicsConfig graphicsConfig; private native void initOps(X11ComponentPeer peer, long aData); - protected native boolean initPbuffer(long pData, long pConfigInfo, - boolean isOpaque, - int width, int height); protected GLXSurfaceData(X11ComponentPeer peer, GLXGraphicsConfig gc, ColorModel cm, int type) @@ -91,7 +87,7 @@ /** * Creates a SurfaceData object representing an off-screen buffer (either - * a Pbuffer or Texture). + * a FBO or Texture). */ public static GLXOffScreenSurfaceData createData(GLXGraphicsConfig gc, int width, int height,
--- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java Tue Jul 14 15:18:26 2015 -0700 @@ -46,7 +46,7 @@ public class GLXVolatileSurfaceManager extends VolatileSurfaceManager { - private boolean accelerationEnabled; + private final boolean accelerationEnabled; public GLXVolatileSurfaceManager(SunVolatileImage vImg, Object context) { super(vImg, context); @@ -54,18 +54,13 @@ /* * We will attempt to accelerate this image only under the * following conditions: - * - the image is opaque OR - * - the image is translucent AND - * - the GraphicsConfig supports the FBO extension OR - * - the GraphicsConfig has a stored alpha channel + * - the image is not bitmask AND the GraphicsConfig supports the FBO + * extension */ int transparency = vImg.getTransparency(); - GLXGraphicsConfig gc = (GLXGraphicsConfig)vImg.getGraphicsConfig(); - accelerationEnabled = - (transparency == Transparency.OPAQUE) || - ((transparency == Transparency.TRANSLUCENT) && - (gc.isCapPresent(CAPS_EXT_FBOBJECT) || - gc.isCapPresent(CAPS_STORED_ALPHA))); + GLXGraphicsConfig gc = (GLXGraphicsConfig) vImg.getGraphicsConfig(); + accelerationEnabled = gc.isCapPresent(CAPS_EXT_FBOBJECT) + && transparency != Transparency.BITMASK; } protected boolean isAccelerationEnabled() { @@ -73,7 +68,7 @@ } /** - * Create a pbuffer-based SurfaceData object (or init the backbuffer + * Create a FBO-based SurfaceData object (or init the backbuffer * of an existing window if this is a double buffered GraphicsConfig) */ protected SurfaceData initAcceleratedSurface() { @@ -113,10 +108,9 @@ ColorModel cm = gc.getColorModel(vImg.getTransparency()); int type = vImg.getForcedAccelSurfaceType(); // if acceleration type is forced (type != UNDEFINED) then - // use the forced type, otherwise choose one based on caps + // use the forced type, otherwise choose FBOBJECT if (type == OGLSurfaceData.UNDEFINED) { - type = gc.isCapPresent(CAPS_EXT_FBOBJECT) ? - OGLSurfaceData.FBOBJECT : OGLSurfaceData.PBUFFER; + type = OGLSurfaceData.FBOBJECT; } if (createVSynced) { sData = GLXSurfaceData.createData(peer, vImg, type);
--- a/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -213,12 +213,7 @@ public PrintServiceLookupProvider() { // start the printer listener thread if (pollServices) { - Thread thr; - if (System.getSecurityManager() == null) { - thr = new Thread(new PrinterChangeListener()); - } else { - thr = new ManagedLocalsThread(new PrinterChangeListener()); - } + Thread thr = new ManagedLocalsThread(new PrinterChangeListener()); thr.setDaemon(true); thr.start(); IPPPrintService.debug_println(debugPrefix+"polling turned on");
--- a/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.c Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.c Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -472,7 +472,7 @@ GLXPbuffer scratch; GLXGraphicsConfigInfo *glxinfo; jint caps = CAPS_EMPTY; - int db, alpha; + int db; const unsigned char *versionstr; J2dRlsTraceLn(J2D_TRACE_INFO, "GLXGraphicsConfig_getGLXConfigInfo"); @@ -583,10 +583,6 @@ if (db) { caps |= CAPS_DOUBLEBUFFERED; } - j2d_glXGetFBConfigAttrib(awt_display, fbconfig, GLX_ALPHA_SIZE, &alpha); - if (alpha > 0) { - caps |= CAPS_STORED_ALPHA; - } // initialize the OGLContext, which wraps the GLXFBConfig and GLXContext oglc = GLXGC_InitOGLContext(fbconfig, context, scratch, caps);
--- a/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,25 +111,13 @@ /** * This function disposes of any native windowing system resources associated - * with this surface. For instance, if the given OGLSDOps is of type - * OGLSD_PBUFFER, this method implementation will destroy the actual pbuffer - * surface. + * with this surface. */ void OGLSD_DestroyOGLSurface(JNIEnv *env, OGLSDOps *oglsdo) { - GLXSDOps *glxsdo = (GLXSDOps *)oglsdo->privOps; - J2dTraceLn(J2D_TRACE_INFO, "OGLSD_DestroyOGLSurface"); - - if (oglsdo->drawableType == OGLSD_PBUFFER) { - if (glxsdo->drawable != 0) { - j2d_glXDestroyPbuffer(awt_display, glxsdo->drawable); - glxsdo->drawable = 0; - } - } else if (oglsdo->drawableType == OGLSD_WINDOW) { - // X Window is free'd later by AWT code... - } + // X Window is free'd later by AWT code... } /** @@ -358,74 +346,6 @@ return 0; } -JNIEXPORT jboolean JNICALL -Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer - (JNIEnv *env, jobject glxsd, - jlong pData, jlong pConfigInfo, - jboolean isOpaque, - jint width, jint height) -{ - OGLSDOps *oglsdo = (OGLSDOps *)jlong_to_ptr(pData); - GLXGraphicsConfigInfo *glxinfo = - (GLXGraphicsConfigInfo *)jlong_to_ptr(pConfigInfo); - GLXSDOps *glxsdo; - GLXPbuffer pbuffer; - int attrlist[] = {GLX_PBUFFER_WIDTH, 0, - GLX_PBUFFER_HEIGHT, 0, - GLX_PRESERVED_CONTENTS, GL_FALSE, 0}; - - J2dTraceLn3(J2D_TRACE_INFO, - "GLXSurfaceData_initPbuffer: w=%d h=%d opq=%d", - width, height, isOpaque); - - if (oglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "GLXSurfaceData_initPbuffer: ops are null"); - return JNI_FALSE; - } - - glxsdo = (GLXSDOps *)oglsdo->privOps; - if (glxsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "GLXSurfaceData_initPbuffer: glx ops are null"); - return JNI_FALSE; - } - - if (glxinfo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "GLXSurfaceData_initPbuffer: glx config info is null"); - return JNI_FALSE; - } - - attrlist[1] = width; - attrlist[3] = height; - - surfaceCreationFailed = JNI_FALSE; - EXEC_WITH_XERROR_HANDLER( - GLXSD_BadAllocXErrHandler, - pbuffer = j2d_glXCreatePbuffer(awt_display, - glxinfo->fbconfig, attrlist)); - if ((pbuffer == 0) || surfaceCreationFailed) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "GLXSurfaceData_initPbuffer: could not create glx pbuffer"); - return JNI_FALSE; - } - - oglsdo->drawableType = OGLSD_PBUFFER; - oglsdo->isOpaque = isOpaque; - oglsdo->width = width; - oglsdo->height = height; - oglsdo->xOffset = 0; - oglsdo->yOffset = 0; - - glxsdo->drawable = pbuffer; - glxsdo->xdrawable = 0; - - OGLSD_SetNativeDimensions(env, oglsdo, width, height); - - return JNI_TRUE; -} - void OGLSD_SwapBuffers(JNIEnv *env, jlong window) {
--- a/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -554,8 +554,10 @@ curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout); } else if (timeout_control == TIMEOUT_EVENTS) { /* subtract 1/4 (plus 1, in case the division truncates to 0) */ - curPollTimeout -= ((curPollTimeout>>2) + 1); - curPollTimeout = max(AWT_MIN_POLL_TIMEOUT, curPollTimeout); + if (curPollTimeout > 0) { + curPollTimeout -= ((curPollTimeout>>2) + 1); + curPollTimeout = max(AWT_MIN_POLL_TIMEOUT, curPollTimeout); + } } break; case AWT_POLL_AGING_FAST:
--- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Tue Jul 14 15:18:26 2015 -0700 @@ -41,8 +41,7 @@ import static sun.awt.shell.Win32ShellFolder2.*; import sun.awt.OSInfo; import sun.awt.util.ThreadGroupUtils; -import sun.misc.InnocuousThread; - +import sun.misc.ManagedLocalsThread; // NOTE: This class supersedes Win32ShellFolderManager, which was removed // from distribution after version 1.4.2. @@ -525,12 +524,8 @@ return null; }); AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - Thread t; - if (System.getSecurityManager() == null) { - t = new Thread(ThreadGroupUtils.getRootThreadGroup(), shutdownHook); - } else { - t = new InnocuousThread(shutdownHook); - } + Thread t = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), shutdownHook); Runtime.getRuntime().addShutdownHook(t); return null; }); @@ -549,17 +544,12 @@ }; comThread = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> { String name = "Swing-Shell"; - Thread thread; - if (System.getSecurityManager() == null) { - /* The thread must be a member of a thread group - * which will not get GCed before VM exit. - * Make its parent the top-level thread group. - */ - thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), comRun, name); - } else { - /* InnocuousThread is a member of a correct TG by default */ - thread = new InnocuousThread(comRun, name); - } + /* The thread must be a member of a thread group + * which will not get GCed before VM exit. + * Make its parent the top-level thread group. + */ + Thread thread = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), comRun, name); thread.setDaemon(true); return thread; });
--- a/src/java.desktop/windows/classes/sun/awt/windows/WFileDialogPeer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/classes/sun/awt/windows/WFileDialogPeer.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -98,11 +98,7 @@ @Override public void show() { - if (System.getSecurityManager() == null) { - new Thread(this::_show).start(); - } else { - new ManagedLocalsThread(this::_show).start(); - } + new ManagedLocalsThread(this::_show).start(); } @Override
--- a/src/java.desktop/windows/classes/sun/awt/windows/WPageDialogPeer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/classes/sun/awt/windows/WPageDialogPeer.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,10 +53,6 @@ } ((WPrintDialog)target).setVisible(false); }; - if (System.getSecurityManager() == null) { - new Thread(runnable).start(); - } else { - new ManagedLocalsThread(runnable).start(); - } + new ManagedLocalsThread(runnable).start(); } }
--- a/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialogPeer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialogPeer.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -78,11 +78,7 @@ } ((WPrintDialog)target).setVisible(false); }; - if (System.getSecurityManager() == null) { - new Thread(runnable).start(); - } else { - new ManagedLocalsThread(runnable).start(); - } + new ManagedLocalsThread(runnable).start(); } synchronized void setHWnd(long hwnd) {
--- a/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java Tue Jul 14 15:18:26 2015 -0700 @@ -51,7 +51,7 @@ import sun.java2d.d3d.D3DRenderQueue; import sun.java2d.opengl.OGLRenderQueue; -import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; import sun.print.PrintJob2D; import java.awt.dnd.DragSource; @@ -255,12 +255,7 @@ (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup); if (!startToolkitThread(this, rootTG)) { String name = "AWT-Windows"; - Thread toolkitThread; - if (System.getSecurityManager() == null) { - toolkitThread = new Thread(rootTG, this, name); - } else { - toolkitThread = new InnocuousThread(this, name); - } + Thread toolkitThread = new ManagedLocalsThread(rootTG, this, name); toolkitThread.setDaemon(true); toolkitThread.start(); } @@ -287,16 +282,12 @@ private void registerShutdownHook() { AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - Thread shutdown; - if (System.getSecurityManager() == null) { - shutdown = new Thread(ThreadGroupUtils.getRootThreadGroup(), this::shutdown); - } else { - shutdown = new InnocuousThread(this::shutdown); - } + Thread shutdown = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), this::shutdown); shutdown.setContextClassLoader(null); Runtime.getRuntime().addShutdownHook(shutdown); return null; - }); + }); } @Override
--- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java Tue Jul 14 15:18:26 2015 -0700 @@ -49,7 +49,7 @@ import sun.java2d.windows.GDIWindowSurfaceData; import sun.java2d.d3d.D3DSurfaceData.D3DWindowSurfaceData; import sun.java2d.windows.WindowsFlags; -import sun.misc.InnocuousThread; +import sun.misc.ManagedLocalsThread; /** * This class handles rendering to the screen with the D3D pipeline. @@ -99,12 +99,8 @@ done = true; wakeUpUpdateThread(); }; - Thread shutdown; - if (System.getSecurityManager() == null) { - shutdown = new Thread(ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable); - } else { - shutdown = new InnocuousThread(shutdownRunnable); - } + Thread shutdown = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable); shutdown.setContextClassLoader(null); try { Runtime.getRuntime().addShutdownHook(shutdown); @@ -351,15 +347,9 @@ private synchronized void startUpdateThread() { if (screenUpdater == null) { screenUpdater = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> { - Thread t; String name = "D3D Screen Updater"; - if (System.getSecurityManager() == null) { - t = new Thread(ThreadGroupUtils.getRootThreadGroup(), - D3DScreenUpdateManager.this, - name); - } else { - t = new InnocuousThread(D3DScreenUpdateManager.this, name); - } + Thread t = new ManagedLocalsThread( + ThreadGroupUtils.getRootThreadGroup(), this, name); // REMIND: should it be higher? t.setPriority(Thread.NORM_PRIORITY + 2); t.setDaemon(true);
--- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ import java.awt.AWTException; import java.awt.BufferCapabilities; -import java.awt.BufferCapabilities.FlipContents; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; @@ -425,23 +424,11 @@ createCompatibleVolatileImage(int width, int height, int transparency, int type) { - if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED || - transparency == Transparency.BITMASK) - { + if ((type != FBOBJECT && type != TEXTURE) + || transparency == Transparency.BITMASK + || type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) { return null; } - - if (type == FBOBJECT) { - if (!isCapPresent(CAPS_EXT_FBOBJECT)) { - return null; - } - } else if (type == PBUFFER) { - boolean isOpaque = transparency == Transparency.OPAQUE; - if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) { - return null; - } - } - SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height, transparency, type); Surface sd = vi.getDestSurface();
--- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,9 +43,6 @@ private native void initOps(long pConfigInfo, WComponentPeer peer, long hwnd); - protected native boolean initPbuffer(long pData, long pConfigInfo, - boolean isOpaque, - int width, int height); protected WGLSurfaceData(WComponentPeer peer, WGLGraphicsConfig gc, ColorModel cm, int type)
--- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java Tue Jul 14 15:18:26 2015 -0700 @@ -43,10 +43,9 @@ import sun.java2d.pipe.hw.ExtendedBufferCapabilities; import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*; -public class WGLVolatileSurfaceManager - extends VolatileSurfaceManager -{ - private boolean accelerationEnabled; +public class WGLVolatileSurfaceManager extends VolatileSurfaceManager { + + private final boolean accelerationEnabled; public WGLVolatileSurfaceManager(SunVolatileImage vImg, Object context) { super(vImg, context); @@ -54,18 +53,13 @@ /* * We will attempt to accelerate this image only under the * following conditions: - * - the image is opaque OR - * - the image is translucent AND - * - the GraphicsConfig supports the FBO extension OR - * - the GraphicsConfig has a stored alpha channel + * - the image is not bitmask AND the GraphicsConfig supports the FBO + * extension */ int transparency = vImg.getTransparency(); - WGLGraphicsConfig gc = (WGLGraphicsConfig)vImg.getGraphicsConfig(); - accelerationEnabled = - (transparency == Transparency.OPAQUE) || - ((transparency == Transparency.TRANSLUCENT) && - (gc.isCapPresent(CAPS_EXT_FBOBJECT) || - gc.isCapPresent(CAPS_STORED_ALPHA))); + WGLGraphicsConfig gc = (WGLGraphicsConfig) vImg.getGraphicsConfig(); + accelerationEnabled = gc.isCapPresent(CAPS_EXT_FBOBJECT) + && transparency != Transparency.BITMASK; } protected boolean isAccelerationEnabled() { @@ -73,7 +67,7 @@ } /** - * Create a pbuffer-based SurfaceData object (or init the backbuffer + * Create a FBO-based SurfaceData object (or init the backbuffer * of an existing window if this is a double buffered GraphicsConfig). */ protected SurfaceData initAcceleratedSurface() { @@ -111,10 +105,9 @@ ColorModel cm = gc.getColorModel(vImg.getTransparency()); int type = vImg.getForcedAccelSurfaceType(); // if acceleration type is forced (type != UNDEFINED) then - // use the forced type, otherwise choose one based on caps + // use the forced type, otherwise choose FBOBJECT if (type == OGLSurfaceData.UNDEFINED) { - type = gc.isCapPresent(CAPS_EXT_FBOBJECT) ? - OGLSurfaceData.FBOBJECT : OGLSurfaceData.PBUFFER; + type = OGLSurfaceData.FBOBJECT; } if (createVSynced) { sData = WGLSurfaceData.createData(peer, vImg, type);
--- a/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -99,12 +99,7 @@ return; } // start the printer listener thread - Thread thr; - if (System.getSecurityManager() == null) { - thr = new Thread(new PrinterChangeListener()); - } else { - thr = new ManagedLocalsThread(new PrinterChangeListener()); - } + Thread thr = new ManagedLocalsThread(new PrinterChangeListener()); thr.setDaemon(true); thr.start(); } /* else condition ought to never happen! */
--- a/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.c Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.c Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -502,8 +502,8 @@ const unsigned char *versionstr; const char *extstr; jint caps = CAPS_EMPTY; - int attrKeys[] = { WGL_DOUBLE_BUFFER_ARB, WGL_ALPHA_BITS_ARB }; - int attrVals[2]; + int attrKeys[] = { WGL_DOUBLE_BUFFER_ARB}; + int attrVals[1]; J2dRlsTraceLn(J2D_TRACE_INFO, "WGLGraphicsConfig_getWGLConfigInfo"); @@ -624,13 +624,10 @@ } // get config-specific capabilities - j2d_wglGetPixelFormatAttribivARB(hdc, pixfmt, 0, 2, attrKeys, attrVals); + j2d_wglGetPixelFormatAttribivARB(hdc, pixfmt, 0, 1, attrKeys, attrVals); if (attrVals[0]) { caps |= CAPS_DOUBLEBUFFERED; } - if (attrVals[1] > 0) { - caps |= CAPS_STORED_ALPHA; - } // create the scratch pbuffer scratch = j2d_wglCreatePbufferARB(hdc, pixfmt, 1, 1, NULL);
--- a/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.c Tue Jul 14 20:14:29 2015 +0100 +++ b/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.c Tue Jul 14 15:18:26 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -107,28 +107,13 @@ /** * This function disposes of any native windowing system resources associated - * with this surface. For instance, if the given OGLSDOps is of type - * OGLSD_PBUFFER, this method implementation will destroy the actual pbuffer - * surface. + * with this surface. */ void OGLSD_DestroyOGLSurface(JNIEnv *env, OGLSDOps *oglsdo) { - WGLSDOps *wglsdo = (WGLSDOps *)oglsdo->privOps; - J2dTraceLn(J2D_TRACE_INFO, "OGLSD_DestroyOGLSurface"); - - if (oglsdo->drawableType == OGLSD_PBUFFER) { - if (wglsdo->pbuffer != 0) { - if (wglsdo->pbufferDC != 0) { - j2d_wglReleasePbufferDCARB(wglsdo->pbuffer, - wglsdo->pbufferDC); - wglsdo->pbufferDC = 0; - } - j2d_wglDestroyPbufferARB(wglsdo->pbuffer); - wglsdo->pbuffer = 0; - } - } + // Window is free'd later by AWT code... } /** @@ -276,19 +261,11 @@ ctxinfo = (WGLCtxInfo *)oglc->ctxInfo; // get the hdc for the destination surface - if (dstOps->drawableType == OGLSD_PBUFFER) { - dstHDC = dstWGLOps->pbufferDC; - } else { - dstHDC = GetDC(dstWGLOps->window); - } + dstHDC = GetDC(dstWGLOps->window); // get the hdc for the source surface - if (srcOps->drawableType == OGLSD_PBUFFER) { - srcHDC = srcWGLOps->pbufferDC; - } else { - // the source will always be equal to the destination in this case - srcHDC = dstHDC; - } + // the source will always be equal to the destination in this case + srcHDC = dstHDC; // REMIND: in theory we should be able to use wglMakeContextCurrentARB() // even when the src/dst surfaces are the same, but this causes problems @@ -306,9 +283,7 @@ if (!success) { J2dRlsTraceLn(J2D_TRACE_ERROR, "OGLSD_MakeOGLContextCurrent: could not make current"); - if (dstOps->drawableType != OGLSD_PBUFFER) { - ReleaseDC(dstWGLOps->window, dstHDC); - } + ReleaseDC(dstWGLOps->window, dstHDC); return NULL; } @@ -319,9 +294,7 @@ j2d_glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); } - if (dstOps->drawableType != OGLSD_PBUFFER) { - ReleaseDC(dstWGLOps->window, dstHDC); - } + ReleaseDC(dstWGLOps->window, dstHDC); return oglc; } @@ -400,141 +373,6 @@ return JNI_TRUE; } -JNIEXPORT jboolean JNICALL -Java_sun_java2d_opengl_WGLSurfaceData_initPbuffer - (JNIEnv *env, jobject wglsd, - jlong pData, jlong pConfigInfo, - jboolean isOpaque, - jint width, jint height) -{ - int attrKeys[] = { - WGL_MAX_PBUFFER_WIDTH_ARB, - WGL_MAX_PBUFFER_HEIGHT_ARB, - }; - int attrVals[2]; - int pbAttrList[] = { 0 }; - OGLSDOps *oglsdo = (OGLSDOps *)jlong_to_ptr(pData); - WGLGraphicsConfigInfo *wglInfo = - (WGLGraphicsConfigInfo *)jlong_to_ptr(pConfigInfo); - WGLSDOps *wglsdo; - HWND hwnd; - HDC hdc, pbufferDC; - HPBUFFERARB pbuffer; - int maxWidth, maxHeight; - int actualWidth, actualHeight; - - J2dTraceLn3(J2D_TRACE_INFO, - "WGLSurfaceData_initPbuffer: w=%d h=%d opq=%d", - width, height, isOpaque); - - if (oglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: ops are null"); - return JNI_FALSE; - } - - wglsdo = (WGLSDOps *)oglsdo->privOps; - if (wglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: wgl ops are null"); - return JNI_FALSE; - } - - if (wglInfo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: wgl config info is null"); - return JNI_FALSE; - } - - // create a scratch window - hwnd = WGLGC_CreateScratchWindow(wglInfo->screen); - if (hwnd == 0) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: could not create scratch window"); - return JNI_FALSE; - } - - // get the HDC for the scratch window - hdc = GetDC(hwnd); - if (hdc == 0) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: could not get dc for scratch window"); - DestroyWindow(hwnd); - return JNI_FALSE; - } - - // get the maximum allowable pbuffer dimensions - j2d_wglGetPixelFormatAttribivARB(hdc, wglInfo->pixfmt, 0, 2, - attrKeys, attrVals); - maxWidth = attrVals[0]; - maxHeight = attrVals[1]; - - J2dTraceLn4(J2D_TRACE_VERBOSE, - " desired pbuffer dimensions: w=%d h=%d maxw=%d maxh=%d", - width, height, maxWidth, maxHeight); - - // if either dimension is 0 or larger than the maximum, we cannot - // allocate a pbuffer with the requested dimensions - if (width == 0 || width > maxWidth || - height == 0 || height > maxHeight) - { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: invalid dimensions"); - ReleaseDC(hwnd, hdc); - DestroyWindow(hwnd); - return JNI_FALSE; - } - - pbuffer = j2d_wglCreatePbufferARB(hdc, wglInfo->pixfmt, - width, height, pbAttrList); - - ReleaseDC(hwnd, hdc); - DestroyWindow(hwnd); - - if (pbuffer == 0) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: could not create wgl pbuffer"); - return JNI_FALSE; - } - - // note that we get the DC for the pbuffer at creation time, and then - // release the DC when the pbuffer is disposed; the WGL_ARB_pbuffer - // spec is vague about such things, but from past experience we know - // this approach to be more robust than, for example, doing a - // Get/ReleasePbufferDC() everytime we make a context current - pbufferDC = j2d_wglGetPbufferDCARB(pbuffer); - if (pbufferDC == 0) { - J2dRlsTraceLn(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: could not get dc for pbuffer"); - j2d_wglDestroyPbufferARB(pbuffer); - return JNI_FALSE; - } - - // make sure the actual dimensions match those that we requested - j2d_wglQueryPbufferARB(pbuffer, WGL_PBUFFER_WIDTH_ARB, &actualWidth); - j2d_wglQueryPbufferARB(pbuffer, WGL_PBUFFER_HEIGHT_ARB, &actualHeight); - - if (width != actualWidth || height != actualHeight) { - J2dRlsTraceLn2(J2D_TRACE_ERROR, - "WGLSurfaceData_initPbuffer: actual (w=%d h=%d) != requested", - actualWidth, actualHeight); - j2d_wglReleasePbufferDCARB(pbuffer, pbufferDC); - j2d_wglDestroyPbufferARB(pbuffer); - return JNI_FALSE; - } - - oglsdo->drawableType = OGLSD_PBUFFER; - oglsdo->isOpaque = isOpaque; - oglsdo->width = width; - oglsdo->height = height; - wglsdo->pbuffer = pbuffer; - wglsdo->pbufferDC = pbufferDC; - - OGLSD_SetNativeDimensions(env, oglsdo, width, height); - - return JNI_TRUE; -} - void OGLSD_SwapBuffers(JNIEnv *env, jlong pPeerData) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/EventDispatchThread/PropertyPermissionOnEDT/PropertyPermissionOnEDT.java Tue Jul 14 15:18:26 2015 -0700 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +/** + * @test + * @bug 8080405 + * @run main/othervm/policy=java.policy -Djava.security.manager PropertyPermissionOnEDT + */ +public final class PropertyPermissionOnEDT { + + public static void main(final String[] args) throws Exception { + SwingUtilities.invokeAndWait(PropertyPermissionOnEDT::test); + + JFrame frame = new JFrame(); + frame.addMouseListener(new MouseListener() { + @Override + public void mouseClicked(final MouseEvent e) { + test(); + } + + @Override + public void mousePressed(MouseEvent e) { + test(); + } + + @Override + public void mouseReleased(MouseEvent e) { + test(); + } + + @Override + public void mouseEntered(MouseEvent e) { + test(); + } + + @Override + public void mouseExited(MouseEvent e) { + test(); + } + }); + frame.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + test(); + } + + @Override + public void focusLost(FocusEvent e) { + test(); + } + }); + frame.addMouseWheelListener(e -> test()); + frame.addWindowStateListener(e -> test()); + + frame.setSize(100, 100); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + Robot robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(100); + Point loc = frame.getLocationOnScreen(); + robot.mouseMove(loc.x + frame.getWidth() / 2, + loc.y + frame.getHeight() / 2); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.mouseWheel(100); + frame.dispose(); + } + + private static void test() { + String property = System.getProperty("os.name"); + System.out.println("property = " + property); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/EventDispatchThread/PropertyPermissionOnEDT/java.policy Tue Jul 14 15:18:26 2015 -0700 @@ -0,0 +1,4 @@ +grant { + permission java.util.PropertyPermission "os.name", "read"; + permission java.awt.AWTPermission "createRobot"; +};
--- a/test/java/awt/EventQueue/6980209/bug6980209.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/EventQueue/6980209/bug6980209.java Tue Jul 14 15:18:26 2015 -0700 @@ -27,18 +27,17 @@ @author Semyon Sadetsky */ -import sun.util.logging.PlatformLogger; - import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; +import java.util.logging.Logger; public class bug6980209 implements ActionListener { - private final static PlatformLogger log = - PlatformLogger.getLogger("java.awt.event.WaitDispatchSupport"); + private final static Logger log = + Logger.getLogger("java.awt.event.WaitDispatchSupport"); public static final int ATTEMPTS = 100; public static final int EVENTS = 5; @@ -52,8 +51,8 @@ public static void main(String[] args) throws Exception { System.out.println( "PLEASE DO NOT TOUCH KEYBOARD AND MOUSE DURING THE TEST RUN!"); - // log.setLevel(PlatformLogger.Level.FINE); - // log.setLevel(PlatformLogger.Level.FINEST); + // log.setLevel(java.util.logging.Level.FINE); + // log.setLevel(java.util.logging.Level.FINEST); try { SwingUtilities.invokeAndWait(new Runnable() { public void run() {
--- a/test/java/awt/FileDialog/8017487/bug8017487.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/FileDialog/8017487/bug8017487.java Tue Jul 14 15:18:26 2015 -0700 @@ -25,6 +25,7 @@ @bug 8017487 @summary filechooser in Windows-Libraries folder: columns are mixed up @author Semyon Sadetsky + @modules java.desktop/sun.awt.shell @library /lib/testlibrary @build jdk.testlibrary.OSInfo @run main bug8017487
--- a/test/java/awt/Focus/8073453/AWTFocusTransitionTest.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Focus/8073453/AWTFocusTransitionTest.java Tue Jul 14 15:18:26 2015 -0700 @@ -28,13 +28,11 @@ * @compile AWTFocusTransitionTest.java * @run main/othervm AWTFocusTransitionTest */ -import sun.awt.SunToolkit; import java.awt.*; import java.awt.event.KeyEvent; public class AWTFocusTransitionTest { - private static SunToolkit toolkit; private static Robot robot; private static Frame frame; @@ -42,20 +40,19 @@ private static Button button; public static void main(String[] args) throws Exception { - toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); robot = new Robot(); robot.setAutoDelay(50); try { createAndShowGUI(); - toolkit.realSync(); + robot.waitForIdle(); checkFocusOwner(textField); robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); - toolkit.realSync(); + robot.waitForIdle(); checkFocusOwner(button); @@ -63,7 +60,7 @@ robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_SHIFT); - toolkit.realSync(); + robot.waitForIdle(); checkFocusOwner(textField); @@ -71,7 +68,7 @@ robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_SHIFT); - toolkit.realSync(); + robot.waitForIdle(); checkFocusOwner(button); } finally {
--- a/test/java/awt/Focus/8073453/SwingFocusTransitionTest.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Focus/8073453/SwingFocusTransitionTest.java Tue Jul 14 15:18:26 2015 -0700 @@ -28,14 +28,12 @@ * @compile SwingFocusTransitionTest.java * @run main/othervm SwingFocusTransitionTest */ -import sun.awt.SunToolkit; import javax.swing.*; import java.awt.*; import java.awt.event.KeyEvent; public class SwingFocusTransitionTest { - private static SunToolkit toolkit; private static Robot robot; private static JFrame frame; @@ -43,7 +41,6 @@ private static JButton button; public static void main(String[] args) throws Exception { - toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); robot = new Robot(); robot.setAutoDelay(50); @@ -55,13 +52,13 @@ } }); - toolkit.realSync(); + robot.waitForIdle(); checkFocusOwner(textField); robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); - toolkit.realSync(); + robot.waitForIdle(); checkFocusOwner(button); @@ -69,7 +66,7 @@ robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_SHIFT); - toolkit.realSync(); + robot.waitForIdle(); checkFocusOwner(textField); @@ -77,7 +74,7 @@ robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_SHIFT); - toolkit.realSync(); + robot.waitForIdle(); checkFocusOwner(button); } finally {
--- a/test/java/awt/Focus/FocusEmbeddedFrameTest/FocusEmbeddedFrameTest.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Focus/FocusEmbeddedFrameTest/FocusEmbeddedFrameTest.java Tue Jul 14 15:18:26 2015 -0700 @@ -26,6 +26,8 @@ @bug 6516675 @summary Tests that EmbeddedFrame can be focused. @author anton.tarasov: area=awt-focus + @modules java.desktop/java.awt.peer + java.desktop/sun.awt @library ../../regtesthelpers @build Util UtilInternal @run main FocusEmbeddedFrameTest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Frame/NonEDT_GUI_DeadlockTest/NonEDT_GUI_Deadlock.html Tue Jul 14 15:18:26 2015 -0700 @@ -0,0 +1,44 @@ +<html> +<!-- + Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + + This code is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 only, as + published by the Free Software Foundation. + + This code is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + version 2 for more details (a copy is included in the LICENSE file that + accompanied this code). + + You should have received a copy of the GNU General Public License version + 2 along with this work; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + + Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + or visit www.oracle.com if you need additional information or have any + questions. +--> + +<!-- + @test + @bug 4828019 + @summary Frame/Window deadlock + @author yan@sparc.spb.su: area= + @run applet/timeout=9999 NonEDT_GUI_Deadlock.html + --> +<head> +<title> </title> +</head> +<body> + +<h1>NonEDT_GUI_Deadlock<br>Bug ID: 4828019</h1> + +<p> This is an AUTOMATIC test, simply wait for completion </p> + +<APPLET CODE="NonEDT_GUI_Deadlock.class" WIDTH=200 HEIGHT=200></APPLET> +</body> +</html> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Frame/NonEDT_GUI_DeadlockTest/NonEDT_GUI_Deadlock.java Tue Jul 14 15:18:26 2015 -0700 @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + test + @bug 4828019 + @summary Frame/Window deadlock + @author yan@sparc.spb.su: area= + @run applet NonEDT_GUI_Deadlock.html +*/ + +// Note there is no @ in front of test above. This is so that the +// harness will not mistake this file as a test file. It should +// only see the html file as a test file. (the harness runs all +// valid test files, so it would run this test twice if this file +// were valid as well as the html file.) +// Also, note the area= after Your Name in the author tag. Here, you +// should put which functional area the test falls in. See the +// AWT-core home page -> test areas and/or -> AWT team for a list of +// areas. +// Note also the 'AutomaticAppletTest.html' in the run tag. This should +// be changed to the name of the test. + + +/** + * NonEDT_GUI_Deadlock.java + * + * summary: + */ + +import java.applet.Applet; +import java.awt.*; +import java.awt.event.*; +import java.net.*; +import java.io.*; + + +//Automated tests should run as applet tests if possible because they +// get their environments cleaned up, including AWT threads, any +// test created threads, and any system resources used by the test +// such as file descriptors. (This is normally not a problem as +// main tests usually run in a separate VM, however on some platforms +// such as the Mac, separate VMs are not possible and non-applet +// tests will cause problems). Also, you don't have to worry about +// synchronisation stuff in Applet tests they way you do in main +// tests... + + +public class NonEDT_GUI_Deadlock extends Applet +{ + //Declare things used in the test, like buttons and labels here + boolean bOK = false; + Thread badThread = null; + + public void init() + { + //Create instructions for the user here, as well as set up + // the environment -- set the layout manager, add buttons, + // etc. + + + String[] instructions = + { + "This is an AUTOMATIC test", + "simply wait until it is done" + }; + Sysout.createDialog( ); + Sysout.printInstructions( instructions ); + + }//End init() + + public void start () + { + //Get things going. Request focus, set size, et cetera + + setSize (200,300); + setVisible(true); + validate(); + + final Frame theFrame = new Frame("Window test"); + theFrame.setSize(240, 200); + + Thread thKiller = new Thread() { + public void run() { + try { + Thread.sleep( 9000 ); + }catch( Exception ex ) { + } + if( !bOK ) { + // oops, + //Sysout.println("Deadlock!"); + Runtime.getRuntime().halt(0); + }else{ + //Sysout.println("Passed ok."); + } + } + }; + thKiller.setName("Killer thread"); + thKiller.start(); + Window w = new TestWindow(theFrame); + theFrame.toBack(); + theFrame.setVisible(true); + + theFrame.setLayout(new FlowLayout(FlowLayout.CENTER)); + EventQueue.invokeLater(new Runnable() { + public void run() { + bOK = true; + } + }); + + + + }// start() + class TestWindow extends Window implements Runnable { + + TestWindow(Frame f) { + super(f); + + //setSize(240, 75); + setLocation(0, 75); + + show(); + toFront(); + + badThread = new Thread(this); + badThread.setName("Bad Thread"); + badThread.start(); + + } + + public void paint(Graphics g) { + g.drawString("Deadlock or no deadlock?",20,80); + } + + public void run() { + + long ts = System.currentTimeMillis(); + + while (true) { + if ((System.currentTimeMillis()-ts)>3000) { + this.setVisible( false ); + dispose(); + break; + } + + toFront(); + try { + Thread.sleep(80); + } catch (Exception e) { + } + } + } + } + + + + public static void main(String args[]) { + NonEDT_GUI_Deadlock imt = new NonEDT_GUI_Deadlock(); + imt.init(); + imt.start(); + } + + +}// class NonEDT_GUI_Deadlock + + +/**************************************************** + Standard Test Machinery + DO NOT modify anything below -- it's a standard + chunk of code whose purpose is to make user + interaction uniform, and thereby make it simpler + to read and understand someone else's test. + ****************************************************/ + +/** + This is part of the standard test machinery. + It creates a dialog (with the instructions), and is the interface + for sending text messages to the user. + To print the instructions, send an array of strings to Sysout.createDialog + WithInstructions method. Put one line of instructions per array entry. + To display a message for the tester to see, simply call Sysout.println + with the string to be displayed. + This mimics System.out.println but works within the test harness as well + as standalone. + */ + +class Sysout +{ + private static TestDialog dialog; + + public static void createDialogWithInstructions( String[] instructions ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + dialog.printInstructions( instructions ); + dialog.setVisible(true); + println( "Any messages for the tester will display here." ); + } + + public static void createDialog( ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + String[] defInstr = { "Instructions will appear here. ", "" } ; + dialog.printInstructions( defInstr ); + dialog.setVisible(true); + println( "Any messages for the tester will display here." ); + } + + + public static void printInstructions( String[] instructions ) + { + dialog.printInstructions( instructions ); + } + + + public static void println( String messageIn ) + { + dialog.displayMessage( messageIn ); + } + +}// Sysout class + +/** + This is part of the standard test machinery. It provides a place for the + test instructions to be displayed, and a place for interactive messages + to the user to be displayed. + To have the test instructions displayed, see Sysout. + To have a message to the user be displayed, see Sysout. + Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog +{ + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog( Frame frame, String name ) + { + super( frame, name ); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); + add( "North", instructionsText ); + + messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); + add("Center", messageText); + + pack(); + + show(); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions( String[] instructions ) + { + //Clear out any current instructions + instructionsText.setText( "" ); + + //Go down array of instruction strings + + String printStr, remainingStr; + for( int i=0; i < instructions.length; i++ ) + { + //chop up each into pieces maxSringLength long + remainingStr = instructions[ i ]; + while( remainingStr.length() > 0 ) + { + //if longer than max then chop off first max chars to print + if( remainingStr.length() >= maxStringLength ) + { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf( ' ', maxStringLength - 1 ); + + if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; + + printStr = remainingStr.substring( 0, posOfSpace + 1 ); + remainingStr = remainingStr.substring( posOfSpace + 1 ); + } + //else just print + else + { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append( printStr + "\n" ); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage( String messageIn ) + { + messageText.append( messageIn + "\n" ); + System.out.println(messageIn); + } + +}// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/FullScreen/MultimonFullscreenTest/MultimonDeadlockTest.java Tue Jul 14 15:18:26 2015 -0700 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 8129116 + @summary Deadlock with multimonitor fullscreen windows. + @run main/timeout=20 MultimonDeadlockTest + */ +import java.awt.*; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.lang.reflect.InvocationTargetException; + +public class MultimonDeadlockTest { + + public static void main(String argv[]) { + final GraphicsDevice[] devices = GraphicsEnvironment + .getLocalGraphicsEnvironment() + .getScreenDevices(); + if (devices.length < 2) { + System.out.println("It's a multiscreen test... skipping!"); + return; + } + + Frame frames[] = new Frame[devices.length]; + try { + EventQueue.invokeAndWait(() -> { + for (int i = 0; i < devices.length; i++) { + frames[i] = new Frame(); + frames[i].setSize(100, 100); + frames[i].setBackground(Color.BLUE); + devices[i].setFullScreenWindow(frames[i]); + } + }); + Thread.sleep(5000); + } catch (InterruptedException | InvocationTargetException ex) { + } finally { + for (int i = 0; i < devices.length; i++) { + devices[i].setFullScreenWindow(null); + frames[i].dispose(); + } + } + + } +}
--- a/test/java/awt/JAWT/JAWT.sh Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/JAWT/JAWT.sh Tue Jul 14 15:18:26 2015 -0700 @@ -129,7 +129,7 @@ esac echo "OS-ARCH is" ${SYST}-${ARCH} -${TESTJAVA}${FS}jre${FS}bin${FS}java -fullversion 2>&1 +${TESTJAVA}${FS}bin${FS}java -fullversion 2>&1 which ${MAKE} >${NULL} 2>&1 if [ "$?" -ne '0' ] @@ -156,7 +156,7 @@ cp ${TESTSRC}${FS}${MAKEFILE} . -JAVA=${TESTJAVA}${FS}jre${FS}bin${FS}java +JAVA=${TESTJAVA}${FS}bin${FS}java JAVAC=${TESTJAVA}${FS}bin${FS}javac JAVAH=${TESTJAVA}${FS}bin${FS}javah
--- a/test/java/awt/JAWT/Makefile.unix Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/JAWT/Makefile.unix Tue Jul 14 15:18:26 2015 -0700 @@ -32,7 +32,7 @@ J_INC = $(TESTJAVA)/include INCLUDES = -I$(J_INC) -I$(J_INC)/$(SYST) -I. -LIBS = -L$(TESTJAVA)/jre/lib/$(ARCH) -ljawt -lX11 +LIBS = -L$(TESTJAVA)/lib/$(ARCH) -ljawt -lX11 all: $(CLASSES) libmylib.so
--- a/test/java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -34,6 +34,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JButtonInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -34,6 +34,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JButtonOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -33,6 +33,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JColorChooserOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -44,6 +44,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JComboBoxOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -35,6 +35,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JEditorPaneInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -33,6 +33,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JEditorPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -46,6 +46,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JGlassPaneInternalFrameOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -47,6 +47,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JGlassPaneMoveOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -43,6 +43,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JInternalFrameMoveOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -42,6 +42,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JInternalFrameOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -35,6 +35,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JLabelInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -34,6 +34,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JLabelOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -34,6 +34,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JListInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JListOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JListOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -33,6 +33,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JListOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -49,6 +49,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JMenuBarOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -35,6 +35,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JPanelInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -34,6 +34,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JPanelOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -46,6 +46,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JPopupMenuOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -35,6 +35,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JProgressBarInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -34,6 +34,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JProgressBarOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -38,6 +38,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JScrollBarInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -37,6 +37,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JScrollBarOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -44,6 +44,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JScrollPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -35,6 +35,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JSliderInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -34,6 +34,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JSliderOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -37,6 +37,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JSpinnerInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -36,6 +36,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JSpinnerOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -40,7 +40,8 @@ /** * AWT/Swing overlapping test for {@link javax.swing.JSplitPane } component. - * <p>This test creates puts heavyweight and lightweight components into different panels and test if splitter image and components itself are drawn correctly. + * <p>This test puts heavyweight and lightweight components into different + * panels and test if splitter image and components itself are drawn correctly. * <p>See base class for test info. */ /* @@ -50,6 +51,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JSplitPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -37,6 +37,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JTableInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JTableOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JTableOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -33,6 +33,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JTableOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -35,6 +35,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JTextAreaInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -34,6 +34,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JTextAreaOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -35,6 +35,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JTextFieldInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -34,6 +34,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JTextFieldOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -34,6 +34,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JToggleButtonInGlassPaneOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -33,6 +33,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main JToggleButtonOverlapping */
--- a/test/java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java Tue Jul 14 15:18:26 2015 -0700 @@ -43,6 +43,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main MixingFrameResizing */
--- a/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -47,6 +47,7 @@ @summary Opaque overlapping test for each AWT component @library ../../regtesthelpers @modules java.desktop/com.sun.awt + java.desktop/java.awt.peer java.desktop/sun.awt @build Util @run main OpaqueOverlapping
--- a/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java Tue Jul 14 15:18:26 2015 -0700 @@ -33,6 +33,7 @@ @summary Opaque overlapping test for Choice AWT component @library ../../regtesthelpers @modules java.desktop/com.sun.awt + java.desktop/java.awt.peer java.desktop/sun.awt @build Util @run main OpaqueOverlappingChoice
--- a/test/java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java Tue Jul 14 15:18:26 2015 -0700 @@ -52,6 +52,7 @@ @author sergey.grinev@oracle.com: area=awt.mixing @library ../../regtesthelpers @modules java.desktop/sun.awt + java.desktop/java.awt.peer @build Util @run main ViewportOverlapping */
--- a/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java Tue Jul 14 15:18:26 2015 -0700 @@ -29,6 +29,8 @@ /* @test * @bug 7129742 * @summary Focus in non-editable TextArea is not shown on Linux. + * @modules java.desktop/sun.awt + * java.desktop/java.awt.peer * @author Sean Chou */
--- a/test/java/awt/datatransfer/DragImage/MultiResolutionDragImageTest.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/datatransfer/DragImage/MultiResolutionDragImageTest.java Tue Jul 14 15:18:26 2015 -0700 @@ -36,6 +36,8 @@ * @author Hendrik Schreiber * @summary [macosx] Drag image of TransferHandler does not honor * MultiResolutionImage + * @modules java.desktop/sun.awt.image + * java.desktop/sun.java2d * @run main MultiResolutionDragImageTest TEST_DRAG */ public class MultiResolutionDragImageTest { @@ -169,4 +171,4 @@ graphics.dispose(); return image; } -} \ No newline at end of file +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/font/GlyphVector/TestLayoutFlags.java Tue Jul 14 15:18:26 2015 -0700 @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* @test + @bug 4328745 5090704 + @summary exercise getLayoutFlags, getGlyphCharIndex, getGlyphCharIndices + */ + +import java.awt.*; +import java.awt.event.*; +import java.awt.font.*; +import java.awt.geom.*; + +public class TestLayoutFlags { + + static public void main(String[] args) { + new TestLayoutFlags().runTest(); + } + + void runTest() { + + Font font = new Font("Lucida Sans", Font.PLAIN, 24); + + String latin1 = "This is a latin1 string"; // none + String hebrew = "\u05d0\u05d1\u05d2\u05d3"; // rtl + String arabic = "\u0646\u0644\u0622\u0646"; // rtl + mc/g + String hindi = "\u0939\u093f\u0923\u094d\u0921\u0940"; // ltr + reorder + // String tamil = "\u0b9c\u0bcb"; // ltr + mg/c + split + + FontRenderContext frc = new FontRenderContext(null, true, true); + + // get glyph char indices needs to initializes layoutFlags before use (5090704) + { + GlyphVector gv = font.createGlyphVector(frc, "abcde"); + int ix = gv.getGlyphCharIndex(0); + if (ix != 0) { + throw new Error("glyph 0 incorrectly mapped to char " + ix); + } + int[] ixs = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); + for (int i = 0; i < ixs.length; ++i) { + if (ixs[i] != i) { + throw new Error("glyph " + i + " incorrectly mapped to char " + ixs[i]); + } + } + } + + GlyphVector latinGV = makeGlyphVector("Lucida Sans", frc, latin1, false, 1 /* ScriptRun.LATIN */); + GlyphVector hebrewGV = makeGlyphVector("Lucida Sans", frc, hebrew, true, 5 /* ScriptRun.HEBREW */); + GlyphVector arabicGV = makeGlyphVector("Lucida Sans", frc, arabic, true, 6 /* ScriptRun.ARABIC */); + GlyphVector hindiGV = makeGlyphVector("Lucida Sans", frc, hindi, false, 7 /* ScriptRun.DEVANAGARI */); + // GlyphVector tamilGV = makeGlyphVector("Devanagari MT for IBM", frc, tamil, false, 12 /* ScriptRun.TAMIL */); + + GlyphVector latinPos = font.createGlyphVector(frc, latin1); + Point2D pt = latinPos.getGlyphPosition(0); + pt.setLocation(pt.getX(), pt.getY() + 1.0); + latinPos.setGlyphPosition(0, pt); + + GlyphVector latinTrans = font.createGlyphVector(frc, latin1); + latinTrans.setGlyphTransform(0, AffineTransform.getRotateInstance(.15)); + + test("latin", latinGV, GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS); + test("hebrew", hebrewGV, GlyphVector.FLAG_RUN_RTL | + GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS); + test("arabic", arabicGV, GlyphVector.FLAG_RUN_RTL | + GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS); + test("hindi", hindiGV, GlyphVector.FLAG_COMPLEX_GLYPHS | + GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS); + // test("tamil", tamilGV, GlyphVector.FLAG_COMPLEX_GLYPHS); + test("pos", latinPos, GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS); + test("trans", latinTrans, GlyphVector.FLAG_HAS_TRANSFORMS); + } + + GlyphVector makeGlyphVector(String fontname, FontRenderContext frc, String text, boolean rtl, int script) { + Font font = new Font(fontname, Font.PLAIN, 14); + System.out.println("asking for " + fontname + " and got " + font.getFontName()); + int flags = rtl ? 1 : 0; + return font.layoutGlyphVector(frc, text.toCharArray(), 0, text.length(), flags); + } + + void test(String name, GlyphVector gv, int expectedFlags) { + expectedFlags &= gv.FLAG_MASK; + int computedFlags = computeFlags(gv) & gv.FLAG_MASK; + int actualFlags = gv.getLayoutFlags() & gv.FLAG_MASK; + + System.out.println("\n*** " + name + " ***"); + System.out.println(" test flags"); + System.out.print("expected "); + printFlags(expectedFlags); + System.out.print("computed "); + printFlags(computedFlags); + System.out.print(" actual "); + printFlags(actualFlags); + + if (expectedFlags != actualFlags) { + throw new Error("layout flags in test: " + name + + " expected: " + Integer.toHexString(expectedFlags) + + " but got: " + Integer.toHexString(actualFlags)); + } + } + + static public void printFlags(int flags) { + System.out.print("flags:"); + if ((flags & GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS) != 0) { + System.out.print(" pos"); + } + if ((flags & GlyphVector.FLAG_HAS_TRANSFORMS) != 0) { + System.out.print(" trans"); + } + if ((flags & GlyphVector.FLAG_RUN_RTL) != 0) { + System.out.print(" rtl"); + } + if ((flags & GlyphVector.FLAG_COMPLEX_GLYPHS) != 0) { + System.out.print(" complex"); + } + if ((flags & GlyphVector.FLAG_MASK) == 0) { + System.out.print(" none"); + } + System.out.println(); + } + + int computeFlags(GlyphVector gv) { + validateCharIndexMethods(gv); + + int result = 0; + if (glyphsAreRTL(gv)) { + result |= GlyphVector.FLAG_RUN_RTL; + } + if (hasComplexGlyphs(gv)) { + result |= GlyphVector.FLAG_COMPLEX_GLYPHS; + } + + return result; + } + + /** + * throw an exception if getGlyphCharIndices returns a different result than + * you get from iterating through getGlyphCharIndex one at a time. + */ + void validateCharIndexMethods(GlyphVector gv) { + int[] indices = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); + for (int i = 0; i < gv.getNumGlyphs(); ++i) { + if (gv.getGlyphCharIndex(i) != indices[i]) { + throw new Error("glyph index mismatch at " + i); + } + } + } + + /** + * Return true if the glyph indices are pure ltr + */ + boolean glyphsAreLTR(GlyphVector gv) { + int[] indices = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); + for (int i = 0; i < indices.length; ++i) { + if (indices[i] != i) { + return false; + } + } + return true; + } + + /** + * Return true if the glyph indices are pure rtl + */ + boolean glyphsAreRTL(GlyphVector gv) { + int[] indices = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); + for (int i = 0; i < indices.length; ++i) { + if (indices[i] != indices.length - i - 1) { + return false; + } + } + return true; + } + + /** + * Return true if there is a local reordering (the run is not ltr or rtl). + * !!! We can't have mixed bidi runs in the glyphs. + */ + boolean hasComplexGlyphs(GlyphVector gv) { + return !glyphsAreLTR(gv) && !glyphsAreRTL(gv); + } +} + +/* +rect getPixelBounds(frc, x, y) +rect getGlyphPixelBounds(frc, int, x, y) +getGlyphOutline(int index, x, y) +getGlyphInfo() +*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/font/Underline/UnderlineTest.java Tue Jul 14 15:18:26 2015 -0700 @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/** + * @test + * @bug 6216010 + * @summary check to see that underline thickness scales. + * @run main UnderlineTest + */ + +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.font.FontRenderContext; +import java.awt.font.LineMetrics; +import java.awt.font.TextAttribute; +import java.awt.font.TextLayout; +import java.awt.geom.AffineTransform; +import java.util.HashMap; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JScrollPane; + +public class UnderlineTest { + static class FontsPanel extends Container { + FontsPanel(Font[] fonts) { + setLayout(new GridLayout(0, 1)); + for (int i = 0; i < fonts.length; ++i) { + add(new FontPanel(fonts[i])); + } + } + } + + static String fps = "Stellar glyphs"; + static Dimension fpd = new Dimension(600, 120); + static class FontPanel extends JComponent { + Font f; + FontPanel(Font f) { + this.f = f; + setPreferredSize(fpd); + setMinimumSize(fpd); + setMaximumSize(fpd); + setSize(fpd); + } + + public void paintComponent(Graphics g) { + g.setColor(Color.WHITE); + g.fillRect(0, 0, fpd.width, fpd.height); + + g.setColor(Color.RED); + FontRenderContext frc = ((Graphics2D)g).getFontRenderContext(); + LineMetrics lm = f.getLineMetrics(fps, frc); + int h = (int)(fpd.height - 20 - lm.getAscent()); + g.drawLine(20, h, fpd.width - 20, h); + h = fpd.height - 20; + g.drawLine(20, h, fpd.width - 20, h); + h = (int)(fpd.height - 20 + lm.getDescent()); + g.drawLine(20, h, fpd.width - 20, h); + + g.setColor(Color.BLACK); + g.setFont(f); + g.drawString(fps, 50, fpd.height - 20); + } + } + + public static void main(String args[]) { + String fontName = "Lucida Sans"; + if (args.length > 0) { + fontName = args[0]; + } + FontRenderContext frc = new FontRenderContext(null, false, false); + FontRenderContext frc2 = new FontRenderContext(AffineTransform.getScaleInstance(1.5, 1.5), false, false); + + Font font0 = new Font(fontName, 0, 20); + HashMap map = new HashMap(); + map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); + map.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON); + Font font = font0.deriveFont(map); + + System.out.println("Using font: " + font); + + double rot = -Math.PI/4; + AffineTransform scrtx = AffineTransform.getRotateInstance(rot); + scrtx.scale(1, 2); + + Font[] fonts = { + font.deriveFont(1f), + font.deriveFont(20f), + font.deriveFont(40f), + font.deriveFont(80f), + font.deriveFont(AffineTransform.getRotateInstance(rot)), + font.deriveFont(AffineTransform.getScaleInstance(1, 2)), + font.deriveFont(AffineTransform.getScaleInstance(2, 4)), + font.deriveFont(scrtx), + }; + + LineMetrics[] metrics = new LineMetrics[fonts.length * 2]; + for (int i = 0; i < metrics.length; ++i) { + Font f = fonts[i % fonts.length]; + FontRenderContext frcx = i < fonts.length ? frc : frc2; + metrics[i] = f.getLineMetrics("X", frcx); + // dumpMetrics("Metrics for " + f.getSize2D() + " pt. font,\n tx: " + + // f.getTransform() + ",\n frctx: " + frcx.getTransform(), metrics[i]); + } + + // test for linear scale + // this seems to work, might need to get fancy to deal with last-significant-bit issues? + double ds1 = metrics[2].getStrikethroughOffset() - metrics[1].getStrikethroughOffset(); + double du1 = metrics[2].getUnderlineThickness() - metrics[1].getUnderlineThickness(); + double ds2 = metrics[3].getStrikethroughOffset() - metrics[2].getStrikethroughOffset(); + double du2 = metrics[3].getUnderlineThickness() - metrics[2].getUnderlineThickness(); + if (ds2 != ds1 * 2 || du2 != du1 * 2) { + throw new IllegalStateException("non-linear scale: " + ds1 + " / " + ds2 + ", " + + du1 + " / " + du2); + } + + JFrame jf = new JFrame("Fonts"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + jf.add(new JScrollPane(new FontsPanel(fonts))); + jf.pack(); + jf.setVisible(true); + } + + static void dumpMetrics(String header, LineMetrics lm) { + if (header != null) { + System.out.println(header); + } + System.out.println("asc: " + lm.getAscent()); + System.out.println("dsc: " + lm.getDescent()); + System.out.println("ulo: " + lm.getUnderlineOffset()); + System.out.println("ult: " + lm.getUnderlineThickness()); + System.out.println("sto: " + lm.getStrikethroughOffset()); + System.out.println("stt: " + lm.getStrikethroughThickness()); + } +}
--- a/test/java/awt/grab/EmbeddedFrameTest1/EmbeddedFrameTest1.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/grab/EmbeddedFrameTest1/EmbeddedFrameTest1.java Tue Jul 14 15:18:26 2015 -0700 @@ -26,6 +26,8 @@ @bug 6359129 @summary REGRESSION: Popup menus dont respond to selections when extend outside Applet @author oleg.sukhodolsky area=awt.grab + @modules java.desktop/java.awt.peer + java.desktop/sun.awt @library ../../regtesthelpers @build Util UtilInternal @run main EmbeddedFrameTest1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/image/VolatileImage/BitmaskVolatileImage.java Tue Jul 14 15:18:26 2015 -0700 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.awt.image.VolatileImage; + +import static java.awt.Transparency.BITMASK; + +/** + * @test + * @bug 7188942 + * @summary We should get correct volatile image, when we use BITMASK + * transparency + */ +public final class BitmaskVolatileImage { + + public static final int S = 8; + + public static void main(final String[] args) { + GraphicsConfiguration gc = + GraphicsEnvironment.getLocalGraphicsEnvironment() + .getDefaultScreenDevice().getDefaultConfiguration(); + VolatileImage vi = gc.createCompatibleVolatileImage(S, S, BITMASK); + BufferedImage ci = gc.createCompatibleImage(S, S, BITMASK); + + int attempt = 0; + do { + if (++attempt > 10) { + throw new RuntimeException("Too many attempts: " + attempt); + } + vi.validate(gc); + test(vi, ci, gc); + } while (vi.contentsLost()); + } + + private static void test(VolatileImage vi, BufferedImage ci, GraphicsConfiguration gc) { + for (int r = 0; r <= 255; ++r) { + for (int a = 0; a <= 255; ++a) { + fill(vi, new Color(r, 0, 0, a)); + fill(ci, new Color(r, 0, 0, a)); + validate(ci, vi.getSnapshot()); + } + } + } + + private static void fill(Image image, Color color) { + Graphics2D g2d = (Graphics2D) image.getGraphics(); + g2d.setColor(color); + g2d.setComposite(AlphaComposite.Src); + g2d.fillRect(0, 0, S, S); + g2d.dispose(); + } + + private static void validate(BufferedImage ci, BufferedImage snapshot) { + for (int y = 0; y < ci.getHeight(); y++) { + for (int x = 0; x < ci.getWidth(); x++) { + int ci_rgb = ci.getRGB(x, y); + int vi_rgb = snapshot.getRGB(x, y); + if (ci_rgb != vi_rgb) { + System.err.println("Exp:" + Integer.toHexString(ci_rgb)); + System.err.println("Actual:" + Integer.toHexString(vi_rgb)); + throw new RuntimeException("Colors mismatch!"); + } + } + } + } +}
--- a/test/java/awt/xembed/server/TestXEmbedServer.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/java/awt/xembed/server/TestXEmbedServer.java Tue Jul 14 15:18:26 2015 -0700 @@ -27,6 +27,8 @@ import java.io.*; import java.util.logging.*; import sun.awt.WindowIDProvider; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.ComponentAccessor; import java.awt.dnd.*; import java.awt.datatransfer.*; @@ -182,7 +184,8 @@ client.setBackground(new Color(30, 220, 40)); clientCont.add(client); clientCont.validate(); - WindowIDProvider pid = (WindowIDProvider)client.getPeer(); + final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); + WindowIDProvider pid = (WindowIDProvider)acc.getPeer(client); log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow()); Rectangle toFocusBounds = toFocus.getBounds(); toFocusBounds.setLocation(toFocus.getLocationOnScreen());
--- a/test/javax/swing/JFileChooser/8080628/bug8080628.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/javax/swing/JFileChooser/8080628/bug8080628.java Tue Jul 14 15:18:26 2015 -0700 @@ -33,6 +33,7 @@ * @bug 8080628 * @summary No mnemonics on Open and Save buttons in JFileChooser. * @author Alexey Ivanov + * @modules java.desktop/sun.swing * @run main bug8080628 */ public class bug8080628 {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java Tue Jul 14 15:18:26 2015 -0700 @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + @bug 8129940 + @summary JRadioButton does not honor non-standard FocusTraversalKeys + @author Semyon Sadetsky + */ + +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.util.HashSet; +import java.util.Set; + +public class FocusTraversal { + + private static JFrame frame; + private static JRadioButton a; + private static JRadioButton d; + private static JTextField next; + private static JTextField prev; + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame = new JFrame("FocusTraversalTest"); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.setUndecorated(true); + + Set<KeyStroke> keystrokes = new HashSet<KeyStroke>(); + keystrokes.add(KeyStroke.getKeyStroke("TAB")); + keystrokes.add(KeyStroke.getKeyStroke("ENTER")); + frame.setFocusTraversalKeys( + KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, + keystrokes); + + a = new JRadioButton("a"); + JRadioButton b = new JRadioButton("b"); + JRadioButton c = new JRadioButton("c"); + d = new JRadioButton("d"); + + ButtonGroup radioButtonGroup = new ButtonGroup(); + radioButtonGroup.add(a); + radioButtonGroup.add(b); + radioButtonGroup.add(c); + radioButtonGroup.add(d); + + JPanel panel = new JPanel(); + prev = new JTextField("text"); + panel.add(prev); + panel.add(a); + panel.add(b); + panel.add(c); + panel.add(d); + next = new JTextField("text"); + panel.add(next); + + JPanel root = new JPanel(); + root.setLayout(new BorderLayout()); + root.add(panel, BorderLayout.CENTER); + root.add(new JButton("OK"), BorderLayout.SOUTH); + + frame.add(root); + frame.pack(); + frame.setVisible(true); + } + }); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + a.requestFocus(); + } + }); + + Robot robot = new Robot(); + robot.waitForIdle(); + + robot.setAutoDelay(200); + + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + Component focusOwner = + FocusManager.getCurrentManager().getFocusOwner(); + if (focusOwner != next) { + throw new RuntimeException( + "Focus component is wrong after forward key " + focusOwner); + } + } + }); + + robot.keyPress(KeyEvent.VK_SHIFT); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_SHIFT); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + Component focusOwner = + FocusManager.getCurrentManager().getFocusOwner(); + if (focusOwner != d) { + throw new RuntimeException( + "Focus component is wrong after backward key " + focusOwner); + } + } + }); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + frame.dispose(); + } + }); + System.out.println("ok"); + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java Tue Jul 14 15:18:26 2015 -0700 @@ -0,0 +1,384 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + @bug 8129830 + @summary JTree drag/drop on lower half of last child of container incorrect + @author Semyon Sadetsky + */ + +import java.awt.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.event.InputEvent; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import javax.swing.*; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +public class LastNodeLowerHalfDrop { + + private static DefaultMutableTreeNode b1; + private static DefaultMutableTreeNode b2; + private static DefaultMutableTreeNode c; + private static JTree jTree; + private static DefaultMutableTreeNode a; + private static DefaultMutableTreeNode b; + private static DefaultMutableTreeNode a1; + private static Point dragPoint; + private static Point dropPoint; + private static JFrame f; + private static DefaultMutableTreeNode c1; + private static DefaultMutableTreeNode root; + + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + f = new JFrame(); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + f.add(new LastNodeLowerHalfDrop().getContent()); + f.setSize(400, 400); + f.setLocationRelativeTo(null); + f.setVisible(true); + } + }); + testCase(b2, a1, +0.4f); + if (!"b2".equals(jTree.getModel(). + getChild(a, a.getChildCount() - 1).toString())) { + throw new RuntimeException("b1 was not inserted in the last position in a"); + } + testCase(c1, c, -0.4f); + if (!"c1".equals(jTree.getModel().getChild(root, 2).toString())) { + throw new RuntimeException("c1 was not inserted beetween c and b nodes"); + } + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + f.dispose(); + } + }); + System.out.printf("ok"); + } + + static void testCase(DefaultMutableTreeNode drag, + DefaultMutableTreeNode drop, float shift) throws Exception { + Robot robot = new Robot(); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + Rectangle rectDrag = + jTree.getPathBounds(new TreePath(drag.getPath())); + dragPoint = new Point((int)rectDrag.getCenterX(), + (int) rectDrag.getCenterY()); + SwingUtilities.convertPointToScreen(dragPoint, jTree); + Rectangle rectDrop = + jTree.getPathBounds(new TreePath(drop.getPath())); + dropPoint = new Point(rectDrop.x + 5, + (int) (rectDrop.getCenterY() + shift * rectDrop.height)); + SwingUtilities.convertPointToScreen(dropPoint, jTree); + } + }); + + robot.mouseMove(dragPoint.x, dragPoint.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.delay(400); + robot.mouseMove(dropPoint.x, dropPoint.y); + robot.delay(400); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + robot.waitForIdle(); + } + + private JScrollPane getContent() { + jTree = new JTree(getTreeModel()); + jTree.setRootVisible(false); + jTree.setDragEnabled(true); + jTree.setDropMode(DropMode.INSERT); + jTree.setTransferHandler(new TreeTransferHandler()); + jTree.getSelectionModel().setSelectionMode( + TreeSelectionModel.SINGLE_TREE_SELECTION); + expandTree(jTree); + return new JScrollPane(jTree); + } + + protected static TreeModel getTreeModel() { + root = new DefaultMutableTreeNode("Root"); + + a = new DefaultMutableTreeNode("A"); + root.add(a); + a1 = new DefaultMutableTreeNode("a1"); + a.add(a1); + + b = new DefaultMutableTreeNode("B"); + root.add(b); + b1 = new DefaultMutableTreeNode("b1"); + b.add(b1); + b2 = new DefaultMutableTreeNode("b2"); + b.add(b2); + + c = new DefaultMutableTreeNode("C"); + root.add(c); + c1 = new DefaultMutableTreeNode("c1"); + c.add(c1); + return new DefaultTreeModel(root); + } + + private void expandTree(JTree tree) { + DefaultMutableTreeNode root = (DefaultMutableTreeNode) tree.getModel() + .getRoot(); + Enumeration e = root.breadthFirstEnumeration(); + while (e.hasMoreElements()) { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.nextElement(); + if (node.isLeaf()) { + continue; + } + int row = tree.getRowForPath(new TreePath(node.getPath())); + tree.expandRow(row); + } + } +} + +class TreeTransferHandler extends TransferHandler { + DataFlavor nodesFlavor; + DataFlavor[] flavors = new DataFlavor[1]; + DefaultMutableTreeNode[] nodesToRemove; + + public TreeTransferHandler() { + try { + String mimeType = DataFlavor.javaJVMLocalObjectMimeType + + ";class=\"" + + javax.swing.tree.DefaultMutableTreeNode[].class.getName() + + "\""; + nodesFlavor = new DataFlavor(mimeType); + flavors[0] = nodesFlavor; + } catch (ClassNotFoundException e) { + System.out.println("ClassNotFound: " + e.getMessage()); + } + } + + @Override + public boolean canImport(TransferHandler.TransferSupport support) { + if (!support.isDrop()) { + return false; + } + support.setShowDropLocation(true); + if (!support.isDataFlavorSupported(nodesFlavor)) { + return false; + } + // Do not allow a drop on the drag source selections. + JTree.DropLocation dl = (JTree.DropLocation) support.getDropLocation(); + JTree tree = (JTree) support.getComponent(); + int dropRow = tree.getRowForPath(dl.getPath()); + int[] selRows = tree.getSelectionRows(); + for (int i = 0; i < selRows.length; i++) { + if (selRows[i] == dropRow) { + return false; + } + } + // Do not allow MOVE-action drops if a non-leaf node is + // selected unless all of its children are also selected. + int action = support.getDropAction(); + if (action == MOVE) { + return haveCompleteNode(tree); + } + // Do not allow a non-leaf node to be copied to a level + // which is less than its source level. + TreePath dest = dl.getPath(); + DefaultMutableTreeNode target = (DefaultMutableTreeNode) + dest.getLastPathComponent(); + TreePath path = tree.getPathForRow(selRows[0]); + DefaultMutableTreeNode firstNode = (DefaultMutableTreeNode) + path.getLastPathComponent(); + if (firstNode.getChildCount() > 0 + && target.getLevel() < firstNode.getLevel()) { + return false; + } + return true; + } + + private boolean haveCompleteNode(JTree tree) { + int[] selRows = tree.getSelectionRows(); + TreePath path = tree.getPathForRow(selRows[0]); + DefaultMutableTreeNode first = (DefaultMutableTreeNode) + path.getLastPathComponent(); + int childCount = first.getChildCount(); + // first has children and no children are selected. + if (childCount > 0 && selRows.length == 1) { + return false; + } + // first may have children. + for (int i = 1; i < selRows.length; i++) { + path = tree.getPathForRow(selRows[i]); + DefaultMutableTreeNode next = (DefaultMutableTreeNode) + path.getLastPathComponent(); + if (first.isNodeChild(next)) { + // Found a child of first. + if (childCount > selRows.length - 1) { + // Not all children of first are selected. + return false; + } + } + } + return true; + } + + @Override + protected Transferable createTransferable(JComponent c) { + JTree tree = (JTree) c; + TreePath[] paths = tree.getSelectionPaths(); + if (paths != null) { + // Make up a node array of copies for transfer and + // another for/of the nodes that will be removed in + // exportDone after a successful drop. + List<DefaultMutableTreeNode> copies = new ArrayList<>(); + List<DefaultMutableTreeNode> toRemove = new ArrayList<>(); + DefaultMutableTreeNode node = (DefaultMutableTreeNode) + paths[0].getLastPathComponent(); + DefaultMutableTreeNode copy = copy(node); + copies.add(copy); + toRemove.add(node); + for (int i = 1; i < paths.length; i++) { + DefaultMutableTreeNode next = (DefaultMutableTreeNode) paths[i] + .getLastPathComponent(); + // Do not allow higher level nodes to be added to list. + if (next.getLevel() < node.getLevel()) { + break; + } else if (next.getLevel() > node.getLevel()) { // child node + copy.add(copy(next)); + // node already contains child + } else { // sibling + copies.add(copy(next)); + toRemove.add(next); + } + } + DefaultMutableTreeNode[] nodes = copies + .toArray(new DefaultMutableTreeNode[copies.size()]); + nodesToRemove = toRemove.toArray( + new DefaultMutableTreeNode[toRemove.size()]); + return new NodesTransferable(nodes); + } + return null; + } + + /** + * Defensive copy used in createTransferable. + */ + private DefaultMutableTreeNode copy(TreeNode node) { + return new DefaultMutableTreeNode(node); + } + + @Override + protected void exportDone(JComponent source, Transferable data, int action) { + if ((action & MOVE) == MOVE) { + JTree tree = (JTree) source; + DefaultTreeModel model = (DefaultTreeModel) tree.getModel(); + // Remove nodes saved in nodesToRemove in createTransferable. + for (DefaultMutableTreeNode nodesToRemove1 : nodesToRemove) { + model.removeNodeFromParent(nodesToRemove1); + } + } + } + + @Override + public int getSourceActions(JComponent c) { + return COPY_OR_MOVE; + } + + @Override + public boolean importData(TransferHandler.TransferSupport support) { + if (!canImport(support)) { + return false; + } + // Extract transfer data. + DefaultMutableTreeNode[] nodes = null; + try { + Transferable t = support.getTransferable(); + nodes = (DefaultMutableTreeNode[]) t.getTransferData(nodesFlavor); + } catch (UnsupportedFlavorException ufe) { + System.out.println("UnsupportedFlavor: " + ufe.getMessage()); + } catch (java.io.IOException ioe) { + System.out.println("I/O error: " + ioe.getMessage()); + } + // Get drop location info. + JTree.DropLocation dl = (JTree.DropLocation) support.getDropLocation(); + int childIndex = dl.getChildIndex(); + TreePath dest = dl.getPath(); + DefaultMutableTreeNode parent = (DefaultMutableTreeNode) + dest.getLastPathComponent(); + JTree tree = (JTree) support.getComponent(); + DefaultTreeModel model = (DefaultTreeModel) tree.getModel(); + // Configure for drop mode. + int index = childIndex; // DropMode.INSERT + if (childIndex == -1) { // DropMode.ON + index = parent.getChildCount(); + } + // Add data to model. + for (DefaultMutableTreeNode node : nodes) { + model.insertNodeInto(node, parent, index++); + } + return true; + } + + @Override + public String toString() { + return getClass().getName(); + } + + public class NodesTransferable implements Transferable { + DefaultMutableTreeNode[] nodes; + + public NodesTransferable(DefaultMutableTreeNode[] nodes) { + this.nodes = nodes; + } + + @Override + public Object getTransferData(DataFlavor flavor) + throws UnsupportedFlavorException { + if (!isDataFlavorSupported(flavor)) { + throw new UnsupportedFlavorException(flavor); + } + return nodes; + } + + @Override + public DataFlavor[] getTransferDataFlavors() { + return flavors; + } + + @Override + public boolean isDataFlavorSupported(DataFlavor flavor) { + return nodesFlavor.equals(flavor); + } + } +} \ No newline at end of file
--- a/test/javax/swing/RepaintManager/6608456/bug6608456.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/javax/swing/RepaintManager/6608456/bug6608456.java Tue Jul 14 15:18:26 2015 -0700 @@ -25,6 +25,7 @@ * * @bug 6608456 * @author Igor Kushnirskiy + * @modules java.desktop/com.sun.java.swing * @summary tests if delegate RepaintManager gets invoked. */
--- a/test/javax/swing/RepaintManager/DisplayListenerLeak/DisplayListenerLeak.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/javax/swing/RepaintManager/DisplayListenerLeak/DisplayListenerLeak.java Tue Jul 14 15:18:26 2015 -0700 @@ -34,6 +34,7 @@ /** * @test * @bug 8041654 + * @modules java.desktop/sun.java2d * @run main/othervm -Xmx80m DisplayListenerLeak */ public final class DisplayListenerLeak { @@ -79,4 +80,4 @@ throw new RuntimeException(); } } -} \ No newline at end of file +}
--- a/test/javax/swing/plaf/basic/6866751/bug6866751.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/javax/swing/plaf/basic/6866751/bug6866751.java Tue Jul 14 15:18:26 2015 -0700 @@ -27,6 +27,7 @@ @author Semyon Sadetsky */ import javax.swing.*; +import java.awt.*; public class bug6866751 { private static JFrame frame; @@ -54,8 +55,10 @@ caretX + 1); } area.putClientProperty("caretWidth", 10); + frame.pack(); } }); + new Robot().waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { int width = area.getWidth();
--- a/test/sun/java2d/SunGraphicsEnvironment/TestSGEuseAlternateFontforJALocales.java Tue Jul 14 20:14:29 2015 +0100 +++ b/test/sun/java2d/SunGraphicsEnvironment/TestSGEuseAlternateFontforJALocales.java Tue Jul 14 15:18:26 2015 -0700 @@ -28,6 +28,7 @@ * @summary verify the existence of the method * SunGraphicsEnvironment.useAlternateFontforJALocales * + * @modules java.desktop/sun.java2d * @run main/othervm TestSGEuseAlternateFontforJALocales * @run main/othervm -Dfile.encoding=windows-31j -Duser.language=ja -Duser.country=JA TestSGEuseAlternateFontforJALocales *