< prev index next >

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

Print this page




 692     jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
 693     if (platformWindow != NULL) {
 694         JNFCallVoidMethod(env, platformWindow, jm_windowDidExitFullScreen);
 695         [self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_DID_EXIT withEnv:env];
 696         (*env)->DeleteLocalRef(env, platformWindow);
 697     }
 698     [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
 699 }
 700 
 701 - (void)sendEvent:(NSEvent *)event {
 702         if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {
 703 
 704             NSPoint p = [NSEvent mouseLocation];
 705             NSRect frame = [self.nsWindow frame];
 706             NSRect contentRect = [self.nsWindow contentRectForFrameRect:frame];
 707 
 708             // Check if the click happened in the non-client area (title bar)
 709             if (p.y >= (frame.origin.y + contentRect.size.height)) {
 710                 JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 711                 jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];

 712                 // Currently, no need to deliver the whole NSEvent.
 713                 static JNF_MEMBER_CACHE(jm_deliverNCMouseDown, jc_CPlatformWindow, "deliverNCMouseDown", "()V");
 714                 JNFCallVoidMethod(env, platformWindow, jm_deliverNCMouseDown);


 715             }
 716         }
 717 }
 718 
 719 - (void)constrainSize:(NSSize*)size {
 720     float minWidth = 0.f, minHeight = 0.f;
 721 
 722     if (IS(self.styleBits, DECORATED)) {
 723         NSRect frame = [self.nsWindow frame];
 724         NSRect contentRect = [NSWindow contentRectForFrameRect:frame styleMask:[self.nsWindow styleMask]];
 725 
 726         float top = frame.size.height - contentRect.size.height;
 727         float left = contentRect.origin.x - frame.origin.x;
 728         float bottom = contentRect.origin.y - frame.origin.y;
 729         float right = frame.size.width - (contentRect.size.width + left);
 730 
 731         // Speculative estimation: 80 - enough for window decorations controls
 732         minWidth += left + right + 80;
 733         minHeight += top + bottom;
 734     }




 692     jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
 693     if (platformWindow != NULL) {
 694         JNFCallVoidMethod(env, platformWindow, jm_windowDidExitFullScreen);
 695         [self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_DID_EXIT withEnv:env];
 696         (*env)->DeleteLocalRef(env, platformWindow);
 697     }
 698     [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
 699 }
 700 
 701 - (void)sendEvent:(NSEvent *)event {
 702         if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {
 703 
 704             NSPoint p = [NSEvent mouseLocation];
 705             NSRect frame = [self.nsWindow frame];
 706             NSRect contentRect = [self.nsWindow contentRectForFrameRect:frame];
 707 
 708             // Check if the click happened in the non-client area (title bar)
 709             if (p.y >= (frame.origin.y + contentRect.size.height)) {
 710                 JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 711                 jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
 712                 if (platformWindow != NULL) {
 713                     // Currently, no need to deliver the whole NSEvent.
 714                     static JNF_MEMBER_CACHE(jm_deliverNCMouseDown, jc_CPlatformWindow, "deliverNCMouseDown", "()V");
 715                     JNFCallVoidMethod(env, platformWindow, jm_deliverNCMouseDown);
 716                     (*env)->DeleteLocalRef(env, platformWindow);
 717                 }
 718             }
 719         }
 720 }
 721 
 722 - (void)constrainSize:(NSSize*)size {
 723     float minWidth = 0.f, minHeight = 0.f;
 724 
 725     if (IS(self.styleBits, DECORATED)) {
 726         NSRect frame = [self.nsWindow frame];
 727         NSRect contentRect = [NSWindow contentRectForFrameRect:frame styleMask:[self.nsWindow styleMask]];
 728 
 729         float top = frame.size.height - contentRect.size.height;
 730         float left = contentRect.origin.x - frame.origin.x;
 731         float bottom = contentRect.origin.y - frame.origin.y;
 732         float right = frame.size.width - (contentRect.size.width + left);
 733 
 734         // Speculative estimation: 80 - enough for window decorations controls
 735         minWidth += left + right + 80;
 736         minHeight += top + bottom;
 737     }


< prev index next >