changeset 11421:8b9c99ed1251

8072069: Toolkit.getScreenInsets() doesn't update if insets change Reviewed-by: serb, azvegint
author anashaty
date Tue, 17 Feb 2015 19:56:15 +0300
parents 7ac7956389c5
children e5945133da7c
files src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java	Mon Feb 16 20:01:17 2015 +0300
+++ b/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java	Tue Feb 17 19:56:15 2015 +0300
@@ -43,7 +43,6 @@
      * therefore methods, which is using this id should be ready to it.
      */
     private volatile int displayID;
-    private volatile Insets screenInsets;
     private volatile double xResolution;
     private volatile double yResolution;
     private volatile int scale;
@@ -120,7 +119,13 @@
     }
 
     public Insets getScreenInsets() {
-        return screenInsets;
+        // the insets are queried synchronously and are not cached
+        // since there are no Quartz or Cocoa means to receive notifications
+        // on insets changes (e.g. when the Dock is resized):
+        // the existing CGDisplayReconfigurationCallBack is not notified
+        // as well as the NSApplicationDidChangeScreenParametersNotification
+        // is fired on the Dock location changes only
+        return nativeGetScreenInsets(displayID);
     }
 
     public int getScaleFactor() {
@@ -135,7 +140,6 @@
     public void displayChanged() {
         xResolution = nativeGetXResolution(displayID);
         yResolution = nativeGetYResolution(displayID);
-        screenInsets = nativeGetScreenInsets(displayID);
         scale = (int) nativeGetScaleFactor(displayID);
         //TODO configs/fullscreenWindow/modes?
     }