8134669: Empty screen insets in Gnome 3, OEL 7 in multiscreen mode
Reviewed-by: alexsch
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java Thu Mar 24 20:19:26 2016 +0300
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java Thu Mar 24 20:28:53 2016 +0300
@@ -770,17 +770,20 @@
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (!x11ge.runningXinerama())
{
- Rectangle workArea = XToolkit.getWorkArea(root, scale);
- if (workArea != null)
- {
- return new Insets(workArea.y,
- workArea.x,
- rootBounds.height - workArea.height - workArea.y,
- rootBounds.width - workArea.width - workArea.x);
- }
+ Insets screenInsets = getInsets(root, rootBounds, scale);
+ if (screenInsets != null) return screenInsets;
}
- return getScreenInsetsManually(root, rootBounds, gc.getBounds(), scale);
+ Insets insets = getScreenInsetsManually(root, rootBounds,
+ gc.getBounds(), scale);
+ if ((insets.left | insets.top | insets.bottom | insets.right) == 0
+ && rootBounds != null ) {
+ root = XlibWrapper.RootWindow(XToolkit.getDisplay(),
+ x11gd.getScreen());
+ Insets screenInsets = getInsets(root, rootBounds, scale);
+ if (screenInsets != null) return screenInsets;
+ }
+ return insets;
}
finally
{
@@ -788,6 +791,16 @@
}
}
+ private Insets getInsets(long root, Rectangle rootBounds, int scale) {
+ Rectangle workArea = XToolkit.getWorkArea(root, scale);
+ if (workArea == null) {
+ return null;
+ }
+ return new Insets(workArea.y, workArea.x,
+ rootBounds.height - workArea.height - workArea.y,
+ rootBounds.width - workArea.width - workArea.x);
+ }
+
/*
* Manual calculation of screen insets: get all the windows with
* _NET_WM_STRUT/_NET_WM_STRUT_PARTIAL hints and add these