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

Maximized window resizes when modal dialog opens in KDE/KWin desktop envrionment

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      X86_64
      Ubuntu 24.04 or OpenSuse Linux 15.5
      JDK 17.0.9 (to current)
      Runtime Info Java FX 21.0.1+101 (to current)

      A DESCRIPTION OF THE PROBLEM :
      The problem is well stated and demonstrated in the JDK Bug System: (JDK-8325549 - https://bugs.openjdk.org/browse/JDK-8325549). The purpose of this report is to identify the scope of the bug in addition to Ubuntu replication steps.
      Opening a modal window causes the maximized owner window to resize. Listeners on the height and width properties show the change events firing while the maximized property remains unchanged. The bug is unresolved as comments indicate that the bug team was unable to replicate the issue. It is true that the bug does not surface utilizing the default Ubuntu window manager (Gnome Shell) - however, it remains a problem with the widely used KDE/KWin window manager. Our company has over 150 desktop systems deployed with this configuration and this bug has halted our ability to upgrade JavaFX. Although our production desktop configuration is OpenSuse/KDE/KWin, the bug is also reproduced running a Ubuntu/KDE/KWin configuration. The bug was introduced between the 20.0.2 and 21.0.1 releases.

      REGRESSION : Last worked in version 17.0.11

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Steps To Reproduce:

      1) Ubuntu System:
           a) Install KDE
                ubuntu24.04# sudo apt install kde-full
                        + When prompted select "sddm" as the default window manager.
           b) Login with KDE Desktop.
      ---------------------------------------------------------------------------------------------------------------------
      * The following is attributed to author of (JDK-8325549)

           2. Create a class that extends Application
           3. Create a class that extends Dialog
           4. Create some GUI in both application and dialog classes
           5. Maximize the main application window
           6. Create a dialog, set initOwner(mainApplication.stage), set initModality(WINDOW_MODAL|APPLICATION_MODAL), run showAndWait()
           7. The main application window is resized while remaining in the maximized state

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      ---------------------------------------------------------------------------------------------------------------------
      * The following is attributed to author of (JDK-8325549)

      When the dialog is opened and when I run showAndWait() the maximized window should remain maximized without resizing.
      ACTUAL -
      ---------------------------------------------------------------------------------------------------------------------
      * The following is attributed to author of (JDK-8325549)

      The main application window is resized to the size of the non-maximized window state size, while remaining in the maximized state.

      ---------- BEGIN SOURCE ----------
      ---------------------------------------------------------------------------------------------------------------------
      * The following is attributed to author of (JDK-8325549)

      package test.application;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.*;
      import javafx.scene.input.KeyCombination;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.layout.HBox;
      import javafx.stage.Modality;
      import javafx.stage.Stage;

      public class Test extends Application {

          /*
           */
          public static void main(String[] args) {
              launch(args);
          }

          private static class TestDialog extends Dialog<ButtonType> {

              public TestDialog(Stage primaryStage) {
                  super();
                  initModality(Modality.WINDOW_MODAL);
                  initOwner(primaryStage);
                  setResizable(false);
                  DialogPane dialogPane = getDialogPane();
                  dialogPane.setContent(new HBox());
                  ButtonType okButton = new ButtonType("Ok", ButtonBar.ButtonData.OK_DONE);
                  ButtonType cancelButton = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
                  dialogPane.getButtonTypes().addAll(okButton, cancelButton);
                  showAndWait().ifPresent(response -> {
                      if (response.getButtonData() == ButtonType.OK.getButtonData()) {
                          /* Do something */
                      }
                  });
              }
          }

          @Override
          public void start(Stage primaryStage) throws Exception {
              BorderPane mainLayout = new BorderPane();
              MenuItem itemOpenDialog = new MenuItem("Open Dialog...");
              itemOpenDialog.setAccelerator(KeyCombination.keyCombination("Ctrl-D"));
              itemOpenDialog.setOnAction(event -> new TestDialog(primaryStage));
              MenuItem itemExit = new MenuItem("Exit");
              Menu menuFile = new Menu("File");
              menuFile.getItems().addAll(
                      itemOpenDialog,
                      new SeparatorMenuItem(),
                      itemExit
              );
              MenuBar menuBar = new MenuBar();
              menuBar.getMenus().addAll(menuFile);
              mainLayout.setTop(menuBar);
              Scene scene = new Scene(mainLayout, 1024, 768);
              primaryStage.setMinWidth(800);
              primaryStage.setMinHeight(600);
              primaryStage.setTitle("Test Application");
              primaryStage.setScene(scene);
              primaryStage.show();
              primaryStage.setMaximized(true);

              primaryStage.widthProperty().addListener((obs, oldVal, newVal) -> {
                  System.out.println("+ Width-Old [" + oldVal.toString() + "] | New [" + newVal.toString() + "]");
              });
              primaryStage.heightProperty().addListener((obs, oldVal, newVal) -> {
                  System.out.println("+ Height-Old [" + oldVal.toString() + "] | New [" + newVal.toString() + "]");
              });
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            kpk Karthik P K
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: