mori-atsushi/insetsx

Add support for Desktop

pushpalroy opened this issue · 8 comments

Please add support for insetsx Desktop platform.

I'm not familiar with desktop application, does desktop also have window insets?
Or is a stub that returns all zeros sufficient?

@mori-atsushi I think Desktop does not have window insets as such.
But we can have support in the library so that it can be used in KMP applications.

For now, this is what I'm using in desktopMain:

actual val WindowInsets.Companion.navigationBars: WindowInsets
    @Composable
    @NonRestartableComposable
    get() = WindowInsets(0, 0, 0, 0)

actual val WindowInsets.Companion.statusBars: WindowInsets
    @Composable
    @NonRestartableComposable
    get() = WindowInsets(0, 0, 0, 0)

actual val WindowInsets.Companion.systemBars: WindowInsets
    @Composable
    @NonRestartableComposable
    get() = WindowInsets(0, 0, 0, 0)

@ExperimentalSoftwareKeyboardApi
actual val WindowInsets.Companion.ime: WindowInsets
    @Composable
    @NonRestartableComposable
    get() = WindowInsets(0, 0, 0, 0)

@ExperimentalSoftwareKeyboardApi
actual val WindowInsets.Companion.safeDrawing: WindowInsets
    @Composable
    @NonRestartableComposable
    get() = WindowInsets(0, 0, 0, 0)

This is working fine for me.

Thank you for teaching me.
I'm currently working on another feature, so I'll work on this later.

Yes, zero stubs would be enough. We added the library to our Compose experiment: https://github.com/Kotlin/kmm-production-sample/tree/compose-app
and it works perfectly, but I'm waiting for desktop support as well.

Desktop support has been added in v0.1.0-alpha06.
Thank you all for your comments.
https://github.com/mori-atsushi/insetsx/releases/tag/v0.1.0-alpha06

Don't you plan to add web target as well? 😆

So, I would be able to add the library in https://terrakok.github.io/Compose-Multiplatform-Wizard/ 😉

Don't you plan to add web target as well? 😆

If you create the Issue, I'll consider it 👍