jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m
changeset 40446 cf666940a804
parent 39511 a7ad23d3d161
child 40993 a24dc7d0dd28
equal deleted inserted replaced
40445:bc9bb5f27a07 40446:cf666940a804
   805     [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
   805     [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
   806 }
   806 }
   807 
   807 
   808 - (void)sendEvent:(NSEvent *)event {
   808 - (void)sendEvent:(NSEvent *)event {
   809         if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {
   809         if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {
       
   810             // Move parent windows to front and make sure that a child window is displayed
       
   811             // in front of its nearest parent.
       
   812             if (self.ownerWindow != nil) {
       
   813                 JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
       
   814                 jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
       
   815                 if (platformWindow != NULL) {
       
   816                     static JNF_MEMBER_CACHE(jm_orderAboveSiblings, jc_CPlatformWindow, "orderAboveSiblings", "()V");
       
   817                     JNFCallVoidMethod(env,platformWindow, jm_orderAboveSiblings);
       
   818                     (*env)->DeleteLocalRef(env, platformWindow);
       
   819                 }
       
   820             }
       
   821             [self orderChildWindows:YES];
   810 
   822 
   811             NSPoint p = [NSEvent mouseLocation];
   823             NSPoint p = [NSEvent mouseLocation];
   812             NSRect frame = [self.nsWindow frame];
   824             NSRect frame = [self.nsWindow frame];
   813             NSRect contentRect = [self.nsWindow contentRectForFrameRect:frame];
   825             NSRect contentRect = [self.nsWindow contentRectForFrameRect:frame];
   814 
   826 
  1157 JNF_COCOA_ENTER(env);
  1169 JNF_COCOA_ENTER(env);
  1158 
  1170 
  1159     NSWindow *nsWindow = OBJC(windowPtr);
  1171     NSWindow *nsWindow = OBJC(windowPtr);
  1160     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
  1172     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
  1161         [nsWindow orderBack:nil];
  1173         [nsWindow orderBack:nil];
       
  1174         // Order parent windows
       
  1175         AWTWindow *awtWindow = (AWTWindow*)[nsWindow delegate];
       
  1176         while (awtWindow.ownerWindow != nil) {
       
  1177             awtWindow = awtWindow.ownerWindow;
       
  1178             if ([AWTWindow isJavaPlatformWindowVisible:awtWindow.nsWindow]) {
       
  1179                 [awtWindow.nsWindow orderBack:nil];
       
  1180             }
       
  1181         }
       
  1182         // Order child windows
       
  1183         [(AWTWindow*)[nsWindow delegate] orderChildWindows:NO];
  1162     }];
  1184     }];
  1163 
  1185 
  1164 JNF_COCOA_EXIT(env);
  1186 JNF_COCOA_EXIT(env);
  1165 }
  1187 }
  1166 
  1188