JDK-8340868 : Unmaximizing the window does not restore prior window position and size
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: jfx21
  • Priority: P4
  • Status: Resolved
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 2024-09-23
  • Updated: 2024-09-25
  • Resolved: 2024-09-25
Description
ADDITIONAL SYSTEM INFORMATION :
OS: Red Hat Enterprise Linux Workstation 7.9 (Maipo)
Java: 21.0.3 and latest Java 24 Build 14 (2024/9/6), haven't tested others

Previous known working JavaFX version: 17.0.9
Not an issue on Windows.

A DESCRIPTION OF THE PROBLEM :
When a stage on RHEL is maximized and then unmaximized, it should restore the same window position and size like it does on Windows. It is currently keeping the maximized window position and size.

REGRESSION : Last worked in version 17

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the HelloFX sample
2. Move the app to any location other than the top left corner of the screen
3. Resize the app so that it does not fill the entire screen
4. Press the "Maximize" button
5. Press the "Unmaximize" button

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The window returns to its position and size set in steps 2 and 3.
ACTUAL -
The window position is set to the top left corner and the size fills the entire screen. It may for a fraction of a second restore the correct position and size, but it quickly switches to match the maximized position and size.

---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class HelloFX extends Application {

    @Override
    public void start(Stage stage) {
        String javaVersion = System.getProperty("java.version");
        String javafxVersion = System.getProperty("javafx.version");
        Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
        Scene scene = new Scene(new StackPane(l), 640, 480);
        stage.setScene(scene);
        stage.show();
    }

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

}
---------- END SOURCE ----------

FREQUENCY : always


Comments
I tested on Windows 11 x64 machine. But could not reproduce it. The window returns to its position and size after resizing, maximizing and restoring it.
25-09-2024