diff -r 2ad159b40c2c buildSrc/mac.gradle --- a/buildSrc/mac.gradle Thu Nov 13 09:41:26 2014 -0800 +++ b/buildSrc/mac.gradle Fri Nov 14 11:05:58 2014 -0500 @@ -121,6 +121,7 @@ commonParams, "-framework", "AppKit", "-framework", "ApplicationServices", + "-framework", "ExceptionHandling", "-framework", "OpenGL", "-framework", "QuartzCore", "-framework", "Security", diff -r 2ad159b40c2c modules/graphics/src/main/java/com/sun/javafx/text/TextRun.java --- a/modules/graphics/src/main/java/com/sun/javafx/text/TextRun.java Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/java/com/sun/javafx/text/TextRun.java Fri Nov 14 11:05:58 2014 -0500 @@ -335,7 +335,10 @@ } return positions[glyphIndex<<1]; } - return glyphIndex == 0 ? 0 : getWidth(); + float ret = glyphIndex == 0 ? 0 : getWidth(); + System.err.println("TextRun.getPosX: " + ret); + Thread.dumpStack(); + return ret; } @Override public float getPosY(int glyphIndex) { diff -r 2ad159b40c2c modules/graphics/src/main/java/com/sun/prism/impl/BaseTexture.java --- a/modules/graphics/src/main/java/com/sun/prism/impl/BaseTexture.java Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/java/com/sun/prism/impl/BaseTexture.java Fri Nov 14 11:05:58 2014 -0500 @@ -124,31 +124,37 @@ @Override public final int getPhysicalWidth() { + System.err.printf("BaseTexture.getPhysicalWidth:%h %d\n", this, physicalWidth); return physicalWidth; } @Override public final int getPhysicalHeight() { + System.err.printf("BaseTexture.getPhysicalHeight:%h %d\n", this, physicalHeight); return physicalHeight; } @Override public final int getContentX() { + System.err.printf("BaseTexture.getContentX:%h %d\n", this, contentX); return contentX; } @Override public final int getContentY() { + System.err.printf("BaseTexture.getContentY:%h %d\n", this, contentY); return contentY; } @Override public final int getContentWidth() { + System.err.printf("BaseTexture.getContentWidth:%h %d\n", this, contentWidth); return contentWidth; } @Override public final int getContentHeight() { + System.err.printf("BaseTexture.getContentHeight:%h %d\n", this, contentHeight); return contentHeight; } diff -r 2ad159b40c2c modules/graphics/src/main/native-glass/mac/GlassApplication.m --- a/modules/graphics/src/main/native-glass/mac/GlassApplication.m Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/native-glass/mac/GlassApplication.m Fri Nov 14 11:05:58 2014 -0500 @@ -39,9 +39,10 @@ #import "RemoteLayerSupport.h" #import "ProcessInfo.h" +#import #import -//#define VERBOSE +#define VERBOSE #ifndef VERBOSE #define LOG(MSG, ...) #else @@ -591,7 +592,13 @@ [pool2 drain]; // enter runloop, this will not return until terminated - [NSApp run]; + // [[NSExceptionHandler defaultExceptionHandler] + // setExceptionHandlingMask: NSHandleUncaughtExceptionMask]; + @try { + [NSApp run]; + } @catch (NSException *e) { + LOG("GlassApplication runloop: caught exception"); + } // Abort listerning to global touch input events [GlassTouches terminate]; diff -r 2ad159b40c2c modules/graphics/src/main/native-glass/mac/GlassFrameBufferObject.m --- a/modules/graphics/src/main/native-glass/mac/GlassFrameBufferObject.m Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/native-glass/mac/GlassFrameBufferObject.m Fri Nov 14 11:05:58 2014 -0500 @@ -33,7 +33,7 @@ #define FORMAT GL_BGRA #define TYPE GL_UNSIGNED_INT_8_8_8_8_REV -//#define VERBOSE +#define VERBOSE #ifndef VERBOSE #define LOG(MSG, ...) #else @@ -308,6 +308,7 @@ - (void)blitFromFBO:(GlassFrameBufferObject*)other_fbo { + LOG(" GlassFrameBufferObject blitFromFBO"); self->_fboToRestore = 0; // default to screen glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, (GLint*)&self->_fboToRestore); [self _createFboIfNeededForWidth:other_fbo->_width andHeight:other_fbo->_height]; @@ -316,6 +317,7 @@ glBlitFramebuffer(0,0, other_fbo->_width, other_fbo->_height, 0,0, self->_width, self->_height, GL_COLOR_BUFFER_BIT, GL_LINEAR); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, self->_fboToRestore); + LOG(" glGetError(): %d", glGetError()); } diff -r 2ad159b40c2c modules/graphics/src/main/native-glass/mac/GlassFullscreenWindow.m --- a/modules/graphics/src/main/native-glass/mac/GlassFullscreenWindow.m Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/native-glass/mac/GlassFullscreenWindow.m Fri Nov 14 11:05:58 2014 -0500 @@ -24,11 +24,25 @@ */ #import "GlassFullscreenWindow.h" +#import "GlassMacros.h" + +#define VERBOSE +#ifndef VERBOSE +#define LOG(MSG, ...) +#else +#define LOG(MSG, ...) GLASS_LOG(MSG, ## __VA_ARGS__); +#endif @implementation GlassFullscreenWindow : NSWindow - (id)initWithContentRect:(NSRect)contentRect withHostView:(NSView *)hostView withView:(NSView *)view withScreen:(NSScreen *)screen withPoint:(NSPoint)p { + + LOG("GlassFullscreenWindow rect %f %f %f %f withPoint %f,%f", + contentRect.origin.x, contentRect.origin.y, + contentRect.size.width, contentRect.size.height, + p.x, p.y); + self = [super initWithContentRect:contentRect styleMask:(NSBorderlessWindowMask|NSResizableWindowMask) backing:NSBackingStoreBuffered defer:NO screen:screen]; if (self != nil) { diff -r 2ad159b40c2c modules/graphics/src/main/native-glass/mac/GlassLayer3D.m --- a/modules/graphics/src/main/native-glass/mac/GlassLayer3D.m Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/native-glass/mac/GlassLayer3D.m Fri Nov 14 11:05:58 2014 -0500 @@ -29,7 +29,7 @@ #import "RemoteLayerSupport.h" #import "GlassScreen.h" -//#define VERBOSE +#define VERBOSE #ifndef VERBOSE #define LOG(MSG, ...) #else @@ -129,11 +129,17 @@ } } -//- (void)setBounds:(CGRect)bounds -//{ -// LOG("GlassLayer3D setBounds:%s", [NSStringFromRect(NSRectFromCGRect(bounds)) UTF8String]); -// [super setBounds:bounds]; -//} +- (void)setBounds:(CGRect)bounds +{ + LOG("GlassLayer3D setBounds:%s", [NSStringFromRect(NSRectFromCGRect(bounds)) UTF8String]); + [super setBounds:bounds]; +} + +- (void)setPosition:(CGPoint)pos +{ + LOG("GlassLayer3D setPosition:%s", [NSStringFromPoint(NSPointFromCGPoint(pos)) UTF8String]); + [super setPosition:pos]; +} - (BOOL)canDrawInCGLContext:(CGLContextObj)glContext pixelFormat:(CGLPixelFormatObj)pixelFormat forLayerTime:(CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp { diff -r 2ad159b40c2c modules/graphics/src/main/native-glass/mac/GlassScreen.m --- a/modules/graphics/src/main/native-glass/mac/GlassScreen.m Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/native-glass/mac/GlassScreen.m Fri Nov 14 11:05:58 2014 -0500 @@ -30,7 +30,7 @@ #import "GlassScreen.h" #import "GlassTimer.h" -//#define VERBOSE +#define VERBOSE #ifndef VERBOSE #define LOG(MSG, ...) #else @@ -64,13 +64,21 @@ CGSize size = CGDisplayScreenSize(displayID); CGRect rect = CGDisplayBounds(displayID); const CGFloat MM_PER_INCH = 25.4f; // 1 inch == 25.4 mm + LOG("createJavaScreen: s.w %f s.h %f r.o.x %f r.o.y %f r.s.w %f r.s.h %f", + size.width, size.height, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); + // Avoid division by zero, default to 72 DPI if (size.width == 0) size.width = rect.size.width * MM_PER_INCH / 72.f; if (size.height == 0) size.height = rect.size.height * MM_PER_INCH / 72.f; + NSSize resolution = {rect.size.width / (size.width / MM_PER_INCH), rect.size.height / (size.height / MM_PER_INCH)}; - NSRect primaryFrame = [[[NSScreen screens] objectAtIndex:0] frame]; + LOG("createJavaScreen: scaleFactor %f", (jfloat)GetScreenScaleFactor(screen)); + LOG("createJavaScreen: res.w %f res.h %f pf.o.x %f pf.o.y %f pf.s.w %f pf.s.h %f", + resolution.width, resolution.height, + primaryFrame.origin.x, primaryFrame.origin.y, primaryFrame.size.width, primaryFrame.size.height); + if (floor(NSAppKitVersionNumber) > 1265) // NSAppKitVersionNumber10_9 { // On MacOS X 10.10 beta the objects returned by [NSScreen screens] are released @@ -82,7 +90,7 @@ // or removed, therefore the memory leaked should never grow too much. [screen retain]; } - + jscreen = (jobject)(*env)->NewObject(env, jScreenClass, screenInit, ptr_to_jlong(screen), @@ -104,6 +112,7 @@ (jfloat)GetScreenScaleFactor(screen)); GLASS_CHECK_EXCEPTION(env); + } return jscreen; @@ -120,6 +129,7 @@ jScreenClass = (*env)->NewGlobalRef(env, jcls); } + LOG("createJavaScreens: creating %d", [screens count]); jobjectArray screenArray = (*env)->NewObjectArray(env, [screens count], jScreenClass, @@ -136,7 +146,8 @@ void GlassScreenDidChangeScreenParameters(JNIEnv *env) { - if (jScreenNotifySettingsChanged == NULL) + LOG("GlassScreenDidChangeScreenParameters"); + if (jScreenNotifySettingsChanged == NULL) { jScreenNotifySettingsChanged = (*env)->GetStaticMethodID(env, jScreenClass, "notifySettingsChanged", "()V"); GLASS_CHECK_EXCEPTION(env); @@ -150,8 +161,9 @@ - (CGDirectDisplayID)enterFullscreenAndHideCursor:(BOOL)hide { + LOG("enterFullscreenAndHideCursor"); + CGDirectDisplayID displayID = 0; - CGDisplayCount displayCount = 0; CGDirectDisplayID activeDisplays[MAX_DISPLAY_COUNT]; CGDisplayErr err = CGGetActiveDisplayList(MAX_DISPLAY_COUNT, activeDisplays, &displayCount); @@ -201,6 +213,7 @@ - (void)exitFullscreen:(CGDirectDisplayID)displayID { + LOG("exitFullscreen"); if (displayID != 0) { if (displayID == kCGDirectMainDisplay) diff -r 2ad159b40c2c modules/graphics/src/main/native-glass/mac/GlassView.m --- a/modules/graphics/src/main/native-glass/mac/GlassView.m Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/native-glass/mac/GlassView.m Fri Nov 14 11:05:58 2014 -0500 @@ -35,7 +35,7 @@ #import "GlassView3D.h" #import "GlassHelper.h" -//#define VERBOSE +#define VERBOSE #ifndef VERBOSE #define LOG(MSG, ...) #else diff -r 2ad159b40c2c modules/graphics/src/main/native-glass/mac/GlassView2D.m --- a/modules/graphics/src/main/native-glass/mac/GlassView2D.m Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/native-glass/mac/GlassView2D.m Fri Nov 14 11:05:58 2014 -0500 @@ -32,7 +32,7 @@ #import "GlassMacros.h" #import "GlassView2D.h" -//#define VERBOSE +#define VERBOSE #ifndef VERBOSE #define LOG(MSG, ...) #else diff -r 2ad159b40c2c modules/graphics/src/main/native-glass/mac/GlassView3D.m --- a/modules/graphics/src/main/native-glass/mac/GlassView3D.m Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/native-glass/mac/GlassView3D.m Fri Nov 14 11:05:58 2014 -0500 @@ -34,7 +34,7 @@ #import "GlassLayer3D.h" #import "GlassApplication.h" -//#define VERBOSE +#define VERBOSE #ifndef VERBOSE #define LOG(MSG, ...) #else @@ -574,7 +574,7 @@ [[layer getPainterOffscreen] unbind]; [layer flush]; } - LOG("end:%d", flush); + LOG("end"); } - (void)drawRect:(NSRect)dirtyRect diff -r 2ad159b40c2c modules/graphics/src/main/native-glass/mac/GlassViewDelegate.m --- a/modules/graphics/src/main/native-glass/mac/GlassViewDelegate.m Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/native-glass/mac/GlassViewDelegate.m Fri Nov 14 11:05:58 2014 -0500 @@ -46,7 +46,7 @@ #import "GlassPasteboard.h" #import "GlassTouches.h" -//#define VERBOSE +#define VERBOSE #ifndef VERBOSE #define LOG(MSG, ...) #else @@ -1028,6 +1028,7 @@ - (void)sendJavaFullScreenEvent:(BOOL)entered withNativeWidget:(BOOL)isNative { + LOG("GlassViewDelegate sendJavaFullScreenEvent:%d withNativeWidget:%d", entered, isNative); if (isNative) { // Must be done before sending the event to Java since the event handler // may re-request the operation. @@ -1079,6 +1080,12 @@ frameInWindowScreenCoords.origin.x -= screen.frame.origin.x; frameInWindowScreenCoords.origin.y -= screen.frame.origin.y; + LOG("enterFullscreenWithAnimate: coords %f %f %f %f", + frameInWindowScreenCoords.origin.x, + frameInWindowScreenCoords.origin.y, + frameInWindowScreenCoords.size.width, + frameInWindowScreenCoords.size.height); + @try { // 0. Retain the view while it's in the FS mode diff -r 2ad159b40c2c modules/graphics/src/main/native-glass/mac/GlassWindow+Overrides.m --- a/modules/graphics/src/main/native-glass/mac/GlassWindow+Overrides.m Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/native-glass/mac/GlassWindow+Overrides.m Fri Nov 14 11:05:58 2014 -0500 @@ -41,6 +41,13 @@ #import // NSBeep(); +#define VERBOSE +#ifndef VERBOSE +#define LOG(MSG, ...) +#else +#define LOG(MSG, ...) GLASS_LOG(MSG, ## __VA_ARGS__); +#endif + @implementation GlassWindow (Overrides) - (void)dealloc @@ -142,13 +149,13 @@ - (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize { - //NSLog(@"windowWillResize"); + LOG("windowWillResize"); return proposedFrameSize; } - (void)windowDidResize:(NSNotification *)notification { - //NSLog(@"windowDidResize"); + LOG("windowDidResize"); NSRect frame = [self _flipFrame]; if ((int)self->lastReportedLocation.x != (int)frame.origin.x || @@ -183,27 +190,52 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification { - //NSLog(@"windowWillEnterFullScreen"); + LOG("windowWillEnterFullScreen"); } - (void)windowDidEnterFullScreen:(NSNotification *)notification { - //NSLog(@"windowDidEnterFullScreen"); + LOG("windowDidEnterFullScreen"); [(GlassViewDelegate*)[self->view delegate] sendJavaFullScreenEvent:YES withNativeWidget:YES]; [GlassApplication leaveFullScreenExitingLoopIfNeeded]; } - (void)windowWillExitFullScreen:(NSNotification *)notification { - //NSLog(@"windowWillExitFullScreen"); + LOG("windowWillExitFullScreen"); } + - (void)windowDidExitFullScreen:(NSNotification *)notification { - //NSLog(@"windowDidExitFullScreen"); + LOG("windowDidExitFullScreen"); [(GlassViewDelegate*)[self->view delegate] sendJavaFullScreenEvent:NO withNativeWidget:YES]; [GlassApplication leaveFullScreenExitingLoopIfNeeded]; } +- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize +{ + LOG("willUseFullScreenContentSize: width %f height %f", proposedSize.width, proposedSize.height); + return proposedSize; +} + +- (void)windowDidFailToExitFullScreen:(NSWindow *)window +{ + LOG("windowDidFailToExitFullScreen"); +} + +- (void)windowDidFailToEnterFullScreen:(NSWindow *)window +{ + LOG("windowDidFailToEnterFullScreen"); +} + +- (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet usingRect:(NSRect)rect +{ + LOG("willPositionSheet: x %f y %f width %f height %f", + rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); + + return rect; +} + - (BOOL)windowShouldClose:(NSNotification *)notification { if (self->isEnabled) diff -r 2ad159b40c2c modules/graphics/src/main/native-glass/mac/GlassWindow.m --- a/modules/graphics/src/main/native-glass/mac/GlassWindow.m Thu Nov 13 09:41:26 2014 -0800 +++ b/modules/graphics/src/main/native-glass/mac/GlassWindow.m Fri Nov 14 11:05:58 2014 -0500 @@ -42,7 +42,7 @@ #import "GlassLayer3D.h" #import "GlassHelper.h" -//#define VERBOSE +#define VERBOSE #ifndef VERBOSE #define LOG(MSG, ...) #else @@ -239,6 +239,7 @@ - (void)setFullscreenWindow:(NSWindow*)fsWindow { + LOG("setFullscreenWindow"); if (self->fullscreenWindow == fsWindow) { return; } @@ -264,6 +265,7 @@ GET_MAIN_JENV; (*env)->CallVoidMethod(env, self->jWindow, jWindowNotifyDelegatePtr, ptr_to_jlong(fsWindow)); GLASS_CHECK_EXCEPTION(env); + LOG("setFullscreenWindow - done"); } - (void)close @@ -386,6 +388,7 @@ - (void)setFullscreenWindow:(NSWindow*)fsWindow { + LOG("setFullscreenWindow"); if (self->parent != nil) { BOOL fullscreen = (fsWindow != nil); @@ -404,6 +407,7 @@ self->fullscreenWindow = fsWindow; } + LOG("setFullscreenWindow - done"); } - (void)sendEvent:(NSEvent *)theEvent