--- old/modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/WindowStage.java 2016-10-24 12:15:33.000000000 -0700 +++ new/modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/WindowStage.java 2016-10-24 12:15:33.000000000 -0700 @@ -364,13 +364,15 @@ } else { px = py = 0; } - int pw = (int) (w > 0 ? Math.ceil(w * pScaleX) : w); - int ph = (int) (h > 0 ? Math.ceil(h * pScaleY) : h); - int pcw = (int) (cw > 0 ? Math.ceil(cw * pScaleX) : cw); - int pch = (int) (ch > 0 ? Math.ceil(ch * pScaleY) : ch); - platformWindow.setBounds(px, py, xSet, ySet, - pw, ph, pcw, pch, - xGravity, yGravity); + if (xSet || ySet || w > 0 || h > 0 || cw > 0 || ch > 0) { + int pw = (int) (w > 0 ? Math.ceil(w * pScaleX) : w); + int ph = (int) (h > 0 ? Math.ceil(h * pScaleY) : h); + int pcw = (int) (cw > 0 ? Math.ceil(cw * pScaleX) : cw); + int pch = (int) (ch > 0 ? Math.ceil(ch * pScaleY) : ch); + platformWindow.setBounds(px, py, xSet, ySet, + pw, ph, pcw, pch, + xGravity, yGravity); + } } @Override --- old/modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacWindow.java 2016-10-24 12:15:33.000000000 -0700 +++ new/modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacWindow.java 2016-10-24 12:15:33.000000000 -0700 @@ -52,16 +52,6 @@ super(parent); } - @Override - protected void setScreen(Screen screen) { - // SceneState will be called to update with new scale values - // before we return from super.setScreen()... - super.setScreen(screen); - notifyScaleChanged(1.0f, 1.0f, - screen.getRecommendedOutputScaleX(), - screen.getRecommendedOutputScaleY()); - } - @Override native protected long _createWindow(long ownerPtr, long screenPtr, int mask); @Override native protected long _createChildWindow(long parent); @Override native protected boolean _close(long ptr); --- old/modules/javafx.graphics/src/main/native-glass/mac/GlassStatics.h 2016-10-24 12:15:34.000000000 -0700 +++ new/modules/javafx.graphics/src/main/native-glass/mac/GlassStatics.h 2016-10-24 12:15:34.000000000 -0700 @@ -51,6 +51,7 @@ extern jmethodID jWindowNotifyResize; extern jmethodID jWindowNotifyClose; extern jmethodID jWindowNotifyMoveToAnotherScreen; +extern jmethodID jWindowNotifyScaleChanged; extern jmethodID jWindowNotifyFocus; extern jmethodID jWindowNotifyFocusUngrab; extern jmethodID jWindowNotifyFocusDisabled; --- old/modules/javafx.graphics/src/main/native-glass/mac/GlassStatics.m 2016-10-24 12:15:35.000000000 -0700 +++ new/modules/javafx.graphics/src/main/native-glass/mac/GlassStatics.m 2016-10-24 12:15:34.000000000 -0700 @@ -53,6 +53,7 @@ jmethodID jWindowNotifyResize = NULL; jmethodID jWindowNotifyClose = NULL; jmethodID jWindowNotifyMoveToAnotherScreen = NULL; +jmethodID jWindowNotifyScaleChanged = NULL; jmethodID jWindowNotifyFocus = NULL; jmethodID jWindowNotifyFocusUngrab = NULL; jmethodID jWindowNotifyFocusDisabled = NULL; --- old/modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m 2016-10-24 12:15:35.000000000 -0700 +++ new/modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m 2016-10-24 12:15:35.000000000 -0700 @@ -636,6 +636,12 @@ if ((*env)->ExceptionCheck(env)) return; } + if (jWindowNotifyScaleChanged == NULL) + { + jWindowNotifyScaleChanged = (*env)->GetMethodID(env, jWindowClass, "notifyScaleChanged", "(FFFF)V"); + if ((*env)->ExceptionCheck(env)) return; + } + if (jWindowNotifyClose == NULL) { jWindowNotifyClose = (*env)->GetMethodID(env, jWindowClass, "notifyClose", "()V"); --- old/modules/javafx.graphics/src/main/native-glass/mac/GlassWindow+Java.m 2016-10-24 12:15:36.000000000 -0700 +++ new/modules/javafx.graphics/src/main/native-glass/mac/GlassWindow+Java.m 2016-10-24 12:15:36.000000000 -0700 @@ -69,6 +69,12 @@ } } +- (void)_sendJavaWindowNotifyScaleChanged:(CGFloat)newScale +{ + GET_MAIN_JENV; + (*env)->CallVoidMethod(env, jWindow, jWindowNotifyScaleChanged, 1.0f, 1.0f, newScale, newScale); +} + - (void)_sendJavaWindowMoveEventForFrame:(NSRect)frame { if (self->suppressWindowMoveEvent == NO) --- old/modules/javafx.graphics/src/main/native-glass/mac/GlassWindow+Overrides.m 2016-10-24 12:15:36.000000000 -0700 +++ new/modules/javafx.graphics/src/main/native-glass/mac/GlassWindow+Overrides.m 2016-10-24 12:15:36.000000000 -0700 @@ -137,7 +137,9 @@ // The spec for [NSWindow backingScaleFactor] only mentions 1.0 and 2.0 // whereas NSScreen's one is more generic. So use the latter. if ([self->nsWindow screen]) { - [self->view notifyScaleFactorChanged:GetScreenScaleFactor([self->nsWindow screen])]; + CGFloat scale = GetScreenScaleFactor([self->nsWindow screen]); + [self->view notifyScaleFactorChanged:scale]; + [self _sendJavaWindowNotifyScaleChanged:scale]; } // Screen.notifySettingsChanged() calls Window.setScreen(), and the latter