Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8248435

[linux] Stages owned by a parent stage cannot become full screen when parent is

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: openjfx11
    • Fix Version/s: tbd
    • Component/s: javafx
    • Environment:

      Linux Ubuntu 20.04, standard install

      Description

      When creating two Stages, where one stage is owned by the other, setting the parent stage to full screen should allow you to resize the child stage to the same dimensions as its parent (ie, also full screen).

      This works correctly under Windows. Under Ubuntu 20.04 with Mate as window manager however the same code will not allow you to resize the child stage to take up the full size of the parent, and will instead be resized so the task bar areas are excluded (even though they won't be visible as the parent stage is full screen).

      When using such a child stage as a transparent overlay, the overlay therefore covers only part of the parent stage despite attempts to resize it to be the same size as its parent.

      Sample code shows 2 stages, a black primary stage overlayed with a transparent red child stage. The child stage *should* cover the whole primary stage, but doesn't:

          public class FullScreenBug extends Application {
          
            public static void main(String[] args) {
              Application.launch(FullScreenBug.class);
            }
          
            @Override
            public void start(Stage primaryStage) throws Exception {
              Button root = new Button("Press to exit");
          
              root.setOnAction(e -> System.exit(0));
          
              StackPane stackPane = new StackPane(root);
          
              stackPane.setStyle("-fx-background-color: rgba(255, 0, 0, 0.3)");
          
              Stage childStage = new Stage(StageStyle.TRANSPARENT);
              Scene childScene = new Scene(stackPane);
          
              childScene.setFill(Color.TRANSPARENT);
          
              childStage.initModality(Modality.APPLICATION_MODAL);
              childStage.initOwner(primaryStage);
              childStage.setScene(childScene);
          
              Label label = new Label("Hello world! Hello world! Hello world!");
          
              label.setStyle("-fx-background-color: transparent; -fx-font-size: 50");
          
              primaryStage.setScene(new Scene(label, Color.BLACK));
              primaryStage.setFullScreen(true);
              primaryStage.show();
          
              setupStageLocation(childStage, Screen.getPrimary());
          
              childStage.show();
            }
          
            private static void setupStageLocation(Stage stage, Screen screen) {
              Rectangle2D bounds = screen.getBounds();
          
              stage.setX(bounds.getMinX());
              stage.setY(bounds.getMinY());
              stage.setWidth(bounds.getWidth());
              stage.setHeight(bounds.getHeight());
            }
          }

        Attachments

          Activity

            People

            • Assignee:
              pbansal Pankaj Bansal
              Reporter:
              jhendrikx John Hendrikx
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: