--- old/modules/graphics/src/main/native-glass/mac/GlassView3D.m 2015-03-27 15:16:18.000000000 -0400 +++ new/modules/graphics/src/main/native-glass/mac/GlassView3D.m 2015-03-27 15:16:18.000000000 -0400 @@ -206,7 +206,8 @@ - (id)initWithFrame:(NSRect)frame withJview:(jobject)jView withJproperties:(jobject)jproperties { - LOG("GlassView3D initWithFrame:withJview:withJproperties"); + LOG("GlassView3D initWithFrame(%s)", [NSStringFromRect(frame) UTF8String]); + self = [super initWithFrame:frame pixelFormat:[NSOpenGLView defaultPixelFormat]]; if (self != nil) { @@ -312,18 +313,21 @@ - (void)setFrameOrigin:(NSPoint)newOrigin { + LOG("GlassView3D setFrameOrigin:%s", [NSStringFromPoint(newOrigin) UTF8String]); [super setFrameOrigin:newOrigin]; [self->_delegate setFrameOrigin:newOrigin]; } - (void)setFrameSize:(NSSize)newSize { + LOG("GlassView3D setFrameSize:%s", [NSStringFromSize(newSize) UTF8String]); [super setFrameSize:newSize]; [self->_delegate setFrameSize:newSize]; } - (void)setFrame:(NSRect)frameRect { + LOG("GlassView3D setFrame:%s", [NSStringFromRect(frameRect) UTF8String]); [super setFrame:frameRect]; [self->_delegate setFrame:frameRect]; } --- old/modules/graphics/src/main/native-glass/mac/GlassWindow+Java.m 2015-03-27 15:16:19.000000000 -0400 +++ new/modules/graphics/src/main/native-glass/mac/GlassWindow+Java.m 2015-03-27 15:16:19.000000000 -0400 @@ -50,6 +50,13 @@ @end +//#define VERBOSE +#ifndef VERBOSE +#define LOG(MSG, ...) +#else +#define LOG(MSG, ...) GLASS_LOG(MSG, ## __VA_ARGS__); +#endif + @implementation GlassWindow (Java) #pragma mark --- Callbacks @@ -296,11 +303,13 @@ - (void)_setWindowFrameWithRect:(NSRect)rect withDisplay:(jboolean)display withAnimate:(jboolean)animate { NSRect frame = [self _constrainFrame:rect]; + LOG("GlassWindow _setWindowFrameWithRect: constrained (%s)", [NSStringFromRect(frame) UTF8String]); [self _setFlipFrame:frame display:(BOOL)display animate:(BOOL)animate]; } -- (void)_setBounds:(jint)x y:(jint)y xSet:(jboolean)xSet ySet:(jboolean)ySet w:(jint)w h:(jint)h cw:(jint)cw ch:(jint)ch +- (void)_setBounds:(jint)x y:(jint)y xSet:(jboolean)xSet ySet:(jboolean)ySet + w:(jint)w h:(jint)h cw:(jint)cw ch:(jint)ch { NSPoint origin = [self _flipFrame].origin; NSSize size = [self->nsWindow frame].size; @@ -313,6 +322,8 @@ jint newH = (h > 0) ? h : (ch > 0) ? (jint)sizeForClient.height : (jint)size.height; [self _setWindowFrameWithRect:NSMakeRect(newX, newY, newW, newH) withDisplay:JNI_TRUE withAnimate:JNI_FALSE]; + + LOG("GlassWindow _setBounds(w: %d h %d)", newW, newH); } - (void)_restorePreZoomedRect @@ -340,20 +351,28 @@ - (void)_setFlipFrame:(NSRect)frameRect display:(BOOL)displayFlag animate:(BOOL)animateFlag { - //NSLog(@"_setFlipFrame: %.2f,%.2f %.2fx%.2f", frameRect.origin.x, frameRect.origin.y, frameRect.size.width, frameRect.size.height); + LOG("GlassWindow(Java) _setFlipFrame:display:animate: %s", [NSStringFromRect(frameRect) UTF8String]); + NSScreen * screen = [[NSScreen screens] objectAtIndex: 0]; NSRect screenFrame = screen.frame; - //NSLog(@" screenFrame: %.2f,%.2f %.2fx%.2f", screenFrame.origin.x, screenFrame.origin.y, screenFrame.size.width, screenFrame.size.height); + LOG("GlassWindow(Java) screenFrame: %s", [NSStringFromRect(screenFrame) UTF8String]); frameRect.origin.y = screenFrame.size.height - frameRect.size.height - frameRect.origin.y; - //NSLog(@" set to frameRect:%.2f,%.2f %.2fx%.2f", frameRect.origin.x, frameRect.origin.y, frameRect.size.width, frameRect.size.height); + if (frameRect.size.width > screenFrame.size.width) { + frameRect.size.width = screenFrame.size.width; + } + + if (frameRect.size.height > screenFrame.size.height) { + frameRect.size.height = screenFrame.size.height; + } + + LOG("GlassWindow(Java) set to frameRect: %s", [NSStringFromRect(frameRect) UTF8String]); + [self->nsWindow setFrame:frameRect display:displayFlag animate:animateFlag]; - //frameRect = [self _flipFrame]; - //NSLog(@" _flipFrame:%.2f,%.2f %.2fx%.2f", frameRect.origin.x, frameRect.origin.y, frameRect.size.width, frameRect.size.height); - //frameRect = [super frame]; - //NSLog(@" frame:%.2f,%.2f %.2fx%.2f", frameRect.origin.x, frameRect.origin.y, frameRect.size.width, frameRect.size.height); + frameRect = [self _flipFrame]; + LOG("GlassWindow(Java) _flipFrame: %s", [NSStringFromRect(frameRect) UTF8String]); } - (NSRect)_flipFrame @@ -362,11 +381,15 @@ NSRect screenFrame = screen.frame; NSRect frame = [self->nsWindow frame]; - //NSLog(@"_flipFrame: v.s.h=%.2f f.s.h=%.2f f.o.y=%.2f", screenFrame.size.height, frame.size.height, frame.origin.y); + LOG("GlassWindow(Java) _flipFrame: screenFrame %s windowFrame %s", + [NSStringFromRect(screenFrame) UTF8String], + [NSStringFromRect(frame) UTF8String]); + frame.origin.y = screenFrame.size.height - frame.size.height - frame.origin.y; - //NSLog(@" result: f.o.y=%.2f", frame.origin.y); + frame.origin.x = screenFrame.size.width - frame.size.width - frame.origin.x; - //NSLog(@"_flipFrame: %.2f,%.2f %.2fx%.2f", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); + LOG("GlassView3D _flipFrame: result %s", [NSStringFromPoint(frame.origin) UTF8String]); + return frame; } --- old/modules/graphics/src/main/native-glass/mac/GlassWindow.m 2015-03-27 15:16:20.000000000 -0400 +++ new/modules/graphics/src/main/native-glass/mac/GlassWindow.m 2015-03-27 15:16:20.000000000 -0400 @@ -162,9 +162,9 @@ [button setAcceptsTouchEvents:NO]; \ [button setAction:nil]; \ [button setEnabled:NO]; \ - break; \ + default: \ + return button; \ } \ - return button; \ } \ - (void)sendEvent:(NSEvent *)event \ { \ @@ -879,10 +879,11 @@ NSView *oldView = window->view; window->view = getMacView(env, jview); - //NSLog(@" window: %@", window); - //NSLog(@" frame: %.2f,%.2f %.2fx%.2f", [window frame].origin.x, [window frame].origin.y, [window frame].size.width, [window frame].size.height); - //NSLog(@" view: %@", window->view); - //NSLog(@" frame: %.2f,%.2f %.2fx%.2f", [window->view frame].origin.x, [window->view frame].origin.y, [window->view frame].size.width, [window->view frame].size.height); + + LOG("window: %@ frame: %s", window, + [NSStringFromRect([window->nsWindow frame]) UTF8String]); + LOG("view: %@ frame: %s", window->view, + [NSStringFromRect([window->view frame]) UTF8String]); if (oldView && oldView != window->view) { [[oldView delegate] resetMouseTracking];