< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m

Print this page

        

*** 805,814 **** --- 805,826 ---- [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows]; } - (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]; NSRect contentRect = [self.nsWindow contentRectForFrameRect:frame];
*** 1157,1166 **** --- 1169,1188 ---- 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); }
< prev index next >