Wayland, Windows, MacOS: Popup Implementation#4543
Conversation
facdfde to
87f6327
Compare
Reason: Because a normal window can have a parent window as well, like a Dialog
Reason: otherwise the child surface is anchored to the center
Reason: otherwise the height of the client side decoration is not considered and therefore the location is shifted
Reason: There are multiple pointers to the smithay popup. Once in state.windows and one time in the popup object it self. Just dropping the popup object releases only one pointer but we have to notify the state to release also the other
…he position Reason: Much easier in the resize handle
Reason: we have to call resize to initialize the viewport to map to correct window size
|
I think the idea with those pop-ups were to have a separate type other than glue to window, because as you said, they are very restricted on some platforms and on some platform it's indeed just a so in top-level API I would have them, as a separate type with its own restrictions, and what not, I'm also not sure if those things can be owned by the user, really, I think popups should be more like something you create from e.g.
Exactly why I want to have them owned by Generally, I think the initial plan was to have some kind of @tronical would like to hear your opinion here since you're representing ui toolkit side 😅 I just want to account for other special surfaces Wayland people can create which has their own popup type that is certainly not different than standard popup. |
That's indeed an interesting constraint (reverse order required).
I see the discrepancy, but I also see that - wayland aside - popups have more in common with (disclaimer: I'm biased though as I'm Martin's colleague :) |
|
The problem with Wayland, is that if you randomly use it wrongly, it really likes killing applications with protocol errors, so my suggestion is mostly to try solve it on type system level, or at least make it less likely, so users won't have to debug Wayland when it breaks in their cross platform app. I also remember that popups can be discarded/removed on user behalf and winit window is kind of persistent now. |
|
For Wayland: shouldnt we also use the |
|
I think dialog protocol serves a different purpose, and also not widely available? |
Ah right, I didnt read the PR description carefully, my bad. Originally thought it was popup dialog.
All 3 most popular compositors right now, KWin, Mutter and Hyprland, implement it so I dont think it's a problem. |
This will be implemented in a second step. There I will use this protocol |
|
@kchibisov @kchibisov Thanks for the feedback. And the patches. I will go through it next days and integrate them.
I will have a look into it how to integrate the popup as child of another popup/window so the reverse order could be solved automatically. |
Reason: On wayland popups don't get automatically keyboard grab. So request on creation
71b5db5 to
5c8042b
Compare
Reason: Because wayland or the event loop could destroy the popup and therefore it is anymore available
|
In 90ebef0 I implemented the correct popup order destroyment. I had the problem that the Popup Item it self contained a window state and therefore it got not delegated to the compositor that the popup shall be deleted. This I fixed in ac4a329 by storing only a Weak pointer of the window state in the Popup struct ( |
I like that you also came to a conclusion I had for the window storage, as in basically user has some handle but the Window itself is only owned by winit. I'll think about it a bit since we want to plug it into the current design, but generally, I think that's how it should be, honestly, even though a lot of folks disagree with me on that matter... |
Reason: Otherwise it will not be dropped
Implement proper decorationless popups by specifying the type of the child window with
with_type()With this PR different kind of child windows can be created
The type can be specified during creation of the Window using the window_attributes and the
with_type()function. As default a normal Window is used. IfPopupis choosen a parent must be specified, otherwise the Popup creation fails with an Error returned by thenew()function.Related issues: #403 and #4256
changelogmodule if knowledge of this change could be valuable to usersPlatforms
Wayland:
Bildschirmaufzeichnung.vom.2026-06-04.13-18-16.mp4
This work is sponsored by the NLnet foundation