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: Resolved
  • Resolution: Fixed
  • OS: linux_ubuntu
  • CPU: generic
  • Submitted: 2024-11-15
  • Updated: 2024-12-13
  • Resolved: 2024-12-05
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
jfx24 b20Fixed
Related Reports
Duplicate :  
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
Changeset: a431801c Branch: master Author: Thiago Milczarek Sayao <tsayao@openjdk.org> Date: 2024-12-05 14:27:03 +0000 URL: https://git.openjdk.org/jfx/commit/a431801c3d1d76f03c54f7f3451eac4fa8024e8b
05-12-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx/pull/1654 Date: 2024-11-30 14:56:44 +0000
30-11-2024

I will look into it. I noticed a bug when setting the view min width, but not min height. This might be related.
28-11-2024

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