JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
16.24k stars 1.18k forks source link

Cannot make undecorated window fullscreen #4573

Closed mgroth0 closed 1 month ago

mgroth0 commented 7 months ago

Describe the bug

An undecorated window refuses to go fullscreen.

Affected platforms

Versions

To Reproduce

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.WindowPlacement.Fullscreen
import androidx.compose.ui.window.WindowState
import androidx.compose.ui.window.application

fun main() {
    val state = WindowState()
    application {
        Window(
            onCloseRequest = ::exitApplication,
            state = state,
            undecorated = true
        ) {
            Box(Modifier.background(Color.DarkGray).fillMaxSize()) {
                Button(
                    onClick = {
                        state.placement = Fullscreen
                    }
                ) {
                    Text("Fullscreen")
                }
            }
        }
    }
}

Expected behavior For the window to go fullscreen

Actual behavior

The window looks like it attempts to go fullscreen, but it refuses to fill the whole screen size. It shows the content of the window surrounded by black space.

Screenshots

Screenshot 2024-04-04 at 10 17 43 AM

Additional context

Note that if the window is decorated, fullscreen works as expected

okushnikov commented 2 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.