Skip to content

Conversation

@m-sasha
Copy link
Member

@m-sasha m-sasha commented Oct 15, 2025

The container is the common parent of the compose content (skia layer) and the interop views. This is needed to receive them even when they occur over an interop view.

Fixes https://youtrack.jetbrains.com/issue/CMP-1062/SwingPanel-breaks-vertical-scrolling

In WindowInputEventTest.receive buttons and modifiers I changed the check from exactly matching the keyboard modifiers to verifying that the expected modifiers are on. Because of a problem in AWT.

Testing

Tested manually and will add a unit tests.

fun main() = singleWindowApplication {
    val scrollState = rememberScrollState()
    Box(
        modifier = Modifier
            .fillMaxSize()
            .verticalScroll(scrollState)
    ) {
        Row(Modifier.fillMaxSize().height(2000.dp)) {
            SwingPanel(
                background = Color.Red,
                modifier = Modifier
                    .weight(1f)
                    .height(400.dp),
                factory = {
                    JPanel(BorderLayout()).also {
                        it.add(JLabel("Swing content"))
                    }
                },
            )
            Box(
                Modifier.weight(1f).height(400.dp).background(Color.Blue),
                contentAlignment = Alignment.Center
            ) {
                Text("Compose content")
            }
            VerticalScrollbar(
                modifier = Modifier.fillMaxHeight(),
                adapter = rememberScrollbarAdapter(scrollState)
            )
        }
    }
}

This should be tested by QA

Release Notes

Fixes - Desktop

  • Fix mouse wheel scrolling over SwingPanel

@m-sasha m-sasha force-pushed the m-sasha/fix-swing-panel-scrolling branch from 4c825c6 to b3246fd Compare October 22, 2025 10:20
@m-sasha m-sasha changed the base branch from jb-main to m-sasha/fix-flaky-tests October 22, 2025 10:42
@m-sasha m-sasha force-pushed the m-sasha/fix-swing-panel-scrolling branch from b3246fd to 278e327 Compare October 22, 2025 11:35
@MatkovIvan MatkovIvan force-pushed the m-sasha/fix-flaky-tests branch from d50c500 to ef7982d Compare October 22, 2025 11:50
@m-sasha m-sasha changed the base branch from m-sasha/fix-flaky-tests to jb-main October 22, 2025 11:57
…pose content and interop views) to receive them even when they occur over an interop view.
@m-sasha m-sasha force-pushed the m-sasha/fix-swing-panel-scrolling branch from 278e327 to 63456d7 Compare October 23, 2025 08:58
@m-sasha m-sasha changed the title [WIP] Register mouse wheel listeners on the container rather than the compose content Register mouse wheel listeners on the container rather than the compose content Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant