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

ComposePanel visibility isn't taken into account #2656

Closed
BoD opened this issue Jan 21, 2023 · 4 comments · Fixed by JetBrains/skiko#677
Closed

ComposePanel visibility isn't taken into account #2656

BoD opened this issue Jan 21, 2023 · 4 comments · Fixed by JetBrains/skiko#677
Assignees
Labels
bug Something isn't working macos p:high High priority swing interop Swing interop issue

Comments

@BoD
Copy link

BoD commented Jan 21, 2023

When hiding a ComposePanel or one of its parents, the last frame of the contained Compose UI remains visible.

Here's a simple reproducer showing the issue:

fun main() = SwingUtilities.invokeLater {
  val parentJPanel = JPanel(BorderLayout())
  parentJPanel.add(
    BorderLayout.CENTER,
    ComposePanel().apply {
      setContent {
        Button(
          onClick = {
            parentJPanel.isVisible = false // <- this hides this JPanel, but the button stays visible on screen
          }
        ) {
          Text("Hello World")
        }
      }
    }
  )

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

Here we have a JFrame containing a JPanel containing a ComposePanel containing a compose Button. Clicking the Button hides the JPanel - but the Button's UI remains visible.

@igordmn
Copy link
Collaborator

igordmn commented Jan 26, 2023

Compose 1.2.2

Reproducible on macOS, on Windows it behaves correctly

@igordmn igordmn added bug Something isn't working macos swing interop Swing interop issue labels Jan 26, 2023
@LouisCAD
Copy link
Contributor

LouisCAD commented Feb 3, 2023

Do you know what is the root cause?

@igordmn
Copy link
Collaborator

igordmn commented Feb 3, 2023

No, unfortunately. It need to be investigated. Under suspicion - we wrongly dispose graphic resources in Skiko for macOS, so we see a ghost of the Compose application.

@robercoding
Copy link

robercoding commented Feb 25, 2023

Same issue, reproducible in 1.3.0 in macOS Monterrey 12.16.1 with M1 Pro.
Trying to follow the Settings tutorial/documention from Intellij plugin development.
https://plugins.jetbrains.com/docs/intellij/settings-tutorial.html

In this specific case, using Compose to build the UI
image
image

I did a quick check on Windows and it's working as expected as @igordmn mentioned above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macos p:high High priority swing interop Swing interop issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants