JDK-8344372 : Setting width for TRANSPARENT Stage -> gtk_window_resize: assertion 'height > 0'
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: jfx21,jfx23,jfx24
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: linux_ubuntu
  • CPU: generic
  • Submitted: 2024-11-15
  • Updated: 2024-11-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
JavaFX 23, Java 22.0.1, Ubuntu 20.04.

A DESCRIPTION OF THE PROBLEM :
If someone tries to set width/height of the transparent Stage he will get error (width -> height error, height -> width error). So, it is not possible to do the simplest operation - to change window size. The problem appears in JavaFX 21. In JavaFX 20 everything works without errors.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
public class JavaFxTest10 extends Application {

    @Override
    public void start(Stage primaryStage) {

        var button = new Button("Test");
        button.setOnAction(e -> {
            System.out.println("Height:" + primaryStage.getHeight());
            primaryStage.setWidth(primaryStage.getWidth() - 10);
        });
        var vBox = new VBox(button);
        vBox.setStyle("-fx-background-color: yellow");
        var scene = new Scene(vBox, 400, 300);
        primaryStage.initStyle(StageStyle.TRANSPARENT);
        primaryStage.setScene(scene);
        primaryStage.show();

    }

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

ACTUAL -
Height:300.0
(java:65340): Gtk-CRITICAL **: 21:08:15.801: gtk_window_resize: assertion 'height > 0' failed



Comments
Possibly related to the fix for JDK-8260528. [~tsayao] Any thoughts on this?
25-11-2024

I can reproduce this on Ubuntu 22.04. I was running Wayland, but it doesn't appear to be dependent on that.
25-11-2024

I tested on Windows 11 x64 machine and Ubuntu 22. The issue is not reproducible on Windows but on Ubuntu. On Windows, the window width shrinks by 10 on every click on Test. The height remains the same. On, Ubuntu, error is thrown: Java version: 21.0.2+13-LTS-58 JFX version: 24-ea+9 Height:300.0 (java:5771): Gtk-CRITICAL **: 08:51:05.573: gtk_window_resize: assertion 'height > 0' failed The issue can be reproduced JFX 21 onwards
18-11-2024