/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#import <Cocoa/Cocoa.h>
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
#import "sun_lwawt_macosx_CPlatformWindow.h"
#import "com_apple_eawt_event_GestureHandler.h"
#import "com_apple_eawt_FullScreenHandler.h"
#import "AWTWindow.h"
#import "AWTView.h"
#import "CMenu.h"
#import "CMenuBar.h"
#import "LWCToolkit.h"
#import "GeomUtilities.h"
#import "ThreadUtilities.h"
#import "OSVersion.h"
static const float GROW_BOX_SIZE = 12.f;
@interface JavaResizeGrowBoxOverlayWindow : NSWindow { }
@end
{
return YES;
}
{
return nil;
}
@end
// Cocoa windowDidBecomeKey/windowDidResignKey notifications
// doesn't provide information about "opposite" window, so we
// have to do a bit of tracking. This variable points to a window
// which had been the key window just before a new key window
// was set. It would be nil if the new key window isn't an AWT
// window or the app currently has no key window.
// --------------------------------------------------------------
{ \
\
\
\
return self; \
} \
\
/* NSWindow overrides */ \
- (BOOL) canBecomeKeyWindow { \
} \
\
- (BOOL) canBecomeMainWindow { \
} \
\
- (BOOL) worksWhenModal { \
} \
\
}
@end
@end
// --------------------------------------------------------------
if (resizable) {
} else {
}
}
// creates a new NSWindow style mask based on the _STYLE_PROP_BITMASK bits
} else {
}
return type;
}
// updates _METHOD_PROP_BITMASK based properties on the window
}
}
}
}
}
}
}
} else {
}
}
}
- (BOOL) shouldShowGrowBox {
}
- (NSImage *) createGrowBoxImage {
JRSUIControlDraw(renderer, growBoxWidget, [[NSGraphicsContext currentContext] graphicsPort], CGRectMake(0, 1, GROW_BOX_SIZE - 1, GROW_BOX_SIZE - 1));
[image unlockFocus];
return image;
}
{
}
}
{
}
else
{
// These windows will appear in the window list in the dock icon menu
}
if ([self shouldShowGrowBox]) {
growBoxWindow = [[JavaResizeGrowBoxOverlayWindow alloc] initWithContentRect:NSMakeRect(0, 0, [growBoxImage size].width, [growBoxImage size].height) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
} else growBoxWindow = nil;
return self;
}
return [window isKindOfClass: [AWTWindow_Panel class]] || [window isKindOfClass: [AWTWindow_Normal class]];
}
// checks that this window is under the mouse cursor and this point is not overlapped by others windows
CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y);
NSMutableArray *windows = (NSMutableArray *)CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID);
if (layer == 0) {
CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect);
return currentWinID == winID;
} else if (currentWinID == winID) {
return NO;
}
}
}
return NO;
}
- (void) synthesizeMouseEnteredExitedEvents {
int eventType = 0;
if (isUnderMouse && !mouseIsOver) {
} else if (!isUnderMouse && mouseIsOver) {
} else {
return;
}
timestamp: 0
eventNumber: 0
];
}
}
- (void) dealloc {
[super dealloc];
}
// NSWindow overrides
- (BOOL) canBecomeKeyWindow {
}
- (BOOL) canBecomeMainWindow {
}
- (BOOL) worksWhenModal {
}
// Gesture support
if (platformWindow != NULL) {
// extract the target AWT Window object out of the CPlatformWindow
// translate the point into Java coordinates
// send up to the GestureHandler to recursively dispatch on the AWT event thread
static JNF_STATIC_MEMBER_CACHE(sjm_handleGestureFromNative, jc_GestureHandler, "handleGestureFromNative", "(Ljava/awt/Window;IDDDD)V");
JNFCallStaticVoidMethod(env, sjm_handleGestureFromNative, awtWindow, type, (jdouble)loc.x, (jdouble)loc.y, (jdouble)a, (jdouble)b);
}
}
}
a:-1.0
b:0.0];
}
a:1.0
b:0.0];
}
a:[event magnification]
b:0.0];
}
b:0.0];
}
}
// NSWindowDelegate methods
- (void) adjustGrowBoxWindow {
}
}
- (void) _deliverMoveResizeEvent {
// deliver the event if this is a user-initiated live resize or as a side-effect
// of a Java initiated resize, because AppKit can override the bounds and force
// the bounds of the window to avoid the Dock or remain on screen.
if (platformWindow == NULL) {
// TODO: create generic AWT assert
}
static JNF_MEMBER_CACHE(jm_deliverMoveResizeEvent, jc_CPlatformWindow, "deliverMoveResizeEvent", "(IIIIZ)V");
}
}
}
// TODO: don't see this callback invoked anytime so we track
// window exposing in _setVisible:(BOOL)
}
if (platformWindow != NULL) {
}
return YES;
}
if (platformWindow != NULL) {
}
}
}
}
//AWT_ASSERT_APPKIT_THREAD;
if (platformWindow != NULL) {
static JNF_MEMBER_CACHE(jm_deliverWindowFocusEvent, jc_CPlatformWindow, "deliverWindowFocusEvent", "(ZLsun/lwawt/macosx/CPlatformWindow;)V");
JNFCallVoidMethod(env, platformWindow, jm_deliverWindowFocusEvent, (jboolean)focused, oppositeWindow);
}
}
}
}
// TODO: check why sometimes at start is invoked *not* on AppKit main thread.
// the new key window
} else {
}
}
if (platformWindow != NULL) {
}
}
if (platformWindow != NULL) {
static JNF_MEMBER_CACHE(jm_deliverWindowClosingEvent, jc_CPlatformWindow, "deliverWindowClosingEvent", "()V");
}
// The window will be closed (if allowed) as result of sending Java event
return NO;
}
static JNF_STATIC_MEMBER_CACHE(jm_notifyFullScreenOperation, jc_FullScreenHandler, "handleFullScreenEventFromNative", "(Ljava/awt/Window;I)V");
if (platformWindow != NULL) {
}
}
}
static JNF_MEMBER_CACHE(jm_windowWillEnterFullScreen, jc_CPlatformWindow, "windowWillEnterFullScreen", "()V");
if (platformWindow != NULL) {
}
}
static JNF_MEMBER_CACHE(jm_windowDidEnterFullScreen, jc_CPlatformWindow, "windowDidEnterFullScreen", "()V");
if (platformWindow != NULL) {
}
}
static JNF_MEMBER_CACHE(jm_windowWillExitFullScreen, jc_CPlatformWindow, "windowWillExitFullScreen", "()V");
if (platformWindow != NULL) {
}
}
static JNF_MEMBER_CACHE(jm_windowDidExitFullScreen, jc_CPlatformWindow, "windowDidExitFullScreen", "()V");
if (platformWindow != NULL) {
}
}
if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {
// Check if the click happened in the non-client area (title bar)
// Currently, no need to deliver the whole NSEvent.
}
}
}
// Speculative estimation: 80 - enough for window decorations controls
}
if ([self shouldShowGrowBox]) {
}
}
}
}
}
}
}
}
+ (AWTWindow *) lastKeyWindow {
return lastKeyWindow;
}
@end // AWTWindow
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeCreateNSWindow
* Signature: (JJIIII)J
*/
(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h)
{
// the window is released is CPlatformWindow.nativeDispose()
}];
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeSetNSWindowStyleBits
* Signature: (JII)V
*/
{
// scans the bit field, and only updates the values requested by the mask
// (this implicity handles the _CALLBACK_PROP_BITMASK case, since those are passive reads)
// resets the NSWindow's style mask if the mask intersects any of those bits
}
// calls methods on NSWindow to change other properties, based on the mask
}
}];
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeSetNSWindowMenuBar
* Signature: (JJ)V
*/
{
if ([nsWindow isKeyWindow]) {
}
}];
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeGetNSWindowInsets
*/
{
}];
return ret;
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeSetNSWindowBounds
* Signature: (JDDDD)V
*/
(JNIEnv *env, jclass clazz, jlong windowPtr, jdouble originX, jdouble originY, jdouble width, jdouble height)
{
// TODO: not sure we need displayIfNeeded message in our view
// only start tracking events if pointer is above the toplevel
// TODO: should post an Entered event if YES.
// ensure we repaint the whole window after the resize operation
// (this will also re-enable screen updates, which were disabled above)
// TODO: send PaintEvent
}];
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeSetNSWindowMinMax
* Signature: (JDDDD)V
*/
(JNIEnv *env, jclass clazz, jlong windowPtr, jdouble minW, jdouble minH, jdouble maxW, jdouble maxH)
{
}];
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativePushNSWindowToBack
* Signature: (J)V
*/
{
}];
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativePushNSWindowToFront
* Signature: (J)V
*/
{
if (![nsWindow isKeyWindow]) {
} else {
}
}];
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeSetNSWindowTitle
*/
{
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeRevalidateNSWindowShadow
* Signature: (J)V
*/
{
}];
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeScreenOn_AppKitThread
* Signature: (J)I
*/
{
return ret;
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeSetNSWindowMinimizedIcon
* Signature: (JJ)V
*/
{
}];
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeSetNSWindowRepresentedFilename
*/
{
NSURL *url = (filename == NULL) ? nil : [NSURL fileURLWithPath:JNFNormalizedNSStringForPath(env, filename)];
}];
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeSynthesizeMouseEnteredExitedEvents
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMouseEnteredExitedEvents
{
}];
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: _toggleFullScreenMode
* Signature: (J)V
*/
{
}];
}
{
}];
}
{
}
// AWTWindow holds a reference to the NSWindow in its nsWindow
// property. Unsetting the delegate allows it to be deallocated
// which releases the reference. This, in turn, allows the window
// itself be deallocated.
}];
}