compose-multiplatform
compose-multiplatform copied to clipboard
Window size isn't preserved when we change the system density
Compose 1.0.0-beta5, Windows 11, OpenJDK 15
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.WindowState
import androidx.compose.ui.window.singleWindowApplication
fun main() = singleWindowApplication(
state = WindowState(width = 500.dp, height = 500.dp)
) {
}
Pure Swing reproducer:
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.swing.Swing
import java.awt.Dimension
import javax.swing.JFrame
@OptIn(DelicateCoroutinesApi::class)
fun main() {
val frame = JFrame()
frame.size = Dimension(500, 500)
frame.isVisible = true
GlobalScope.launch(Dispatchers.Swing) {
while(true) {
delay(1000)
println(frame.size)
}
}
}
https://user-images.githubusercontent.com/5963351/141112893-14513936-c6dd-4a36-b733-93e23984f4d2.mp4
If we just move the window between two displays with different densities - everything is fine.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.