Commit d5dc4fc5 authored by Igor Demin's avatar Igor Demin

Fix black screen in Compose after dialog closing

parent 73a6720d
...@@ -24,7 +24,18 @@ open class SkiaLayer( ...@@ -24,7 +24,18 @@ open class SkiaLayer(
init { init {
setOpaque(false) setOpaque(false)
layout = null layout = null
backedLayer = object : HardwareLayer() { } backedLayer = object : HardwareLayer() {
override fun paint(g: Graphics) {
// 1. JPanel.paint is not always called (in rare cases).
// For example if we call 'jframe.isResizable = false` on Ubuntu
//
// 2. HardwareLayer.paint is also not always called.
// For example, on macOs when we resize window or change DPI
//
// 3. to avoid double paint in one single frame, use needRedraw instead of redrawImmediately
redrawer?.needRedraw()
}
}
add(backedLayer) add(backedLayer)
@Suppress("LeakingThis") @Suppress("LeakingThis")
backedLayer.addHierarchyListener { backedLayer.addHierarchyListener {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment