Skip to content

Pop-up menus #403

Closed
Closed

Description

@Shookbelf

Hi, is there any way to create pop-ups like for right click menus with winit? Since right-click menus can also go across the borders of a window, I suppose they need to have their own window and surface.

It would be nice if functionality like this could be included.

Activity

  1. added
    S - enhancement
    on Feb 8, 2018
  2. paulirotta commented on Feb 10, 2018

    @paulirotta
    Contributor

    This is done as a higher level function of glutin or other UI lib that creates the windows and text on them.

    Unless an extension binds to the native UI. React Native without the HTML garbage. It would be a most excellent direction but not a small mandate/extension. As a consultant I see a lot of wasted money and lives porting the same app to many platforms just to get the native components.

  3. Shookbelf commented on Feb 10, 2018

    @Shookbelf
    Author

    I am not talking about the drawing of the menu content. My current understanding is that those are basically specialized windows. If I want to spawn a window like that it's currently not possible with winit, because it will behave like a regular window.
    Perhaps it would be enough to make it possible to hide windows from the task manager.

    Please correct me if my understanding is wrong.

  4. Osspial commented on Feb 21, 2018

    @Osspial
    Contributor

    Do you mean having some way to create windows that aren't placed on the taskbar?

  5. paulirotta commented on Feb 21, 2018

    @paulirotta
    Contributor

    I believe that is correct- small "windows" without edge decoration or appearing in the taskbar for things like menus. It is then up to a higher level lib (out of scope- you choose what to do) to populate these.

  6. Shookbelf commented on Feb 22, 2018

    @Shookbelf
    Author

    @paulirotta Unfortunately I don't know exactly how it is done on different platforms.
    This could be enough if the following features are supported:

    • The window should not show up in task bars or similar
    • It should not have borders
    • Focus should be handled correctly

    Most things can probably be handled by users of winit if the basics work.

    There might be more subtle behaviour on different platforms though.

    In xdg_shell there is a protocol xdg_popup for exactly this type of windows.

  7. Osspial commented on Feb 27, 2018

    @Osspial
    Contributor

    Borderless window handling is already supported. As far as the other two features go, implementing them on Windows seems to be pretty easy, and I've done so in these two branches: focus and taskbar.

    I don't know how it would be handled on other platforms, but I can't imagine it's too much of a challenge.

  8. francesca64 commented on Mar 29, 2018

    @francesca64
    Member

    This would be straightforward for me to implement on X11. I'm in favor of moving forward on this, provided it's viable to implement on macOS as well.

  9. Osspial commented on Apr 3, 2018

    @Osspial
    Contributor

    It looks like, on OSX, windows can be excluded from the dock with this flag, and focus can be handled with modal windows. I'd need to actually test those, but that should be fairly easy to do.

  10. added
    H - help wanted
    S - api
    C - needs discussion
    D - average
    P - low
    on May 6, 2018
  11. Osspial commented on May 11, 2018

    @Osspial
    Contributor

    Something worth noting is that Wayland doesn't let you specify where a window will be placed on-screen, which complicates right-click menu creation - it's expected that a menu would be created at the mouse pointer, but there's currently no way to ensure that happens on Wayland.

    @vberger Does Wayland provide any way to work around this?

  12. 21 remaining items

  13. LinusDikomey commented on May 11, 2024

    @LinusDikomey

    I would also be interested in this, what is the current status on this?

    I think a good first step would be to provide a platform-specific API on wayland to at least make it possible to position child windows/subsurfaces. I tried implementing a context menu (right-click menu) with winit's existing APIs and it roughly works on X11, Windows and MacOS with some visual inconsistencies with shadows, so that would also be something to look into in the future.

  14. jgcodes2020 commented on Jul 5, 2024

    @jgcodes2020
    Contributor

    I believe for Wayland, we're blocked by Smithay/client-toolkit#5; as @elinorbgr mentioned above.

  15. kchibisov commented on Jul 5, 2024

    @kchibisov
    Member

    We're not blocked on anything in client-toolkit, since we can implement everything ourselves and already do for a lot of parts. And I'm pretty sure it's all present in sctk nowadays and the issue just obsolete.

  16. tgy3300 commented on Apr 9, 2025

    @tgy3300

    https://github.com/slint-ui/slint/discussions/8062

    Is not the effect you want, but still a little problem, hope to solve together

  17. ruguysgoingtrickortreating commented on Jan 8, 2026

    @ruguysgoingtrickortreating

    what's that status on this? it doesn't feel all too difficult to implement, every desktop platform has a concept of "owned"/"transient" windows. all that's needed is making sure the child window always shows up above the parent, isn't on the taskbar, and optionally locks input to the parent, right?

  18. ruguysgoingtrickortreating commented on Jan 8, 2026

    @ruguysgoingtrickortreating

    feels related to #4256 no? in fact, maybe that solution would be better, as most popups that I can think of are transient windows themselves. (aka owned on win32)

  19. justDeeevin commented on Jan 11, 2026

    @justDeeevin

    I really want to make a push to get this finished, in no small part because I need it badly for my software.

    I think it would make sense to design the API around xdg_popup and keep less restrictive features platform-specific, since it's our only realistic option on Wayland and an already solid abstraction of what we need to do:

    • "transient"; not exactly a window—not shown in taskbar or elsewhere
    • subordinate to parent window
    • able to be positioned (albeit only window-relative)
    • customizable—arbitrary size, normal drawing surface

    This would mean a popup would be a separate entity to a Window (which we already seem to be leaning towards). It would also, however, very likely require the addition of some kind of TopLevel struct or trait for common behavior (I'm partial to a trait for this).

    I'm going to start a new branch, get an API in place, then open a draft PR for feedback.

  20. ruguysgoingtrickortreating commented on Jan 11, 2026

    @ruguysgoingtrickortreating

    is xdg_popup what we want? doesn't that one disappear when you click outside of it? for behavior that's not that, they have .set_parent(toplevel) on xdg_toplevels. unless popup behavior is what's wanted but i would really like windows that behave like Qt's "dialog", Windows' "owned" windows, and x11's "transient" windows.

  21. justDeeevin commented on Jan 11, 2026

    @justDeeevin

    i would really like windows that behave like Qt's "dialog", Windows' "owned" windows, and x11's "transient" windows.

    This does sound separate to what this issue has thus far been about, and more pertinent to #4256, though admittedly the distinction isn't very clear.

  22. ruguysgoingtrickortreating commented on Jan 12, 2026

    @ruguysgoingtrickortreating

    that's fair. i really hope that any who implement popups also make an effort to implement dialogs, they seem about equally very useful.

  23. dhardy commented on Jan 12, 2026

    @dhardy
    Contributor

    "Transient" / "owned" / dialog windows are slightly different; possibly the main difference is that menus windows are closed if they lose focus (though this should be implementable in client code). "Owned" windows are already supported but only on the Windows platform I think (at least, I was able to test that functionality under wine).

    FYI winit seems to have some maintenance issues with existing features, so I'm not sure if a new feature would get merged at the moment. (Personally I'd love to see v0.31 soon.)

  24. ogoffart commented on Sep 12, 2026

    @ogoffart
    Contributor

    This should now be fixed by #4543

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C - needs discussionD - averageDS - appkitDS - waylandDS - win32DS - x11H - help wantedP - lowS - apiS - enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions