JDK-5100801 : Toolkit.getScreenSize() does not return the correct dimension on multimon, linux
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: linux_redhat_9.0
  • CPU: x86
  • Submitted: 2004-09-12
  • Updated: 2017-05-19
  • Resolved: 2007-02-15
Related Reports
Relates :  
Relates :  
Toolkit.getScreenSize() claims that it returns the screen size of the primary monitor on multi-monitor systems. But this is not working as specified on a multi-mon setup in linux with a virtual screen setup using Xinerama. This method return the size of the virtual screen instead of the primary monitor.

This is not reproducible on win32 with a similar virtual screen setup. This is reproducible on all releases (regressed it till 1.4).

I have attached a sample test. Execute the sample test on linux with xinerama. If you see the size of the virtual screen being returned, the bug is reproduced.

EVALUATION While in Xinerama mode there is a single large display covering all the physical screens. Calling to Toolkit.getScreenSize() leads to simple quering X for the size of this large display. So I think this is not a bug. Nevertheless, we probably should correct JavaDoc for Toolkit.getScreenSize(): in the multi-screen system the size of the default screen (not the primary) is returned. For the Xinerama mode default screen is the whole large screen spread on all physical displays. If one do need to deal with physical screens while Xinerama mode on GraphicsEnvironment, GraphicsDevice and GraphicsConfiguration should be used. ###@###.### 2004-09-15

WORK AROUND Use GraphicsEnvironment/GraphicsDevice/GraphicsConfiguration to query for available displays, screen dimensions and display modes instead of Toolkit.getScreenSize() method. ###@###.### 2004-09-15