diff --git a/.hgtags b/.hgtags index 393f3e47f72ac22c69e1133493985436f716f233..c72a80d688462b17b659b600c8dd546a6bff677c 100644 --- a/.hgtags +++ b/.hgtags @@ -628,6 +628,8 @@ e915a408ebf7ba05b36d1b714e166a1d9e5c7edd jdk8u102-b11 901ecf04370c7c03c61e22ab87a266c355baff54 jdk8u102-b13 48c99b42383912886c005891c04b5f599adf6722 jdk8u102-b14 222d3ac3aa1f99f16e31c1c4a10f916ce83ff759 jdk8u102-b31 +e3839fe291add6e0ea199457fb31c9312cc5dd77 jdk8u102-b32 +275fcb7d4e3e70a37ac70c33d087a805ba182f1e jdk8u102-b33 ebc56c2e803597ef409a5296addc986b390d934d jdk8u111-b00 c4f03717831993e4658b8366810ca4682ece952d jdk8u111-b01 de1d09f09e571e38afdf1fb72984ec210e7c19e6 jdk8u111-b02 diff --git a/src/macosx/native/sun/awt/AWTWindow.m b/src/macosx/native/sun/awt/AWTWindow.m index 1194ad81fc8d3d344ab68f48115088e9b8aff194..a20a3ed235a06db3e1f76e2bdcf0378377a96418 100644 --- a/src/macosx/native/sun/awt/AWTWindow.m +++ b/src/macosx/native/sun/awt/AWTWindow.m @@ -800,6 +800,18 @@ AWT_ASSERT_APPKIT_THREAD; - (void)sendEvent:(NSEvent *)event { if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) { + // Move parent windows to front and make sure that a child window is displayed + // in front of its nearest parent. + if (self.ownerWindow != nil) { + JNIEnv *env = [ThreadUtilities getJNIEnvUncached]; + jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env]; + if (platformWindow != NULL) { + static JNF_MEMBER_CACHE(jm_orderAboveSiblings, jc_CPlatformWindow, "orderAboveSiblings", "()V"); + JNFCallVoidMethod(env,platformWindow, jm_orderAboveSiblings); + (*env)->DeleteLocalRef(env, platformWindow); + } + } + [self orderChildWindows:YES]; NSPoint p = [NSEvent mouseLocation]; NSRect frame = [self.nsWindow frame]; @@ -1100,6 +1112,16 @@ JNF_COCOA_ENTER(env); NSWindow *nsWindow = OBJC(windowPtr); [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ [nsWindow orderBack:nil]; + // Order parent windows + AWTWindow *awtWindow = (AWTWindow*)[nsWindow delegate]; + while (awtWindow.ownerWindow != nil) { + awtWindow = awtWindow.ownerWindow; + if ([AWTWindow isJavaPlatformWindowVisible:awtWindow.nsWindow]) { + [awtWindow.nsWindow orderBack:nil]; + } + } + // Order child windows + [(AWTWindow*)[nsWindow delegate] orderChildWindows:NO]; }]; JNF_COCOA_EXIT(env);