< prev index next >

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

Print this page




 790         JNFCallVoidMethod(env, platformWindow, jm_windowWillExitFullScreen);
 791         [self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_WILL_EXIT withEnv:env];
 792         (*env)->DeleteLocalRef(env, platformWindow);
 793     }
 794 }
 795 
 796 - (void)windowDidExitFullScreen:(NSNotification *)notification {
 797     static JNF_MEMBER_CACHE(jm_windowDidExitFullScreen, jc_CPlatformWindow, "windowDidExitFullScreen", "()V");
 798     JNIEnv *env = [ThreadUtilities getJNIEnv];
 799     jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
 800     if (platformWindow != NULL) {
 801         JNFCallVoidMethod(env, platformWindow, jm_windowDidExitFullScreen);
 802         [self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_DID_EXIT withEnv:env];
 803         (*env)->DeleteLocalRef(env, platformWindow);
 804     }
 805     [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
 806 }
 807 
 808 - (void)sendEvent:(NSEvent *)event {
 809         if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {












 810 
 811             NSPoint p = [NSEvent mouseLocation];
 812             NSRect frame = [self.nsWindow frame];
 813             NSRect contentRect = [self.nsWindow contentRectForFrameRect:frame];
 814 
 815             // Check if the click happened in the non-client area (title bar)
 816             if (p.y >= (frame.origin.y + contentRect.size.height)) {
 817                 JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 818                 jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
 819                 if (platformWindow != NULL) {
 820                     // Currently, no need to deliver the whole NSEvent.
 821                     static JNF_MEMBER_CACHE(jm_deliverNCMouseDown, jc_CPlatformWindow, "deliverNCMouseDown", "()V");
 822                     JNFCallVoidMethod(env, platformWindow, jm_deliverNCMouseDown);
 823                     (*env)->DeleteLocalRef(env, platformWindow);
 824                 }
 825             }
 826         }
 827 }
 828 
 829 - (void)constrainSize:(NSSize*)size {


1142         window.javaMaxSize = max;
1143         [window updateMinMaxSize:IS(window.styleBits, RESIZABLE)];
1144     }];
1145 
1146 JNF_COCOA_EXIT(env);
1147 }
1148 
1149 /*
1150  * Class:     sun_lwawt_macosx_CPlatformWindow
1151  * Method:    nativePushNSWindowToBack
1152  * Signature: (J)V
1153  */
1154 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativePushNSWindowToBack
1155 (JNIEnv *env, jclass clazz, jlong windowPtr)
1156 {
1157 JNF_COCOA_ENTER(env);
1158 
1159     NSWindow *nsWindow = OBJC(windowPtr);
1160     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
1161         [nsWindow orderBack:nil];










1162     }];
1163 
1164 JNF_COCOA_EXIT(env);
1165 }
1166 
1167 /*
1168  * Class:     sun_lwawt_macosx_CPlatformWindow
1169  * Method:    nativePushNSWindowToFront
1170  * Signature: (J)V
1171  */
1172 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativePushNSWindowToFront
1173 (JNIEnv *env, jclass clazz, jlong windowPtr)
1174 {
1175 JNF_COCOA_ENTER(env);
1176 
1177     NSWindow *nsWindow = OBJC(windowPtr);
1178     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
1179 
1180         if (![nsWindow isKeyWindow]) {
1181             [nsWindow makeKeyAndOrderFront:nsWindow];




 790         JNFCallVoidMethod(env, platformWindow, jm_windowWillExitFullScreen);
 791         [self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_WILL_EXIT withEnv:env];
 792         (*env)->DeleteLocalRef(env, platformWindow);
 793     }
 794 }
 795 
 796 - (void)windowDidExitFullScreen:(NSNotification *)notification {
 797     static JNF_MEMBER_CACHE(jm_windowDidExitFullScreen, jc_CPlatformWindow, "windowDidExitFullScreen", "()V");
 798     JNIEnv *env = [ThreadUtilities getJNIEnv];
 799     jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
 800     if (platformWindow != NULL) {
 801         JNFCallVoidMethod(env, platformWindow, jm_windowDidExitFullScreen);
 802         [self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_DID_EXIT withEnv:env];
 803         (*env)->DeleteLocalRef(env, platformWindow);
 804     }
 805     [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
 806 }
 807 
 808 - (void)sendEvent:(NSEvent *)event {
 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];
 822 
 823             NSPoint p = [NSEvent mouseLocation];
 824             NSRect frame = [self.nsWindow frame];
 825             NSRect contentRect = [self.nsWindow contentRectForFrameRect:frame];
 826 
 827             // Check if the click happened in the non-client area (title bar)
 828             if (p.y >= (frame.origin.y + contentRect.size.height)) {
 829                 JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 830                 jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
 831                 if (platformWindow != NULL) {
 832                     // Currently, no need to deliver the whole NSEvent.
 833                     static JNF_MEMBER_CACHE(jm_deliverNCMouseDown, jc_CPlatformWindow, "deliverNCMouseDown", "()V");
 834                     JNFCallVoidMethod(env, platformWindow, jm_deliverNCMouseDown);
 835                     (*env)->DeleteLocalRef(env, platformWindow);
 836                 }
 837             }
 838         }
 839 }
 840 
 841 - (void)constrainSize:(NSSize*)size {


1154         window.javaMaxSize = max;
1155         [window updateMinMaxSize:IS(window.styleBits, RESIZABLE)];
1156     }];
1157 
1158 JNF_COCOA_EXIT(env);
1159 }
1160 
1161 /*
1162  * Class:     sun_lwawt_macosx_CPlatformWindow
1163  * Method:    nativePushNSWindowToBack
1164  * Signature: (J)V
1165  */
1166 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativePushNSWindowToBack
1167 (JNIEnv *env, jclass clazz, jlong windowPtr)
1168 {
1169 JNF_COCOA_ENTER(env);
1170 
1171     NSWindow *nsWindow = OBJC(windowPtr);
1172     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
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];
1184     }];
1185 
1186 JNF_COCOA_EXIT(env);
1187 }
1188 
1189 /*
1190  * Class:     sun_lwawt_macosx_CPlatformWindow
1191  * Method:    nativePushNSWindowToFront
1192  * Signature: (J)V
1193  */
1194 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativePushNSWindowToFront
1195 (JNIEnv *env, jclass clazz, jlong windowPtr)
1196 {
1197 JNF_COCOA_ENTER(env);
1198 
1199     NSWindow *nsWindow = OBJC(windowPtr);
1200     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
1201 
1202         if (![nsWindow isKeyWindow]) {
1203             [nsWindow makeKeyAndOrderFront:nsWindow];


< prev index next >