diff --git a/CHANGELOG.md b/CHANGELOG.md index 25dee118b..a4eaf1cf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ FlatLaf Change Log ================== +## 3.6-SNAPSHOT + +#### Fixed bugs + +- FlatLaf window decorations on Windows: Fixed possible application freeze when + using custom component that overrides `Component.contains(int x, int y)` and + invokes `SwingUtilities.convertPoint()` (or similar) from the overridden + method. (issue #878) + + ## 3.5.1 #### Fixed bugs 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 181b7aeb3..df4652474 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 @@ -1079,7 +1079,7 @@ private boolean captionHitTest( Point pt ) { } private boolean isTitleBarCaptionAt( Component c, int x, int y ) { - if( !c.isDisplayable() || !c.isVisible() || !c.contains( x, y ) || c == mouseLayer ) + if( !c.isDisplayable() || !c.isVisible() || !contains( c, x, y ) || c == mouseLayer ) return true; // continue checking with next component if( c.isEnabled() && @@ -1131,6 +1131,16 @@ private boolean isTitleBarCaptionAt( Component c, int x, int y ) { return true; } + /** + * Same as {@link Component#contains(int, int)}, but not using that method + * because it may be overridden by custom components and invoke code that + * tries to request AWT tree lock on 'AWT-Windows' thread. + * This could freeze the application if AWT tree is already locked on 'AWT-EventQueue' thread. + */ + private boolean contains( Component c, int x, int y ) { + return x >= 0 && y >= 0 && x < c.getWidth() && y < c.getHeight(); + } + private int lastCaptionHitTestX; private int lastCaptionHitTestY; private long lastCaptionHitTestTime;