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

Menu for DecoratedWindow #729

Open
MFlisar opened this issue Dec 13, 2024 · 4 comments
Open

Menu for DecoratedWindow #729

MFlisar opened this issue Dec 13, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@MFlisar
Copy link

MFlisar commented Dec 13, 2024

The decorated window does not support the default menu - IntelliJ does have something as replacement as you can see in the following screenshots.

Is something like this also possible with this library? I think not... Please let me know if it is possible or consider this as a feature request.

Menu

Clicking the menu icon with the 3 lines opens the menu inside the decorated title bar.

grafik

grafik

@rock3r
Copy link
Collaborator

rock3r commented Dec 13, 2024

You can put whatever you want in the window decoration, including buttons that have a text label and when clicked open a PopupMenu. We're not planning to implement this further for now, but contributions are welcome as usual

@MFlisar
Copy link
Author

MFlisar commented Dec 13, 2024

That's what I'm doing right now, it does not look like in IntelliJ, but that would be ok.

But there is a problem with this solution - it behaves a little buggy... PopupMenu does not open immediately if it is placed inside the TitleBar - I always must move the mouse after clicking and only afterwards the popup opens.

Code looks like following:

TitleBar(Modifier.newFullscreenControls()) {
    Row(
        modifier = Modifier.align(Alignment.Start),
        verticalAlignment = Alignment.CenterVertically
    ) {
        Dropdown(
            modifier = Modifier.height(30.dp),
            menuContent = {
                selectableItem(
                    selected = false,
                    onClick = { }
                ) {
                    Text("Sub Menu")
                }
            }
        ) {
            Text("Test Menu")
        }
    }
}

Edit: simplified example

@rock3r
Copy link
Collaborator

rock3r commented Dec 13, 2024

This should work — if mouse events are lost, this might be somewhat related to #368, but right now we don't have bandwidth to look into decorated window as we're focusing on other priorities. The primary maintainer of decorated windows is @devkanro but he's been unresponsive for months... We might have to deprecate the whole API if he doesn't come back to help because he's the only one familiar with it.

@rock3r rock3r added the bug Something isn't working label Dec 13, 2024
@MFlisar
Copy link
Author

MFlisar commented Dec 13, 2024

FYI, yes, this seems to be the issue... When disabling the modifier here (

internal fun Modifier.customTitleBarMouseEventHandler(titleBar: CustomTitleBar): Modifier =
) everything works (at least regarding the dropdown menu)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants