Kotlin Multiplatform Compose Windows 10 app moves out of proper location

232 views Asked by At

I have a Kotlin Multiplatform app using Jetpack Compose targeted for Windows Desktop. It's designed for use in a kiosk like environment on a small Windows touch screen computer. I am not sure if this problem is due to my Kotlin/Compose programming or my Windows 10 Home in tablet mode settings. But basically a user is able to pull down the program a bit if they swipe the Windows tablet down from the top left/top right and then it stays in a funny position - i.e. it's pulled down a bit and to the left/right - until I close and restart the app, at which point it goes back to the correct full-screen position. I can't drag it back up to the correct position.

My Kotlin code for the top level Window is:

fun main() = application {
   Window(
      onCloseRequest = { /*cleanup functions*/ },
      title = "App",
      state = rememberWindowState(placement = WindowPlacement.Maximized),
      alwaysOnTop = true,
      undecorated = true
   ) {
      // Rest of composables and functionality
   }
}

Any advice for keeping the app as full screen with the Windows 10 Home tablet mode would be appreciated.

1

There are 1 answers

0
Kachinga On

In the Window composable, try adding these two parameters (self explanatory).

(resizable=false, focusable=false)

One downside of disabling focus is that you can't switch back to the application window using ALT+Tab (if you'll ever need to).