-
Bug
-
Resolution: Fixed
-
P3
-
8, 9
-
b127
-
generic
-
linux
Please use the following simple test program to reproduce:
import java.awt.GraphicsEnvironment;
import java.awt.GraphicsDevice;
import java.awt.DisplayMode;
public class Test {
public static void main(String[] args) {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice devices[] = env.getScreenDevices();
for (int d = 0; d < devices.length; ++d) {
GraphicsDevice dev = devices[d];
System.out.println("Device: " + dev.toString());
DisplayMode modes[] = dev.getDisplayModes();
System.out.println("Resolutions:");
for (int m = 0; m < modes.length; ++m) {
System.out.println(modes[m].getHeight() + "x" + modes[m].getWidth());
}
}
}
}
Compile and run it on a system with two displays. Here is output when both display are switched on (note: only current resolutions are listed):
Device: X11GraphicsDevice[screen=0]
Resolutions:
966x1280
Device: X11GraphicsDevice[screen=1]
Resolutions:
920x1280
Here is a responding xrandr output:
Screen 0: minimum 64 x 64, current 2560 x 966, maximum 32000 x 32000
VBOX0 connected 1280x966+0+0 0mm x 0mm
1280x966 60.0*+
1280x960 60.0
1024x768 60.0
800x600 60.0
640x480 60.0
VBOX1 connected 1280x920+1280+0 0mm x 0mm
1280x920 60.0*+
1280x960 60.0
1024x768 60.0
800x600 60.0
640x480 60.0
Then try to switch one of the displays (e.g., System Settings->Displays etc.) off and run the test again. The test output looks like:
Device: X11GraphicsDevice[screen=0]
Resolutions:
966x1280
960x1280
768x1024
600x800
480x640
JDK used: 8 b101
OS version: Ubuntu 12.04; VirtualBox was used, but on my colleague's non-virtual machine (Ubuntu) the issue is reproducible too.
On Windows this test works as expected (two full resolution lists obtained).
import java.awt.GraphicsEnvironment;
import java.awt.GraphicsDevice;
import java.awt.DisplayMode;
public class Test {
public static void main(String[] args) {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice devices[] = env.getScreenDevices();
for (int d = 0; d < devices.length; ++d) {
GraphicsDevice dev = devices[d];
System.out.println("Device: " + dev.toString());
DisplayMode modes[] = dev.getDisplayModes();
System.out.println("Resolutions:");
for (int m = 0; m < modes.length; ++m) {
System.out.println(modes[m].getHeight() + "x" + modes[m].getWidth());
}
}
}
}
Compile and run it on a system with two displays. Here is output when both display are switched on (note: only current resolutions are listed):
Device: X11GraphicsDevice[screen=0]
Resolutions:
966x1280
Device: X11GraphicsDevice[screen=1]
Resolutions:
920x1280
Here is a responding xrandr output:
Screen 0: minimum 64 x 64, current 2560 x 966, maximum 32000 x 32000
VBOX0 connected 1280x966+0+0 0mm x 0mm
1280x966 60.0*+
1280x960 60.0
1024x768 60.0
800x600 60.0
640x480 60.0
VBOX1 connected 1280x920+1280+0 0mm x 0mm
1280x920 60.0*+
1280x960 60.0
1024x768 60.0
800x600 60.0
640x480 60.0
Then try to switch one of the displays (e.g., System Settings->Displays etc.) off and run the test again. The test output looks like:
Device: X11GraphicsDevice[screen=0]
Resolutions:
966x1280
960x1280
768x1024
600x800
480x640
JDK used: 8 b101
OS version: Ubuntu 12.04; VirtualBox was used, but on my colleague's non-virtual machine (Ubuntu) the issue is reproducible too.
On Windows this test works as expected (two full resolution lists obtained).
- relates to
-
JDK-8167486 Device.getDisplayMode() doesn't report refresh rate on Linux in case of dual screen
-
- Resolved
-
-
JDK-8159953 Make GraphicsDevice#getDisplayMode() to return correct mode for Xinerama multi-screen
-
- Closed
-
-
JDK-8179015 Single-screen failure of java/awt/GraphicsDevice/DisplayModes/CompareToXrandrTest.java
-
- Closed
-
-
JDK-7045370 Java Statically Determines Display Size on Linux platforms
-
- Resolved
-
-
JDK-8081371 [PIT] Test closed/java/awt/FullScreen/DisplayMode/CycleDMImage.java switches Linux to the single device mode
-
- Resolved
-