Skip to content

Commit

Permalink
Re-validate interop container after resizing component (#1155)
Browse files Browse the repository at this point in the history
## Proposed Changes

Additional fix for #1145 and #1147

- Re-validate interop container after resizing component
- Fix incorrect calls - `componentResized` -> `onChangeWindowSize` and
`componentMoved` -> `onChangeWindowPosition`

## Testing

Test: Resize a window on "InteropOrder" mpp page (reproduced on macOS)

## Issues Fixed

Fixes
#1145 (comment)
  • Loading branch information
MatkovIvan committed Mar 1, 2024
1 parent 3083693 commit 0ab03fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ internal class SwingInteropContainer(
index + nonInteropComponents
})

// Sometimes Swing displays the rest of interop views in incorrect order after removing,
// Sometimes Swing displays the rest of interop views in incorrect order after adding,
// so we need to force re-validate it.
container.validate()
container.repaint()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,15 @@ internal class ComposeContainer(
layers.fastForEach(DesktopComposeSceneLayer::close)
}

override fun componentResized(e: ComponentEvent?) = onChangeWindowPosition()
override fun componentMoved(e: ComponentEvent?) = onChangeWindowSize()
override fun componentResized(e: ComponentEvent?) {
onChangeWindowSize()

// Sometimes Swing displays interop views in incorrect order after resizing,
// so we need to force re-validate it.
container.validate()
container.repaint()
}
override fun componentMoved(e: ComponentEvent?) = onChangeWindowPosition()
override fun componentShown(e: ComponentEvent?) = Unit
override fun componentHidden(e: ComponentEvent?) = Unit

Expand Down

0 comments on commit 0ab03fc

Please sign in to comment.