Dear Pascal:

I cannot see the flicker (macOS 15.1.1 M1, using the laptop retina monitor with 
scale=2 or the external monitor at scale=1), running the latest JFX master 
branch.
Actually, I don't see much change except for the button - the inner shadow of 
the window background looks unchanged.

Could it be something that was fixed?  Or due to x86 driver in your mac?  Or 
may be external monitor connection?

I can help with creating a JBS ticket once I can reproduce it.

Cheers,
-andy


From: openjfx-dev <openjfx-dev-r...@openjdk.org> on behalf of Pascal 
<pascal.gr...@gmail.com>
Date: Saturday, January 18, 2025 at 07:14
To: openjfx-dev@openjdk.org <openjfx-dev@openjdk.org>
Subject: MacOS: Title bar flickering when animation is playing
Hello all,

I have noticed a weird flickering behaviour on MacOS when playing
animations and having set an effect on the background (both needed to
be true during my experimentation).

It looks like JavaFX is drawing on the lower lines of the title bar
that are managed by the OS and during animation playing, JavaFX
"wins", overwriting the OS painting. Once the animation is finished,
the OS painting takes over again, resulting in a flicker effect
whenever an animation starts or stops.

Unfortunately, I cannot take a screenshot or screen recording, as the
flickering doesn't happen when screen recording is active. Somehow,
the painting process is different then.

I tested different resolutions and it looks to me that the flickering
happens independently of resolution and HiDPI setting.

It would be nice if someone could open a bug for this.

Below is the code to reproduce the behaviour (hover over the button to
see the flickering).


public class FlickerDemo extends Application {
    @Override
    public void start(Stage primaryStage) {
        Button button = new Button("Button");

        Transition transition = new Transition() {
            {
                setCycleDuration(Duration.millis(500));
            }

            @Override
            protected void interpolate(double frac) {
                button.setOpacity(Math.min(1, frac + 0.5));
            }
        };

        button.setOnMouseEntered(_ -> {
            transition.setRate(1.0);
            transition.play();
        });

        button.setOnMouseExited(_ -> {
            transition.setRate(-1.0);
            transition.play();
        });

        StackPane root = new StackPane(button);
        root.setBackground(new Background(new
BackgroundFill(Color.WHITE, null, null)));
        root.setEffect(new InnerShadow());

        Scene scene = new Scene(root, 800, 600);
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}


Thanks a lot!

Pascal

Reply via email to