RFR: JDK-8222209: Repaint properly when JFXPanel moves to another screen

John Hendrikx jhendrikx at openjdk.org
Fri Jul 28 09:36:02 UTC 2023


Alternative fix for JFXPanel issues.

I added an extra line to **really** trigger the repainting in `EmbeddedScene`.  This was inspired by this code in `GlassWindowEventHandler` which reacts to `WindowEvent.RESCALE`.  It not only calls `entireSceneNeedsRepaint` but also `updateSceneState`.  Snippet:

            case WindowEvent.RESCALE: {
                float outScaleX = window.getOutputScaleX();
                float outScaleY = window.getOutputScaleY();
                stage.stageListener.changedScale(outScaleX, outScaleY);
                // We need to sync the new scales for painting
                QuantumToolkit.runWithRenderLock(() -> {
                    GlassScene scene = stage.getScene();
                    if (scene != null) {
                        scene.entireSceneNeedsRepaint();
                        scene.updateSceneState();
                    }
                    return null;
                });
                break;
            }

-------------

Commit messages:
 - Repaint properly when JFXPanel moves to another screen

Changes: https://git.openjdk.org/jfx/pull/1189/files
 Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1189&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8222209
  Stats: 20 lines in 2 files changed: 2 ins; 0 del; 18 mod
  Patch: https://git.openjdk.org/jfx/pull/1189.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1189/head:pull/1189

PR: https://git.openjdk.org/jfx/pull/1189


More information about the openjfx-dev mailing list