The getMinY() method of Screen.getPrimary().getVisualBounds() is returning different value when the JavaFX application is changed to fullscreen mode in MacOS.
It should return same value whether the JavaFX application in fullscreen mode or not.
Use the following source code to reproduce the issue.
Steps to reproduce the issue:
1. Run the source code.
2. Make the application full screen once the application is displayed.
3. Check the getVisualBounds() output on console. It can be observed that Min Y value is less when application is made full screen.
The issue is observed in MacOS Ventura 13.3.
-------------------Begin source code-------------------
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.geometry.Rectangle2D;
public class FullScreenTestSample extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
Scene scene = new Scene(new Group(), 500, 500);
System.out.println(Screen.getPrimary().getVisualBounds());
primaryStage.setX(bounds.getMinX());
primaryStage.setY(bounds.getMinY());
primaryStage.setWidth(bounds.getWidth());
primaryStage.setHeight(bounds.getHeight());
primaryStage.setScene(scene);
primaryStage.fullScreenProperty().addListener((ob, oldValue, newValue) -> {
System.out.println(Screen.getPrimary().getVisualBounds());
});
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
-------------------End source code-------------------
It should return same value whether the JavaFX application in fullscreen mode or not.
Use the following source code to reproduce the issue.
Steps to reproduce the issue:
1. Run the source code.
2. Make the application full screen once the application is displayed.
3. Check the getVisualBounds() output on console. It can be observed that Min Y value is less when application is made full screen.
The issue is observed in MacOS Ventura 13.3.
-------------------Begin source code-------------------
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.geometry.Rectangle2D;
public class FullScreenTestSample extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
Scene scene = new Scene(new Group(), 500, 500);
System.out.println(Screen.getPrimary().getVisualBounds());
primaryStage.setX(bounds.getMinX());
primaryStage.setY(bounds.getMinY());
primaryStage.setWidth(bounds.getWidth());
primaryStage.setHeight(bounds.getHeight());
primaryStage.setScene(scene);
primaryStage.fullScreenProperty().addListener((ob, oldValue, newValue) -> {
System.out.println(Screen.getPrimary().getVisualBounds());
});
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
-------------------End source code-------------------