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

Hide top-level dialog from the taskbar #177

Merged
merged 2 commits into from Feb 2, 2022

Conversation

igordmn
Copy link
Collaborator

@igordmn igordmn commented Feb 2, 2022

Swing has a special constructor for that (without arguments). It says:

A shared, hidden frame will be set as the owner of the dialog.

We need exactly this as a default behaviour for top-level Dialog's. This will hide the icon in the taskbar. If the user need to show icon in the taskbar, Window is a better option.

If SwingUtilities.getSharedOwnerFrame() was public, I would just use it as a default value in the constructor, but instead we have to create a separate constructor and keep it consistent with JDialog, even if it is unusual API.

The reproducer:

import androidx.compose.ui.awt.ComposeDialog
import javax.swing.SwingUtilities

fun main() = SwingUtilities.invokeLater {
    val dialog = ComposeDialog()
    dialog.setSize(800, 600)
    dialog.isVisible = true
}

The icon shouldn't be in the taskbar now.

Old behavior:
image

New behavior:
image

Swing has a special constructor for that (without arguments). It says:
```
A shared, hidden frame will be set as the owner of the dialog.
```

We need exactly this as a default behaviour for top-level Dialog's. This will hide the icon in the taskbar. If the user need to show icon in the taskbar, Window is a better option.

If `SwingUtilities.getSharedOwnerFrame()` was public, I would just use it as a default value in the constructor, but instead we have to create a separate constructor and keep it consistent with JDialog, even if it is unusual API.

The reproducer:
```
import androidx.compose.ui.awt.ComposeDialog
import javax.swing.SwingUtilities

fun main() = SwingUtilities.invokeLater {
    val dialog = ComposeDialog()
    dialog.setSize(800, 600)
    dialog.isVisible = true
}
```

The icon shouldn't be in the taskbar now.
@igordmn
Copy link
Collaborator Author

igordmn commented Feb 2, 2022

@igordmn igordmn merged commit 03f42d1 into release/1.1 Feb 2, 2022
@igordmn igordmn deleted the feature/fix_dialog_taskbar_icon branch February 2, 2022 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants