From 1dcb251ecb744a76e1630846bead27cfd3f54922 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 4 Dec 2024 18:21:06 +0100 Subject: [PATCH] FlatLaf window decorations: fixed sometimes broken window moving with SplitPane in window title area in "full window content" mode (issue #926) --- CHANGELOG.md | 2 ++ .../java/com/formdev/flatlaf/ui/FlatTitlePane.java | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2502c516a..238c82616 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ FlatLaf Change Log factor. (issue #904) - Linux: Fixed continuous cursor toggling between resize and standard cursor when resizing window. (issue #907) + - Fixed sometimes broken window moving with SplitPane in window title area in + "full window content" mode. (issue #926) - Popup: On Windows 10, fixed misplaced popup drop shadow. (issue #911; regression in 3.5) - Popup: Fixed NPE if `GraphicsConfiguration` is `null` on Windows. (issue #921) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java index 6a9d99830..21c2a800b 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java @@ -1109,8 +1109,18 @@ private boolean isTitleBarCaptionAt( Component c, int x, int y ) { // if component is not fully layouted, do not invoke function // because it is too dangerous that the function tries to layout the component, // which could cause a dead lock - if( !c.isValid() ) + if( !c.isValid() ) { + // revalidate if necessary so that it is valid when invoked again later + EventQueue.invokeLater( () -> { + Window w = SwingUtilities.windowForComponent( c ); + if( w != null ) + w.revalidate(); + else + c.revalidate(); + } ); + return false; // assume that this is not a caption because the component has mouse listeners + } if( caption instanceof Function ) { // check client property function value