aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tarasov <anton.tarasov@jetbrains.com>2018-04-17 19:55:55 +0300
committerAnton Tarasov <anton.tarasov@jetbrains.com>2018-04-17 19:55:55 +0300
commit0b3f4fd78fff2a8dd7f1fed6d56179a208205ce7 (patch)
tree8d4e233f3e02ec84acccaf571d916d7361bbd677
parentc3040dd1fe1bf6c03c746c76f685629fd0a8e670 (diff)
parentd6eb232de721f58c4791358e488e0522e077ffd5 (diff)
downloadjdk8u_jdk-0b3f4fd78fff2a8dd7f1fed6d56179a208205ce7.tar.gz
Merge remote-tracking branch 'origin/master'jb8u152-b1234
-rw-r--r--make/CreateJars.gmk2
-rw-r--r--src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java114
-rw-r--r--src/share/classes/java/awt/peer/WindowPeer.java18
-rw-r--r--src/share/classes/sun/java2d/opengl/OGLBlitLoops.java6
-rw-r--r--src/share/classes/sun/java2d/opengl/OGLRenderQueue.java29
-rw-r--r--src/share/classes/sun/java2d/pipe/RenderQueue.java13
-rw-r--r--src/share/native/sun/java2d/Trace.h35
-rw-r--r--src/share/native/sun/java2d/opengl/OGLFuncs.h2
-rw-r--r--src/share/native/sun/java2d/opengl/OGLTextRenderer.c93
-rw-r--r--src/share/native/sun/java2d/opengl/OGLVertexCache.c119
-rw-r--r--src/share/native/sun/java2d/opengl/OGLVertexCache.h18
-rw-r--r--src/solaris/classes/sun/awt/X11/XWindowPeer.java29
-rw-r--r--src/windows/classes/sun/java2d/d3d/D3DRenderQueue.java2
-rw-r--r--src/windows/native/sun/windows/awt.h14
-rw-r--r--src/windows/native/sun/windows/awt_Window.cpp15
-rw-r--r--test/jb/javax/swing/JDialog/JDialog705.java198
-rwxr-xr-xtest/jb/sun/lwawt/macosx/LWCToolkit/lwctoolkit.sh13
-rw-r--r--test/jbProblemsList.txt10
18 files changed, 553 insertions, 177 deletions
diff --git a/make/CreateJars.gmk b/make/CreateJars.gmk
index c1a07693d2..e8b042b529 100644
--- a/make/CreateJars.gmk
+++ b/make/CreateJars.gmk
@@ -265,7 +265,7 @@ $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents: $(BUILD_TOOLS) $(IMAGES_OU
$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
- $(GREP) -e '\.class$$' $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents > $@.tmp
+ $(CAT) $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents | $(TR) -d '\r' | $(GREP) -e '\.class$$' > $@.tmp
ifneq ($(PROFILE), )
ifneq ($(strip $(RT_JAR_INCLUDE_TYPES)), )
# Add back classes from excluded packages (fixing the $ substitution in the process)
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
index d21f4e222b..52978cddae 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
@@ -570,72 +570,87 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
public void setVisible(boolean visible) {
final long nsWindowPtr = getNSWindowPtr();
- if (owner != null) {
- if (!visible) {
- CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), nsWindowPtr);
- }
- }
-
+ // Configure stuff
updateIconImages();
updateFocusabilityForAutoRequestFocus(false);
- if (!visible) {
- // Cancel out the current native state of the window
- switch (peer.getState()) {
- case Frame.ICONIFIED:
- CWrapper.NSWindow.deminiaturize(nsWindowPtr);
- break;
- case Frame.MAXIMIZED_BOTH:
- CWrapper.NSWindow.zoom(nsWindowPtr);
- break;
- }
- }
+ boolean wasMaximized = isMaximized();
- LWWindowPeer blocker = peer.getBlocker();
- if (blocker == null || !visible) {
- // If it ain't blocked, or is being hidden, go regular way
- if (visible) {
- CWrapper.NSWindow.makeFirstResponder(nsWindowPtr, contentView.getAWTView());
- boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(nsWindowPtr);
- if (!isKeyWindow) {
- CWrapper.NSWindow.makeKeyAndOrderFront(nsWindowPtr);
+ this.visible = visible;
+
+ // Manage the extended state when showing
+ if (visible) {
+ // Apply the extended state as expected in shared code
+ if (target instanceof Frame) {
+ if (!wasMaximized && isMaximized()) {
+ // setVisible could have changed the native maximized state
+ deliverZoom(true);
} else {
- CWrapper.NSWindow.orderFront(nsWindowPtr);
+ int frameState = ((Frame)target).getExtendedState();
+ if ((frameState & Frame.ICONIFIED) != 0) {
+ // Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
+ frameState = Frame.ICONIFIED;
+ }
+ switch (frameState) {
+ case Frame.ICONIFIED:
+ CWrapper.NSWindow.miniaturize(nsWindowPtr);
+ break;
+ case Frame.MAXIMIZED_BOTH:
+ maximize();
+ break;
+ default: // NORMAL
+ unmaximize(); // in case it was maximized, otherwise this is a no-op
+ break;
+ }
}
- } else {
- CWrapper.NSWindow.orderOut(nsWindowPtr);
}
- } else {
- // otherwise, put it in a proper z-order
- CWrapper.NSWindow.orderWindow(nsWindowPtr, CWrapper.NSWindow.NSWindowBelow,
- ((CPlatformWindow)blocker.getPlatformWindow()).getNSWindowPtr());
}
+ nativeSynthesizeMouseEnteredExitedEvents();
+
+ // Configure stuff #2
+ updateFocusabilityForAutoRequestFocus(true);
+
+ // Manage parent-child relationship when showing
if (visible) {
- // Re-apply the extended state as expected in shared code
- if (target instanceof Frame) {
- switch (((Frame)target).getExtendedState()) {
- case Frame.ICONIFIED:
- CWrapper.NSWindow.miniaturize(nsWindowPtr);
- break;
- case Frame.MAXIMIZED_BOTH:
- CWrapper.NSWindow.zoom(nsWindowPtr);
- break;
- }
+ // Order myself above my parent
+ if (owner != null && owner.isVisible()) {
+ applyWindowLevel(target);
}
}
- updateFocusabilityForAutoRequestFocus(true);
- if (owner != null) {
+ // Actually show or hide the window
+ LWWindowPeer blocker = (peer == null)? null : peer.getBlocker();
+ if (blocker == null || !visible) {
+
+ // If it ain't blocked, or is being hidden, go regular way
if (visible) {
- CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(), nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
- if (target.isAlwaysOnTop()) {
- CWrapper.NSWindow.setLevel(nsWindowPtr, CWrapper.NSWindow.NSFloatingWindowLevel);
+
+ CWrapper.NSWindow.makeFirstResponder(nsWindowPtr, contentView.getAWTView());
+
+ boolean isPopup = (target.getType() == Window.Type.POPUP);
+ if (isPopup) {
+ // Popups in applets don't activate applet's process
+ CWrapper.NSWindow.orderFrontRegardless(nsWindowPtr);
+ } else {
+ CWrapper.NSWindow.orderFront(nsWindowPtr);
+ }
+
+ boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(nsWindowPtr);
+ if (!isKeyWindow) {
+ CWrapper.NSWindow.makeKeyWindow(nsWindowPtr);
}
+ } else {
+ // immediately hide the window
+ CWrapper.NSWindow.orderOut(nsWindowPtr);
+ // process the close
+ CWrapper.NSWindow.close(nsWindowPtr);
}
}
+ // Order my own children above myself
+ // Deal with the blocker of the window being shown
if (blocker != null && visible) {
// Make sure the blocker is above its siblings
((CPlatformWindow)blocker.getPlatformWindow()).orderAboveSiblings();
@@ -1097,7 +1112,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
if (target.isAlwaysOnTop() && target.getType() != Window.Type.POPUP) {
CWrapper.NSWindow.setLevel(getNSWindowPtr(), CWrapper.NSWindow.NSFloatingWindowLevel);
} else if (target.getType() == Window.Type.POPUP) {
- CWrapper.NSWindow.setLevel(getNSWindowPtr(), CWrapper.NSWindow.NSPopUpMenuWindowLevel);
+ CWrapper.NSWindow.setLevel(getNSWindowPtr(),
+ WindowPeer.isLightweightDialog(target) ?
+ CWrapper.NSWindow.NSNormalWindowLevel :
+ CWrapper.NSWindow.NSPopUpMenuWindowLevel);
}
}
diff --git a/src/share/classes/java/awt/peer/WindowPeer.java b/src/share/classes/java/awt/peer/WindowPeer.java
index d9b2ffd35a..349ef4c18a 100644
--- a/src/share/classes/java/awt/peer/WindowPeer.java
+++ b/src/share/classes/java/awt/peer/WindowPeer.java
@@ -25,6 +25,7 @@
package java.awt.peer;
+import javax.swing.*;
import java.awt.*;
/**
@@ -124,4 +125,21 @@ public interface WindowPeer extends ContainerPeer {
* @return the system insets or null
*/
default Insets getSysInsets() { return null; }
+
+ static boolean isLightweightDialog(Window window) {
+ if (window instanceof RootPaneContainer) {
+ RootPaneContainer rootPaneContainer = (RootPaneContainer) window;
+ JRootPane rootPane = rootPaneContainer.getRootPane();
+ if (rootPane != null) {
+ Object property = rootPane.getClientProperty("SIMPLE_WINDOW");
+ if (property instanceof Boolean) {
+ Boolean isLightweightDialog = (Boolean)property;
+ if (isLightweightDialog) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java b/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
index 8a7ccaf7aa..5605dc0fee 100644
--- a/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
+++ b/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
@@ -293,7 +293,7 @@ final class OGLBlitLoops {
// always flush immediately, since we (currently) have no means
// of tracking changes to the system memory surface
- rq.flushNow(false);
+ rq.flushNow();
} finally {
rq.unlock();
}
@@ -370,7 +370,7 @@ final class OGLBlitLoops {
// we only have to flush immediately when copying from a
// (non-texture) surface to the screen; otherwise Swing apps
// might appear unresponsive until the auto-flush completes
- rq.flushNow(false);
+ rq.flushNow();
}
} finally {
rq.unlock();
@@ -611,7 +611,7 @@ final class OGLSurfaceToSwBlit extends Blit {
buf.putLong(dst.getNativeOps());
// always flush immediately
- rq.flushNow(false);
+ rq.flushNow();
} finally {
rq.unlock();
}
diff --git a/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java b/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java
index 0b2e440b8c..369707abe5 100644
--- a/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java
+++ b/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java
@@ -118,11 +118,10 @@ public class OGLRenderQueue extends RenderQueue {
return (Thread.currentThread() == getInstance().flusher);
}
- @Override
- public void flushNow(boolean sync) {
+ public void flushNow() {
// assert lock.isHeldByCurrentThread();
try {
- flusher.flushNow(sync);
+ flusher.flushNow();
} catch (Exception e) {
System.err.println("exception in flushNow:");
e.printStackTrace();
@@ -158,8 +157,6 @@ public class OGLRenderQueue extends RenderQueue {
private boolean needsFlush;
private Runnable task;
private Error error;
- private final long FLUSH_THRESHOLD = 4;
- private final long DEFAULT_FLUSH_COUNT = 100/FLUSH_THRESHOLD;
public QueueFlusher(ThreadGroup threadGroup) {
super(threadGroup, "Java2D Queue Flusher");
@@ -169,13 +166,9 @@ public class OGLRenderQueue extends RenderQueue {
}
public synchronized void flushNow() {
- flushNow(true);
- }
-
- public synchronized void flushNow(boolean latency) {
// wake up the flusher
needsFlush = true;
- if (!latency) notify();
+ notify();
// wait for flush to complete
while (needsFlush) {
@@ -199,27 +192,24 @@ public class OGLRenderQueue extends RenderQueue {
public synchronized void run() {
boolean timedOut = false;
while (true) {
- int count = 0;
while (!needsFlush) {
try {
timedOut = false;
/*
- * Wait FLUSH_THRESHOLD ms then check if needsFlush is set by
- * flushNow() call or we waited DEFAULT_FLUSH_COUNT times.
- * If so, flush the queue.
+ * Wait until we're woken up with a flushNow() call,
+ * or the timeout period elapses (so that we can
+ * flush the queue periodically).
*/
- wait(FLUSH_THRESHOLD);
+ wait(100);
/*
* We will automatically flush the queue if the
* following conditions apply:
- * - the wait() timed out DEFAULT_FLUSH_COUNT times
+ * - the wait() timed out
* - we can lock the queue (without blocking)
* - there is something in the queue to flush
* Otherwise, just continue (we'll flush eventually).
*/
- if (!needsFlush && count >= DEFAULT_FLUSH_COUNT &&
- (timedOut = tryLock()))
- {
+ if (!needsFlush && (timedOut = tryLock())) {
if (buf.position() > 0) {
needsFlush = true;
} else {
@@ -228,7 +218,6 @@ public class OGLRenderQueue extends RenderQueue {
}
} catch (InterruptedException e) {
}
- count++;
}
try {
// reset the throwable state
diff --git a/src/share/classes/sun/java2d/pipe/RenderQueue.java b/src/share/classes/sun/java2d/pipe/RenderQueue.java
index f9b955a794..d11bb222fe 100644
--- a/src/share/classes/sun/java2d/pipe/RenderQueue.java
+++ b/src/share/classes/sun/java2d/pipe/RenderQueue.java
@@ -201,18 +201,7 @@ public abstract class RenderQueue {
* This method will block until the entire buffer has been flushed. The
* queue lock must be acquired before calling this method.
*/
- public void flushNow() {
- flushNow(true);
- }
-
- /**
- * Schedule to process each operation currently pending on the buffer.
- * This method will block until the entire buffer has been flushed. The
- * queue lock must be acquired before calling this method.
- * @param sync true, process the operations immediately
- */
- public abstract void flushNow(boolean sync);
-
+ public abstract void flushNow();
/**
* Immediately processes each operation currently pending on the buffer,
diff --git a/src/share/native/sun/java2d/Trace.h b/src/share/native/sun/java2d/Trace.h
index 4f038ddb99..a8a4a7589c 100644
--- a/src/share/native/sun/java2d/Trace.h
+++ b/src/share/native/sun/java2d/Trace.h
@@ -28,6 +28,9 @@
#include <jni.h>
#include "debug_trace.h"
+#ifdef __MACH__
+#include <mach/mach_time.h>
+#endif
#ifdef __cplusplus
extern "C" {
@@ -52,6 +55,8 @@ extern jint graphicsPrimitive_traceflags;
#define J2D_TRACE_VERBOSE2 5
#define J2D_TRACE_MAX (J2D_TRACE_VERBOSE2+1)
+#define J2D_PTRACE_TIME 8
+
JNIEXPORT void JNICALL
J2dTraceImpl(int level, jboolean cr, const char *string, ...);
JNIEXPORT void JNICALL
@@ -181,13 +186,41 @@ J2dTraceInit();
if (graphicsPrimitive_traceflags && jvm) { \
JNIEnv *env; \
jstring jstr; \
+ (*jvm)->AttachCurrentThreadAsDaemon(jvm, (void**)&env, NULL); \
+ jstr = (*env)->NewStringUTF(env, string); \
+ JNU_CallStaticMethodByName( \
+ env, NULL, "sun/java2d/loops/GraphicsPrimitive", \
+ "tracePrimitive", "(Ljava/lang/Object;)V", jstr); \
+ (*env)->DeleteLocalRef(env, jstr); \
+ } \
+ }
+
+#ifdef __MACH__
+#define J2dTraceNanoTime() (mach_absolute_time())
+
+#define J2dTracePrimitiveTime(string,t0) { \
+ if ((graphicsPrimitive_traceflags & J2D_PTRACE_TIME) && jvm) { \
+ JNIEnv *env; \
+ jstring jstr; \
+ static mach_timebase_info_data_t ti; \
+ jlong t1; \
+ t1 = mach_absolute_time(); \
+ if (ti.denom == 0) { \
+ (void) mach_timebase_info(&ti); \
+ } \
(*jvm)->AttachCurrentThreadAsDaemon(jvm, &env, NULL); \
jstr = (*env)->NewStringUTF(env, string); \
JNU_CallStaticMethodByName(env, NULL, "sun/java2d/loops/GraphicsPrimitive", \
- "tracePrimitive", "(Ljava/lang/Object;)V", jstr); \
+ "tracePrimitiveTime", "(Ljava/lang/Object;J)V", jstr,\
+ (((t1-t0)*ti.numer)/ti.denom)); \
(*env)->DeleteLocalRef(env, jstr); \
} \
}
+#else
+#define J2dTracePrimitiveTime(string,t)
+#define J2dTraceNanoTime() (0)
+#endif
+
#ifdef __cplusplus
};
#endif /* __cplusplus */
diff --git a/src/share/native/sun/java2d/opengl/OGLFuncs.h b/src/share/native/sun/java2d/opengl/OGLFuncs.h
index 427c91da2b..51fdf281ee 100644
--- a/src/share/native/sun/java2d/opengl/OGLFuncs.h
+++ b/src/share/native/sun/java2d/opengl/OGLFuncs.h
@@ -131,6 +131,7 @@ typedef void (GLAPIENTRY *glViewportType)(GLint x, GLint y, GLsizei width, GLsiz
* extensions, which is why they are called out separately here)
*/
typedef void (GLAPIENTRY *glActiveTextureARBType)(GLenum texture);
+typedef void (GLAPIENTRY *glClientActiveTextureType)(GLenum texture);
typedef void (GLAPIENTRY *glMultiTexCoord2fARBType)(GLenum texture, GLfloat s, GLfloat t);
typedef void (GLAPIENTRY *glTexImage3DType)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
@@ -290,6 +291,7 @@ typedef void (GLAPIENTRY *glTextureBarrierNVType) (void);
#define OGL_EXPRESS_EXT_FUNCS(action) \
OGL_##action##_EXT_FUNC(glActiveTextureARB); \
+ OGL_##action##_EXT_FUNC(glClientActiveTexture); \
OGL_##action##_EXT_FUNC(glMultiTexCoord2fARB); \
OGL_##action##_EXT_FUNC(glTexImage3D); \
OGL_##action##_EXT_FUNC(glBindRenderbufferEXT); \
diff --git a/src/share/native/sun/java2d/opengl/OGLTextRenderer.c b/src/share/native/sun/java2d/opengl/OGLTextRenderer.c
index 8b82cd6f7a..84590162e7 100644
--- a/src/share/native/sun/java2d/opengl/OGLTextRenderer.c
+++ b/src/share/native/sun/java2d/opengl/OGLTextRenderer.c
@@ -38,6 +38,7 @@
#include "OGLTextRenderer.h"
#include "OGLVertexCache.h"
#include "AccelGlyphCache.h"
+#include "jni_util.h"
/**
* The following constants define the inner and outer bounds of the
@@ -712,21 +713,14 @@ OGLTR_UpdateCachedDestination(OGLSDOps *dstOps, GlyphInfo *ginfo,
}
static jboolean
-OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps,
- GlyphInfo *ginfo, jint x, jint y,
- jint glyphIndex, jint totalGlyphs,
- jboolean rgbOrder, jint contrast,
- GLuint dstTextureID, jboolean * opened)
+OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps, GlyphInfo *ginfo, jint x, jint y, jint glyphIndex,
+ jint totalGlyphs, jboolean rgbOrder, jint contrast, GLuint dstTextureID)
{
CacheCellInfo *cell;
jint dx1, dy1, dx2, dy2;
jfloat dtx1, dty1, dtx2, dty2;
if (glyphMode != MODE_USE_CACHE_LCD) {
- if (*opened) {
- *opened = JNI_FALSE;
- j2d_glEnd();
- }
OGLTR_DisableGlyphModeState();
CHECK_PREVIOUS_OP(GL_TEXTURE_2D);
j2d_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
@@ -758,10 +752,6 @@ OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps,
}
if (ginfo->cellInfo == NULL) {
- if (*opened) {
- *opened = JNI_FALSE;
- j2d_glEnd();
- }
// rowBytes will always be a multiple of 3, so the following is safe
j2d_glPixelStorei(GL_UNPACK_ROW_LENGTH, ginfo->rowBytes / 3);
@@ -787,10 +777,6 @@ OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps,
dy2 = dy1 + ginfo->height;
if (dstTextureID == 0) {
- if (*opened) {
- *opened = JNI_FALSE;
- j2d_glEnd();
- }
// copy destination into second cached texture, if necessary
OGLTR_UpdateCachedDestination(dstOps, ginfo,
dx1, dy1, dx2, dy2,
@@ -818,23 +804,13 @@ OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps,
}
// render composed texture to the destination surface
- if (!*opened) {
- j2d_glBegin(GL_QUADS);
- *opened = JNI_TRUE;
+ if (!OGLMTVertexCache_enable(oglc, dstTextureID != 0)) {
+ J2dTracePrimitive("OGLMTVertexCache_enable_failed");
+ return JNI_FALSE;
}
-
- j2d_glMultiTexCoord2fARB(GL_TEXTURE0_ARB, cell->tx1, cell->ty1);
- j2d_glMultiTexCoord2fARB(GL_TEXTURE1_ARB, dtx1, dty1);
- j2d_glVertex2i(dx1, dy1);
- j2d_glMultiTexCoord2fARB(GL_TEXTURE0_ARB, cell->tx2, cell->ty1);
- j2d_glMultiTexCoord2fARB(GL_TEXTURE1_ARB, dtx2, dty1);
- j2d_glVertex2i(dx2, dy1);
- j2d_glMultiTexCoord2fARB(GL_TEXTURE0_ARB, cell->tx2, cell->ty2);
- j2d_glMultiTexCoord2fARB(GL_TEXTURE1_ARB, dtx2, dty2);
- j2d_glVertex2i(dx2, dy2);
- j2d_glMultiTexCoord2fARB(GL_TEXTURE0_ARB, cell->tx1, cell->ty2);
- j2d_glMultiTexCoord2fARB(GL_TEXTURE1_ARB, dtx1, dty2);
- j2d_glVertex2i(dx1, dy2);
+ OGLMTVertexCache_addGlyphQuad(oglc, dx1, dy1, dx2, dy2,
+ cell->tx1, cell->ty1, cell->tx2, cell->ty2,
+ dtx1, dty1, dtx2, dty2);
return JNI_TRUE;
}
@@ -1066,11 +1042,13 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
{
int glyphCounter;
GLuint dstTextureID = 0;
- jboolean hasLCDGlyphs = JNI_FALSE;
- jboolean lcdOpened = JNI_FALSE;
- jint ox1 = INT_MIN;
+ jlong time;
J2dTraceLn(J2D_TRACE_INFO, "OGLTR_DrawGlyphList");
+ if (graphicsPrimitive_traceflags & J2D_PTRACE_TIME) {
+ J2dTracePrimitive("OGLTR_DrawGlyphList");
+ time = J2dTraceNanoTime();
+ }
RETURN_IF_NULL(oglc);
RETURN_IF_NULL(dstOps);
@@ -1138,10 +1116,7 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
}
if (ginfo->rowBytes == ginfo->width) {
- if (lcdOpened) {
- lcdOpened = JNI_FALSE;
- j2d_glEnd();
- }
+ OGLMTVertexCache_disable();
// grayscale or monochrome glyph data
if (ginfo->width <= OGLTR_CACHE_CELL_WIDTH &&
ginfo->height <= OGLTR_CACHE_CELL_HEIGHT)
@@ -1151,22 +1126,12 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
ok = OGLTR_DrawGrayscaleGlyphNoCache(oglc, ginfo, x, y);
}
} else if (ginfo->rowBytes == ginfo->width * 4) {
- if (lcdOpened) {
- lcdOpened = JNI_FALSE;
- j2d_glEnd();
- }
+ OGLMTVertexCache_disable();
// color glyph data
ok = OGLTR_DrawColorGlyphNoCache(oglc, ginfo, x, y);
} else {
// LCD-optimized glyph data
jint rowBytesOffset = 0;
- if (!hasLCDGlyphs) {
- // Flush GPU buffers before processing first LCD glyph
- hasLCDGlyphs = JNI_TRUE;
- if (dstTextureID != 0) {
- j2d_glTextureBarrierNV();
- }
- }
if (subPixPos) {
jint frac = (jint)((glyphx - x) * 3);
@@ -1176,29 +1141,16 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
}
}
- // Flush GPU buffers before processing overlapping LCD glyphs on OSX
- if (dstTextureID != 0 && ox1 > x) {
- if (lcdOpened) {
- lcdOpened = JNI_FALSE;
- j2d_glEnd();
- }
- j2d_glTextureBarrierNV();
- }
-
if (rowBytesOffset == 0 &&
ginfo->width <= OGLTR_CACHE_CELL_WIDTH &&
ginfo->height <= OGLTR_CACHE_CELL_HEIGHT)
{
- ok = OGLTR_DrawLCDGlyphViaCache(oglc, dstOps,
- ginfo, x, y,
+ ok = OGLTR_DrawLCDGlyphViaCache(oglc, dstOps, ginfo, x, y,
glyphCounter, totalGlyphs,
rgbOrder, lcdContrast,
- dstTextureID, &lcdOpened);
+ dstTextureID);
} else {
- if (lcdOpened) {
- lcdOpened = JNI_FALSE;
- j2d_glEnd();
- }
+ OGLMTVertexCache_disable();
ok = OGLTR_DrawLCDGlyphNoCache(oglc, dstOps,
ginfo, x, y,
rowBytesOffset,
@@ -1206,15 +1158,12 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
dstTextureID);
}
}
-
- ox1 = x + ginfo->width;
if (!ok) {
break;
}
}
- if (lcdOpened) {
- j2d_glEnd();
- }
+ OGLMTVertexCache_disable();
+ J2dTracePrimitiveTime("OGLTR_DrawGlyphList", time);
}
JNIEXPORT void JNICALL
diff --git a/src/share/native/sun/java2d/opengl/OGLVertexCache.c b/src/share/native/sun/java2d/opengl/OGLVertexCache.c
index cd2d60c3a0..265a7ee817 100644
--- a/src/share/native/sun/java2d/opengl/OGLVertexCache.c
+++ b/src/share/native/sun/java2d/opengl/OGLVertexCache.c
@@ -30,6 +30,7 @@
#include "sun_java2d_SunGraphics2D.h"
+#include "jni_util.h"
#include "OGLPaints.h"
#include "OGLVertexCache.h"
@@ -39,11 +40,26 @@ typedef struct _J2DVertex {
jfloat dx, dy;
} J2DVertex;
+// Multitexture vertex
+typedef struct _J2DMTVertex {
+ jfloat dx, dy;
+ jfloat tx0, ty0;
+ jfloat tx1, ty1;
+} J2DMTVertex;
+
static J2DVertex *vertexCache = NULL;
static jint vertexCacheIndex = 0;
+static J2DMTVertex *mtVertexCache = NULL;
+static jboolean mtVertexCacheEnabled = JNI_FALSE;
+static jboolean mtUseTxtBarrier = JNI_FALSE;
+static jint evenLCDGlyphInd = 0;
+static jint oddLCDGlyphInd = ODD_LCD_GLYPHS_OFFSET;
+static jint lcdGlyphInd = 0;
+
static GLuint maskCacheTexID = 0;
static jint maskCacheIndex = 0;
+static void OGLMTVertexCache_flush(jint mask);
#define OGLVC_ADD_VERTEX(TX, TY, R, G, B, A, DX, DY) \
do { \
@@ -66,6 +82,25 @@ static jint maskCacheIndex = 0;
OGLVC_ADD_VERTEX(TX1, TY2, R, G, B, A, DX1, DY2); \
} while (0)
+#define OGLMTVC_ADD_VERTEX(IND, DX, DY, TX0, TY0, TX1, TY1) \
+ do { \
+ J2DMTVertex *v = &mtVertexCache[IND++]; \
+ v->dx = DX; \
+ v->dy = DY; \
+ v->tx0 = TX0; \
+ v->ty0 = TY0; \
+ v->tx1 = TX1; \
+ v->ty1 = TY1; \
+ } while (0)
+
+#define OGLMTVC_ADD_QUAD(IND, DX1, DY1, DX2, DY2, TX1, TY1, TX2, TY2, DTX1, DTY1, DTX2, DTY2) \
+ do { \
+ OGLMTVC_ADD_VERTEX((IND), DX1, DY1, TX1, TY1, DTX1, DTY1); \
+ OGLMTVC_ADD_VERTEX((IND), DX2, DY1, TX2, TY1, DTX2, DTY1); \
+ OGLMTVC_ADD_VERTEX((IND), DX2, DY2, TX2, TY2, DTX2, DTY2); \
+ OGLMTVC_ADD_VERTEX((IND), DX1, DY2, TX1, TY2, DTX1, DTY2); \
+ } while (0)
+
jboolean
OGLVertexCache_InitVertexCache(OGLContext *oglc)
{
@@ -287,4 +322,88 @@ OGLVertexCache_AddGlyphQuad(OGLContext *oglc,
oglc->r, oglc->g, oglc->b, oglc->a);
}
+jboolean OGLMTVertexCache_enable(OGLContext *oglc, jboolean useTxtBarrier) {
+ mtUseTxtBarrier = useTxtBarrier;
+ if (mtVertexCache == NULL) {
+ mtVertexCache = (J2DMTVertex *)malloc(OGLMTVC_MAX_INDEX * sizeof(J2DMTVertex));
+ if (mtVertexCache == NULL) {
+ return JNI_FALSE;
+ }
+ }
+
+ if (!mtVertexCacheEnabled) {
+ oglc->vertexCacheEnabled = JNI_FALSE;
+
+ j2d_glVertexPointer(2, GL_FLOAT, sizeof(J2DMTVertex), &mtVertexCache[0].dx);
+ j2d_glEnableClientState(GL_VERTEX_ARRAY);
+ j2d_glClientActiveTexture(GL_TEXTURE1_ARB);
+ j2d_glTexCoordPointer(2, GL_FLOAT, sizeof(J2DMTVertex), &mtVertexCache[0].tx1);
+ j2d_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ j2d_glClientActiveTexture(GL_TEXTURE0_ARB);
+ j2d_glTexCoordPointer(2, GL_FLOAT, sizeof(J2DMTVertex), &mtVertexCache[0].tx0);
+ j2d_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ mtVertexCacheEnabled = JNI_TRUE;
+ evenLCDGlyphInd = 0;
+ oddLCDGlyphInd = ODD_LCD_GLYPHS_OFFSET;
+ lcdGlyphInd = 0;
+ }
+
+ return JNI_TRUE;
+}
+void OGLMTVertexCache_disable() {
+ if (mtVertexCacheEnabled) {
+ OGLMTVertexCache_flush(OGLMTVC_FLUSH_ALL);
+ mtVertexCacheEnabled = JNI_FALSE;
+ }
+}
+
+void OGLMTVertexCache_flush(jint mask) {
+ if (mtVertexCacheEnabled) {
+ if ((mask & OGLMTVC_FLUSH_EVEN) && evenLCDGlyphInd > 0) {
+ if (mtUseTxtBarrier) {
+ // TextureBarrierNV() will guarantee that writes have completed
+ // and caches have been invalidated before subsequent Draws are
+ // executed
+ j2d_glTextureBarrierNV();
+ }
+ j2d_glDrawArrays(GL_QUADS, 0, evenLCDGlyphInd);
+ evenLCDGlyphInd = 0;
+ }
+
+ if ((mask & OGLMTVC_FLUSH_ODD) && oddLCDGlyphInd > ODD_LCD_GLYPHS_OFFSET) {
+ if (mtUseTxtBarrier) {
+ // See the comment above
+ j2d_glTextureBarrierNV();
+ }
+ j2d_glDrawArrays(GL_QUADS, ODD_LCD_GLYPHS_OFFSET,
+ oddLCDGlyphInd - ODD_LCD_GLYPHS_OFFSET);
+ oddLCDGlyphInd = ODD_LCD_GLYPHS_OFFSET;
+ }
+ }
+}
+
+void OGLMTVertexCache_addGlyphQuad(OGLContext *oglc,
+ jfloat dx1, jfloat dy1,
+ jfloat dx2, jfloat dy2,
+ jfloat tx1, jfloat ty1,
+ jfloat tx2, jfloat ty2,
+ jfloat dtx1, jfloat dty1,
+ jfloat dtx2, jfloat dty2)
+{
+ jint* ind;
+ if (lcdGlyphInd & 0x1) {
+ if (oddLCDGlyphInd >= OGLMTVC_MAX_INDEX) {
+ OGLMTVertexCache_flush(OGLMTVC_FLUSH_ODD);
+ }
+ ind = &oddLCDGlyphInd;
+ } else {
+ if (evenLCDGlyphInd >= ODD_LCD_GLYPHS_OFFSET) {
+ OGLMTVertexCache_flush(OGLMTVC_FLUSH_EVEN);
+ }
+ ind = &evenLCDGlyphInd;
+ }
+ lcdGlyphInd++;
+ OGLMTVC_ADD_QUAD(*ind, dx1, dy1, dx2, dy2, tx1, ty1, tx2, ty2, dtx1, dty1, dtx2, dty2);
+}
+
#endif /* !HEADLESS */
diff --git a/src/share/native/sun/java2d/opengl/OGLVertexCache.h b/src/share/native/sun/java2d/opengl/OGLVertexCache.h
index ef418939cf..d610275c7c 100644
--- a/src/share/native/sun/java2d/opengl/OGLVertexCache.h
+++ b/src/share/native/sun/java2d/opengl/OGLVertexCache.h
@@ -30,9 +30,14 @@
#include "OGLContext.h"
/**
- * Constants that control the size of the vertex cache.
+ * Constants that control the size of the vertex caches.
*/
#define OGLVC_MAX_INDEX 1024
+#define OGLMTVC_MAX_INDEX 2048
+#define ODD_LCD_GLYPHS_OFFSET (OGLMTVC_MAX_INDEX >> 1)
+#define OGLMTVC_FLUSH_EVEN 1
+#define OGLMTVC_FLUSH_ODD 2
+#define OGLMTVC_FLUSH_ALL 3
/**
* Constants that control the size of the texture tile cache used for
@@ -83,4 +88,15 @@ void OGLVertexCache_AddGlyphQuad(OGLContext *oglc,
jfloat dx1, jfloat dy1,
jfloat dx2, jfloat dy2);
+jboolean OGLMTVertexCache_enable(OGLContext *oglc, jboolean useTxtBarrier);
+void OGLMTVertexCache_addGlyphQuad(OGLContext *oglc,
+ jfloat dx1, jfloat dy1,
+ jfloat dx2, jfloat dy2,
+ jfloat tx1, jfloat ty1,
+ jfloat tx2, jfloat ty2,
+ jfloat dtx1, jfloat dty1,
+ jfloat dtx2, jfloat dty2);
+void OGLMTVertexCache_disable();
+
+
#endif /* OGLVertexCache_h_Included */
diff --git a/src/solaris/classes/sun/awt/X11/XWindowPeer.java b/src/solaris/classes/sun/awt/X11/XWindowPeer.java
index 2a9fe2a28a..d85781b2dd 100644
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java
+++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java
@@ -57,6 +57,8 @@ import sun.awt.IconInfo;
import sun.java2d.pipe.Region;
+import javax.swing.*;
+
class XWindowPeer extends XPanelPeer implements WindowPeer,
DisplayChangedListener {
@@ -108,10 +110,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
* The type is supposed to be immutable while the peer object exists.
* The value gets initialized in the preInit() method.
*/
- private Window.Type windowType = Window.Type.NORMAL;
+ private Window.Type windowType = getWindowType();
- public final Window.Type getWindowType() {
- return windowType;
+ final Window.Type getWindowType() {
+ return windowType == null ? Window.Type.NORMAL : windowType;
}
// It need to be accessed from XFramePeer.
@@ -1229,7 +1231,8 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
boolean isOverrideRedirect() {
return XWM.getWMID() == XWM.OPENLOOK_WM ||
- Window.Type.POPUP.equals(getWindowType());
+ (Window.Type.POPUP.equals(getWindowType()) &&
+ !isDialogLikePopup(getTarget()));
}
final boolean isOLWMDecorBug() {
@@ -1969,7 +1972,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_UTILITY;
break;
case POPUP:
- typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_POPUP_MENU;
+ typeAtom = isDialogLikePopup(getTarget()) ?
+ protocol.XA_NET_WM_WINDOW_TYPE_NORMAL :
+ protocol.XA_NET_WM_WINDOW_TYPE_POPUP_MENU;
break;
}
@@ -1984,6 +1989,20 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
}
}
+ boolean isDialogLikePopup (Object t) {
+ if (t instanceof JWindow) {
+ final JWindow target = (JWindow) getTarget();
+ final JRootPane rootPane = target.getRootPane();
+ if (rootPane != null) {
+ final Object value = rootPane.getClientProperty("SIMPLE_WINDOW");
+ if (value != null && (Boolean)value) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
@Override
public void xSetVisible(boolean visible) {
if (log.isLoggable(PlatformLogger.Level.FINE)) {
diff --git a/src/windows/classes/sun/java2d/d3d/D3DRenderQueue.java b/src/windows/classes/sun/java2d/d3d/D3DRenderQueue.java
index 46c6002d5a..1d6b42f1f4 100644
--- a/src/windows/classes/sun/java2d/d3d/D3DRenderQueue.java
+++ b/src/windows/classes/sun/java2d/d3d/D3DRenderQueue.java
@@ -132,7 +132,7 @@ public class D3DRenderQueue extends RenderQueue {
}
}
- public void flushNow(boolean sync) {
+ public void flushNow() {
// assert lock.isHeldByCurrentThread();
flushBuffer(null);
}
diff --git a/src/windows/native/sun/windows/awt.h b/src/windows/native/sun/windows/awt.h
index ba6486f9c0..74fae227cc 100644
--- a/src/windows/native/sun/windows/awt.h
+++ b/src/windows/native/sun/windows/awt.h
@@ -44,14 +44,18 @@
extern COLORREF DesktopColor2RGB(int colorIndex);
-#ifndef _WIN32_WINNT_WINBLUE
+
+//#ifndef _WIN32_WINNT_WINBLUE
+// TODO: What is about ShellScalingAPI.h
typedef enum _PROCESS_DPI_AWARENESS {
PROCESS_DPI_UNAWARE = 0,
PROCESS_SYSTEM_DPI_AWARE = 1,
PROCESS_PER_MONITOR_DPI_AWARE = 2
} PROCESS_DPI_AWARENESS;
-#endif
+//#endif
+
+/*
#ifndef _WIN32_WINNT_WIN10
typedef enum _DPI_AWARENESS {
DPI_AWARENESS_INVALID = -1,
@@ -59,12 +63,14 @@ typedef enum _DPI_AWARENESS {
DPI_AWARENESS_SYSTEM_AWARE = 1,
DPI_AWARENESS_PER_MONITOR_AWARE = 2
} DPI_AWARENESS;
-
+*/
typedef BOOL(EnableNonClientDpiScalingFunc)(HWND);
-#endif
+//#endif
// val >= 0 todo [tav] until switch to VS'12
+#if (_MSC_VER < 1700)
#define round(val) floor(val + 0.5)
+#endif
class AwtObject;
typedef AwtObject* PDATA;
diff --git a/src/windows/native/sun/windows/awt_Window.cpp b/src/windows/native/sun/windows/awt_Window.cpp
index 0f910ef3f0..49b87d46d0 100644
--- a/src/windows/native/sun/windows/awt_Window.cpp
+++ b/src/windows/native/sun/windows/awt_Window.cpp
@@ -1360,7 +1360,20 @@ void AwtWindow::Show()
if (nCmdShow == SW_SHOWNA) {
flags |= SWP_NOACTIVATE;
}
- ::SetWindowPos(GetHWnd(), HWND_TOP, 0, 0, 0, 0, flags);
+
+ // This flag allows the toplevel to be bellow other process toplevels.
+ // This behaviour is preferable for popups, but it is not appropriate
+ // for menus
+ BOOL isLightweightDialog = TRUE;
+ jclass windowPeerClass = env->FindClass("java/awt/peer/WindowPeer");
+ if (windowPeerClass != NULL) {
+ jmethodID isLightweightDialogMID = env->GetStaticMethodID(windowPeerClass, "isLightweightDialog", "(Ljava/awt/Window;)Z");
+ if (isLightweightDialogMID != NULL) {
+ isLightweightDialog = env->CallStaticBooleanMethod(windowPeerClass, isLightweightDialogMID, target);
+ }
+ }
+
+ ::SetWindowPos(GetHWnd(), isLightweightDialog ? HWND_TOP : HWND_TOPMOST, 0, 0, 0, 0, flags);
} else {
::ShowWindow(GetHWnd(), nCmdShow);
}
diff --git a/test/jb/javax/swing/JDialog/JDialog705.java b/test/jb/javax/swing/JDialog/JDialog705.java
new file mode 100644
index 0000000000..9a606ea3c0
--- /dev/null
+++ b/test/jb/javax/swing/JDialog/JDialog705.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright 2000-2018 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.imageio.ImageIO;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.Popup;
+import javax.swing.PopupFactory;
+import javax.swing.RootPaneContainer;
+import javax.swing.SwingUtilities;
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Window;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+/* @test
+ * @summary regression test on JRE-705 Z-order of child windows is broken on Mac OS
+ * @run main/othervm JDialog705
+ */
+
+public class JDialog705 {
+
+ private static Robot robot;
+ static {
+ try {
+ robot = new Robot();
+ } catch (AWTException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ private static JFrame jFrame;
+ private static Window windowAncestor;
+ private static JDialog modalBlocker;
+
+ public static void main(String[] args) throws Exception {
+
+ SwingUtilities.invokeAndWait(() -> {
+ jFrame = new JFrame("Wrong popup z-order");
+ jFrame.setSize(200, 200);
+
+ JPanel jPanel = new JPanel();
+ jPanel.setPreferredSize(new Dimension(200, 200));
+ jPanel.setBackground(Color.BLACK);
+
+ Popup popup = PopupFactory.getSharedInstance().getPopup(jFrame, jPanel, 100, 100);
+ windowAncestor = SwingUtilities.getWindowAncestor(jPanel);
+ ((RootPaneContainer) windowAncestor).getRootPane().putClientProperty("SIMPLE_WINDOW", true);
+ windowAncestor.setFocusable(true);
+ windowAncestor.setFocusableWindowState(true);
+ windowAncestor.setAutoRequestFocus(true);
+
+ jFrame.setVisible(true);
+ popup.show();
+
+
+ modalBlocker = new JDialog(windowAncestor, "Modal Blocker");
+ modalBlocker.setModal(true);
+ modalBlocker.setSize(new Dimension(200, 200));
+ modalBlocker.setLocation(200, 200);
+ modalBlocker.addWindowListener(new DialogListener());
+
+ modalBlocker.setVisible(true);
+ });
+ }
+
+ private static boolean checkImage(Container window, Dimension shotSize, int x, int y, int maxWidth, int maxHeight) {
+
+ boolean result = true;
+
+ System.out.println("checking for expectedX: " + x + "; expectedY: " + y);
+ System.out.println(" maxWidth: " + maxWidth + "; maxHeight: " + maxHeight);
+
+ Rectangle captureRect = new Rectangle(window.getLocationOnScreen(), shotSize);
+ BufferedImage screenImage = robot.createScreenCapture(captureRect);
+
+ int rgb;
+ int expectedRGB = screenImage.getRGB(x, y) & 0x00FFFFFF;
+
+ System.out.println(" expected rgb value: " + Integer.toHexString(expectedRGB));
+ for (int col = 1; col < maxWidth; col++) {
+ for (int row = 1; row < maxHeight; row++) {
+ // remove transparance
+ rgb = screenImage.getRGB(col, row) & 0x00FFFFFF;
+
+ result = (expectedRGB == rgb);
+ if (expectedRGB != rgb) {
+ System.out.println("at row: " + row + "; col: " + col);
+ System.out.println(" expected rgb value: " + Integer.toHexString(expectedRGB));
+ System.out.println(" actual rgb value: " + Integer.toHexString(rgb));
+ break;
+ }
+ }
+ if (!result) break;
+ }
+
+ try {
+ ImageIO.write(screenImage, "bmp", new File("test705" + window.getName() + ".bmp"));
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+
+ return result;
+ }
+
+ static class DialogListener implements WindowListener {
+
+ @Override
+ public void windowClosing(WindowEvent e) {
+
+ }
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+
+ }
+
+ @Override
+ public void windowIconified(WindowEvent e) {
+
+ }
+
+ @Override
+ public void windowDeiconified(WindowEvent e) {
+
+ }
+
+ @Override
+ public void windowActivated(WindowEvent e) {
+
+ }
+
+ @Override
+ public void windowDeactivated(WindowEvent e) {
+
+ }
+
+ @Override
+ public void windowOpened(WindowEvent windowEvent) {
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ Dimension shotSize;
+
+ shotSize = windowAncestor.getSize();
+ int expectedX = (int) (shotSize.getWidth() / 4);
+ int expectedY = (int) (shotSize.getHeight() / 4);
+ int maxWidth = (int) (shotSize.getWidth() / 2);
+ int maxHeight = (int) (shotSize.getHeight() / 2);
+ boolean popupRes = checkImage(windowAncestor, shotSize, expectedX, expectedY, maxWidth, maxHeight);
+
+ shotSize = modalBlocker.getContentPane().getSize();
+ expectedX = (int) (shotSize.getWidth() / 2 + shotSize.getWidth() / 4);
+ expectedY = (int) (shotSize.getHeight() / 2 + shotSize.getHeight() / 4);
+ maxWidth = (int) (shotSize.getWidth());
+ maxHeight = (int) (shotSize.getHeight());
+ boolean modalBlockerRes = checkImage(modalBlocker.getContentPane(), shotSize, expectedX,
+ expectedY, maxWidth, maxHeight);
+
+ String msg = "";
+
+ if (!popupRes) msg = "The popup must be above the frame.";
+ if (!modalBlockerRes) msg += "The modal blocker must be above the popup.";
+
+ if (!popupRes || !modalBlockerRes)
+ throw new RuntimeException(msg);
+
+ modalBlocker.dispose();
+ jFrame.dispose();
+ }
+ }
+}
diff --git a/test/jb/sun/lwawt/macosx/LWCToolkit/lwctoolkit.sh b/test/jb/sun/lwawt/macosx/LWCToolkit/lwctoolkit.sh
index 43447f14fb..aa088ac311 100755
--- a/test/jb/sun/lwawt/macosx/LWCToolkit/lwctoolkit.sh
+++ b/test/jb/sun/lwawt/macosx/LWCToolkit/lwctoolkit.sh
@@ -66,10 +66,19 @@ echo "Running workload"
${TESTJAVA}/bin/java -XX:+ExtendedDTraceProbes -cp ${TESTCLASSES} LWCToolkit ${ITERATIONS} &
TEST_PID=$!
-DTRACE_OUTPUT=$(echo ${BUPWD} | sudo -S ${DTRACE} -q -p${TEST_PID} -s ${TESTSRC}/lwctoolkit.d | grep "LWCToolkit" | grep " invokeAndWait")
+DTRACE_OUTPUT=$(echo ${BUPWD} | sudo -S ${DTRACE} -p${TEST_PID} -s ${TESTSRC}/lwctoolkit.d)
+echo "=dtrace output==========================="
echo $DTRACE_OUTPUT
+echo "========================================="
-count=$(echo ${DTRACE_OUTPUT} | awk {'print $3'})
+METHOD_LINE=$(echo ${DTRACE_OUTPUT} | grep "LWCToolkit" | grep " invokeAndWait")
+
+if [ -z "${METHOD_LINE}" ]; then
+ echo "LWCToolkit.invokeAndWait is not contained in dtrace's output"
+ count=0
+else
+ count=$(echo ${METHOD_LINE} | awk {'print $3'})
+fi
if [ "${count}" -lt "100" ]; then
echo "Test PASSED"
diff --git a/test/jbProblemsList.txt b/test/jbProblemsList.txt
index a1c84858b9..6f65338b07 100644
--- a/test/jbProblemsList.txt
+++ b/test/jbProblemsList.txt
@@ -89,10 +89,8 @@
# jdk_awt
-# https://bugs.openjdk.java.net/browse/JDK-8169106
-java/awt/Choice/ChoiceKeyEventReaction/ChoiceKeyEventReaction.html 6849922 windows-all,macosx-all
-
-java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 7100044 windows-all,macosx-all
+java/awt/Choice/ChoiceKeyEventReaction/ChoiceKeyEventReaction.html 8169106 windows-all,macosx-all
+java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 7100044 windows-all,macosx-all
# https://bugs.openjdk.java.net/browse/JDK-8169108
java/awt/Choice/ItemStateChangeTest/ItemStateChangeTest.java windows-all
@@ -198,7 +196,7 @@ java/awt/Focus/ToFrontFocusTest/ToFrontFocus.html generic
# https://bugs.openjdk.java.net/browse/JDK-7035459
java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java generic-all
-java/awt/Focus/TypeAhead/TestFocusFreeze.java 8198622 macosx-all,windows-all
+java/awt/Focus/TypeAhead/TestFocusFreeze.java 8198622 macosx-all,windows-all,linux-all
# https://bugs.openjdk.java.net/browse/JDK-8169100
java/awt/Focus/WindowInitialFocusTest/WindowInitialFocusTest.html windows-all
@@ -932,7 +930,7 @@ javax/swing/JInternalFrame/8020708/bug8020708.java generic-all
javax/swing/JInternalFrame/Test6325652.java 8196467 linux-all,macosx-all,windows-all
javax/swing/JInternalFrame/Test6505027.java 8172535 generic-all
-javax/swing/JLabel/6596966/bug6596966.java 8040914 macosx-all,windows-all
+javax/swing/JLabel/6596966/bug6596966.java 8040914 linux-all,macosx-all,windows-all
javax/swing/JList/6462008/bug6462008.java 7156347 generic-all
javax/swing/JMenu/4515762/bug4515762.java 8040915 generic-all