Mercurial > hg > openjdk > jdk8u > jdk
changeset 12094:275fcb7d4e3e jdk8u102-b33
8163583: [macosx] Press "To Back" button on the Dialog,the Dialog moves behind the Frame
Reviewed-by: serb
author | dmarkov |
---|---|
date | Tue, 16 Aug 2016 17:58:17 +0300 |
parents | 99094b4e328d |
children | 0fd120d95c5b |
files | src/macosx/native/sun/awt/AWTWindow.m |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/macosx/native/sun/awt/AWTWindow.m Tue Aug 02 08:03:29 2016 -0700 +++ b/src/macosx/native/sun/awt/AWTWindow.m Tue Aug 16 17:58:17 2016 +0300 @@ -800,6 +800,18 @@ - (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 @@ 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);