changeset 9490:e54da87e0135

8087565: Scaling problem on OSX Retina Reviewed-by: kcr
author flar
date Mon, 29 Aug 2016 16:39:29 -0700
parents 3c10f272abc7
children 919c7d071c2f
files modules/graphics/src/main/native-glass/mac/GlassWindow+Java.m modules/graphics/src/main/native-glass/mac/GlassWindow.m
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/native-glass/mac/GlassWindow+Java.m	Sun Aug 28 23:39:49 2016 +0530
+++ b/modules/graphics/src/main/native-glass/mac/GlassWindow+Java.m	Mon Aug 29 16:39:29 2016 -0700
@@ -293,7 +293,7 @@
     }
     // Make sure we synchronize scale factors which could have changed while
     // we were not visible without invoking the overrides we watch.
-    if ([self->nsWindow screen]) {
+    if ([self->nsWindow screen] && (self->view != nil)) {
         [self->view notifyScaleFactorChanged:GetScreenScaleFactor([self->nsWindow screen])];
     }
 }
--- a/modules/graphics/src/main/native-glass/mac/GlassWindow.m	Sun Aug 28 23:39:49 2016 +0530
+++ b/modules/graphics/src/main/native-glass/mac/GlassWindow.m	Mon Aug 29 16:39:29 2016 -0700
@@ -884,6 +884,14 @@
         //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);
 
+        // Make sure we synchronize scale factors to the new view as any
+        // dynamic updates might have happened when we had the old view
+        // and/or we may have been set visible before we had a view and
+        // missed the initial notification.
+        if ([window->nsWindow screen]) {
+            [window->view notifyScaleFactorChanged:GetScreenScaleFactor([window->nsWindow screen])];
+        }
+
         if (oldView && oldView != window->view) {
             [[oldView delegate] resetMouseTracking];
         }