Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide the Metal layer when the SkiaLayer becomes hidden. #677

Merged
merged 2 commits into from
Mar 18, 2023

Conversation

m-sasha
Copy link
Contributor

@m-sasha m-sasha commented Mar 15, 2023

This should fix JetBrains/compose-multiplatform#2656

Tested manually on Mac OS X Ventura 13.2.1 with this Compose code:

fun main() = SwingUtilities.invokeLater {
    val parentJPanel = JPanel(BorderLayout())

    parentJPanel.add(
        BorderLayout.CENTER,
        ComposePanel().apply {
            setContent {
                Box(
                    modifier = Modifier.fillMaxSize(),
                    contentAlignment = Alignment.Center
                ){
                    Text(
                        "Hello World",
                        modifier = Modifier.clickable{
                            parentJPanel.isVisible = false // <- this hides this JPanel, but the button stays visible on screen
                        }
                    )
                }
            }
            setSize(500, 500)
        }
    )

    parentJPanel.isFocusable = true;

    JFrame().apply {
        setSize(800, 600)
        contentPane.add(parentJPanel)
        isVisible = true

        contentPane.addMouseListener(object: MouseAdapter(){
            override fun mouseClicked(e: MouseEvent?) {
                parentJPanel.isVisible = true
            }
        })
    }
}

@m-sasha m-sasha requested a review from igordmn March 15, 2023 14:34
@m-sasha m-sasha merged commit 20cd028 into master Mar 18, 2023
@m-sasha m-sasha deleted the hide-layer-on-macosx branch March 18, 2023 15:50
manu-unter pushed a commit to manu-unter/skiko that referenced this pull request Apr 6, 2023
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.

ComposePanel visibility isn't taken into account
2 participants