Greetings, Am I really the only one getting this issue ? https://stackoverflow.com/questions/50168857/javafx-misreports-number-of-screen-devices
Thanks. Sebastien On Fri, Apr 27, 2018 at 3:33 PM, sebastien deries < sebastien.der...@gmail.com> wrote: > Greetings, > > I develop an application on linux on a Red Hat 6.8 x64 using java 8u162 > and an NVidia GPU (and its latest driver), with 2 full HD Screens. > > I got an issue retrieving the number of physical screens: > > - when the X server is in extended desktop mode (2 physical screens, > but a single logical one from 0 to 3840 pixels), Screen.getScreens() > returns 2 Screen (which is normal) > - When the X server is in separate desktop mode (2 physical screens > and 2 logical screens from 0 to 1920 pixels), Screen.getScreens() returns 1 > Screen ==> is this normal or a bug? > > I compared the JavaFX API to the AWT API: > > GraphicsEnvironment env = GraphicsEnvironment. > getLocalGraphicsEnvironment(); > GraphicsDevice[] gdev = env.getScreenDevices(); > > AWT returns 2 screen devices in both configuration mode. > > > I Also checked on java 9 and java 10 using a ubuntu x64 machine and got > the same issue with JavaFX. > > I tried debugging this and it seems that the issue is in libglass.so in > native code. > > What do you think about this ? > > Thank you for your help. > > Regards > > Sebastien > > > Here is the code that reproduces the issue: > > public class ScreenTest extends Application { > > private static final int SIZE = 1600; > private final AnchorPane root = new AnchorPane(); > > @Override > public void start(Stage primaryStage) throws Exception { > > root.backgroundProperty().set(new Background(new > BackgroundFill(Color.BEIGE, null, null))); > Scene scene = new Scene(root, SIZE, SIZE); > primaryStage.show(); > > Screen.getScreens().forEach(screen -> System.out.println("JAVAFX > :" + screen)); > GraphicsEnvironment env = GraphicsEnvironment. > getLocalGraphicsEnvironment(); > GraphicsDevice[] gdev = env.getScreenDevices(); > > for (GraphicsDevice d : gdev) { > System.out.println("AWT:" + d); > } > } > public static void main(String... strings) { > launch(strings); > } > } > > > > here is the X11 Xorg.conf: > > Section "ServerLayout" > Identifier "Layout0" > Screen 0 "Screen0" 0 0 > Screen 1 "Screen1" RightOf "Screen0" > InputDevice "Keyboard0" "CoreKeyboard" > InputDevice "Mouse0" "CorePointer" > Option "Xinerama" "0" > EndSection > > Section "Files" > EndSection > > Section "InputDevice" > > # generated from default > Identifier "Mouse0" > Driver "mouse" > Option "Protocol" "auto" > Option "Device" "/dev/psaux" > Option "Emulate3Buttons" "no" > Option "ZAxisMapping" "4 5" > EndSection > > Section "InputDevice" > > # generated from default > Identifier "Keyboard0" > Driver "kbd" > EndSection > > Section "Monitor" > Identifier "Monitor0" > VendorName "Unknown" > ModelName "CMN" > HorizSync 53.0 - 66.0 > VertRefresh 48.0 - 60.0 > Option "DPMS" > EndSection > > Section "Monitor" > Identifier "Monitor1" > VendorName "Unknown" > ModelName "DELL C7017T" > HorizSync 30.0 - 83.0 > VertRefresh 56.0 - 76.0 > EndSection > > Section "Device" > Identifier "Device0" > Driver "nvidia" > VendorName "NVIDIA Corporation" > BoardName "Quadro K3100M" > BusID "PCI:1:0:0" > Screen 0 > EndSection > > Section "Device" > Identifier "Device1" > Driver "nvidia" > VendorName "NVIDIA Corporation" > BoardName "Quadro K3100M" > BusID "PCI:1:0:0" > Screen 1 > EndSection > > > > >