JDK-7172665 : sun.awt.X11.XToolkit.getScreenInsetsManually() incorrect handle _NET_WM_STRUT
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2012-05-30
  • Updated: 2014-03-17
  • Resolved: 2014-03-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8-poolResolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_03"
OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu2)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Linux it319k6 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
  From

http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html

"
_NET_WM_STRUT_PARTIAL

...

Struts MUST be specified in root window coordinates, that is, they are not
relative to the edges of any view port or Xinerama monitor.

...

Assume that the set up uses two monitors, one running at 1280x1024 and the
other to the right running at 1024x768, with the top edge of the two physical
displays aligned. If the panel wants to fill the entire bottom edge of the
smaller display with a panel 50 pixels tall, it should set a bottom strut of
306, with bottom_start_x of 1280, and bottom_end_x of 2303.

...
"

Thus the getScreenInsetsManually() must take into account screenBounds and
rootBounds (see workaround)


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
http://hg.openjdk.java.net/build-infra/jdk8/jdk/file/a3851a6bd1a9/src/solaris/classes/sun/awt/X11/XToolkit.java
@@ -857,10 +857,10 @@
                     // managers don't set this hint correctly, so we just get intersection with windowBounds
                     if (windowBounds != null && windowBounds.intersects(screenBounds))
                     {
-                        insets.left = Math.max((int)Native.getLong(native_ptr, 0), insets.left);
-                        insets.right = Math.max((int)Native.getLong(native_ptr, 1), insets.right);
-                        insets.top = Math.max((int)Native.getLong(native_ptr, 2), insets.top);
-                        insets.bottom = Math.max((int)Native.getLong(native_ptr, 3), insets.bottom);
+                        insets.left = Math.max((int)Native.getLong(native_ptr, 0) - screenBounds.x, insets.left);
+                        insets.right = Math.max((int)Native.getLong(native_ptr, 1) - (rootBounds.width - (screenBounds.x + screenBounds.width)), insets.right);
+                        insets.top = Math.max((int)Native.getLong(native_ptr, 2) - screenBounds.y, insets.top);
+                        insets.bottom = Math.max((int)Native.getLong(native_ptr, 3) - (rootBounds.height - (screenBounds.y + screenBounds.height)), insets.bottom);
                     }
                 }
             }