Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MatkovIvan committed Jan 18, 2024
1 parent 879d0c2 commit 87379de
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ class ComposePanel @ExperimentalComposeUiApi constructor(
}

override fun setBounds(x: Int, y: Int, width: Int, height: Int) {
_composeContainer?.setBounds(0, 0, width, height)
super.setBounds(x, y, width, height)
_composeContainer?.setBounds(0, 0, width, height)
}

override fun getPreferredSize(): Dimension? = if (isPreferredSizeSet) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ internal class ComposeWindowPanel(
}

override fun setBounds(x: Int, y: Int, width: Int, height: Int) {
composeContainer.setBounds(0, 0, width, height)
super.setBounds(x, y, width, height)
composeContainer.setBounds(0, 0, width, height)
}

override fun add(component: Component): Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ internal class ComposeContainer(
}

private fun onChangeWindowBounds() {
if (!container.isDisplayable) return

windowContext.setContainerSize(windowContainer.sizeInPx)
layers.fastForEach(DesktopComposeSceneLayer::onChangeWindowBounds)
}
Expand All @@ -183,6 +185,9 @@ internal class ComposeContainer(
fun addNotify() {
mediator.onComponentAttached()
setWindow(SwingUtilities.getWindowAncestor(container))

// Re-checking the actual size if it wasn't available during init.
onChangeWindowBounds()
}

fun removeNotify() {
Expand All @@ -207,7 +212,7 @@ internal class ComposeContainer(
}

this.window?.removeWindowFocusListener(this)
window?.addComponentListener(this)
window?.addWindowFocusListener(this)
this.window = window

onChangeWindowFocus()
Expand Down

0 comments on commit 87379de

Please sign in to comment.