Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DialogWindow add alwaysOnTop #4238

Closed
lizhongyue248 opened this issue Feb 6, 2024 · 0 comments · Fixed by JetBrains/compose-multiplatform-core#1120
Closed

DialogWindow add alwaysOnTop #4238

lizhongyue248 opened this issue Feb 6, 2024 · 0 comments · Fixed by JetBrains/compose-multiplatform-core#1120
Assignees
Labels
desktop enhancement New feature or request

Comments

@lizhongyue248
Copy link

lizhongyue248 commented Feb 6, 2024

In my application, I need to build a main window without icons on the taskbar, so I chose to use DialogWindow. But now he cannot stay at the top level and will be overwritten by other application windows. We hope to add an alwaysOnTop attribute to provide this feature. Just like Window, I can control it.

This feature is very practical for most utility applications and is not difficult to modify. Currently, my solution is to copy a copy of the DialogWindow source code and manually add this attribute. But I don't think this is a recommended solution.

@Composable
fun MyDialogWindow(
  // ......
  enabled: Boolean = true,
  focusable: Boolean = true,
  alwaysOnTop: Boolean = false,  // add this... 
  // ......
) {
  // ......
  val currentOnCloseRequest by rememberUpdatedState(onCloseRequest)
  val currentOnAlwaysOnTop by rememberUpdatedState(alwaysOnTop)  // add this

  // .....
  DialogWindow(
    // ......
      update = { dialog ->
        updater.update {
          set(currentTitle, dialog::setTitle)
          set(currentIcon, dialog::setIcon)
          set(currentUndecorated, dialog::setUndecoratedSafely)
          set(currentTransparent, dialog::isTransparent::set)
          set(currentResizable, dialog::setResizable)
          set(currentEnabled, dialog::setEnabled)
          set(currentFocusable, dialog::setFocusableWindowState)
          set(currentOnAlwaysOnTop, dialog::setAlwaysOnTop)  // add this
        }
       // ......
    }
    // ......
  )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants