提交 f27f1b40 编写于 作者: A anashaty

8072069: Toolkit.getScreenInsets() doesn't update if insets change

Reviewed-by: serb, azvegint
上级 b71754ff
...@@ -43,7 +43,6 @@ public final class CGraphicsDevice extends GraphicsDevice ...@@ -43,7 +43,6 @@ public final class CGraphicsDevice extends GraphicsDevice
* therefore methods, which is using this id should be ready to it. * therefore methods, which is using this id should be ready to it.
*/ */
private volatile int displayID; private volatile int displayID;
private volatile Insets screenInsets;
private volatile double xResolution; private volatile double xResolution;
private volatile double yResolution; private volatile double yResolution;
private volatile int scale; private volatile int scale;
...@@ -120,7 +119,13 @@ public final class CGraphicsDevice extends GraphicsDevice ...@@ -120,7 +119,13 @@ public final class CGraphicsDevice extends GraphicsDevice
} }
public Insets getScreenInsets() { 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() { public int getScaleFactor() {
...@@ -135,7 +140,6 @@ public final class CGraphicsDevice extends GraphicsDevice ...@@ -135,7 +140,6 @@ public final class CGraphicsDevice extends GraphicsDevice
public void displayChanged() { public void displayChanged() {
xResolution = nativeGetXResolution(displayID); xResolution = nativeGetXResolution(displayID);
yResolution = nativeGetYResolution(displayID); yResolution = nativeGetYResolution(displayID);
screenInsets = nativeGetScreenInsets(displayID);
scale = (int) nativeGetScaleFactor(displayID); scale = (int) nativeGetScaleFactor(displayID);
//TODO configs/fullscreenWindow/modes? //TODO configs/fullscreenWindow/modes?
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册