changeset 14053:f9abfe7b70d9

8134669: Empty screen insets in Gnome 3, OEL 7 in multiscreen mode Reviewed-by: alexsch
author ssadetsky
date Thu, 24 Mar 2016 20:28:53 +0300
parents 4ac42135594d
children a5d50dc3e9e0
files src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java
diffstat 1 files changed, 22 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Thu Mar 24 20:19:26 2016 +0300
+++ b/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