JDK-4737732 : Toolkit.getScreenInsets() doesn't work on Linux/GNOME
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0,5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2002-08-27
  • Updated: 2018-09-05
  • Resolved: 2011-05-18
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 7
7 b04Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
The following test prints the insets for all screens on the system.  On RedHat 7.2 running GNOME/sawfish, getScreenInsets() does not recognize the GNOME taskbar - the insets are always 0,0,0,0.  I tried 1.4, 1.4.1b19 and 1.4.2b01.

// Print insets for all screens
import java.awt.*;

public class ScreenInsets {
    public static void main(String[] args) {
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] gds = ge.getScreenDevices();
        for (int i = 0; i < gds.length; i++) {
            GraphicsConfiguration gc = gds[i].getDefaultConfiguration();
            System.out.println(gc + ", insets: " + Toolkit.getDefaultToolkit().getScreenInsets(gc));
        }
    }
}

Comments
EVALUATION Most of the modern window managers support _NET protocol (or some its subset). This protocol defines (among others) _NET_WM_STRUT and _NET_WM_STRUT_PARTIAL atoms that can be used for screen insets calulation. I have tested the fix with these atoms on KDE, GNOME, IceWM, XFCE and it seems to work. Also, if screen insets are assumed as the space that is not ocupied by maximized windows, MWM and DTWM window managers are also supported.
16-10-2006