slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.93k stars 565 forks source link

PopupWindow Improvements #1143

Open ogoffart opened 2 years ago

ogoffart commented 2 years ago

There are some issues with the current PopupWindow

PopupWindow was just build for the need of the ComboBox and cannot really do much more. We should probably consider having friendlier widgets such as Allowing Dialog, Window, ... as child that can be shown Maybe having MessageBox or such.

peterjc123 commented 1 year ago

@ogoffart Any update on this? As a desktop application, popups are often used to show info or fatal error messages. Without that, we can only use status bar, which leads to poor user experience. Issue 1 and 4 really need to be resolved for the popup windows to work. It seems that we have the Dialogs. https://slint-ui.com/releases/1.0.0/docs/slint/src/builtins/elements.html#dialog Examples to use Dialogs: https://github.com/slint-ui/slint/blob/master/examples/todo/rust/main.rs#L54-L67 https://github.com/slint-ui/slint/blob/master/examples/todo/ui/todo.slint#L23-L43

peterjc123 commented 1 year ago

@ogoffart It seems that a Dialog still needs to wrapped in a PopupWindow, so that those issues still exist.

almindor commented 1 year ago

NOTE: I'll make a separate issue once I isolate the problem but currently losing focus (app level) with PopupWindow being up when using Wayland/Sway session causes the popup window to close with a state loss if a state is associated (e.g. awaiting user decision). AFAIK there's no way to assign "this popup has closed for any reason" in a generic way to the popup window to count the user action (e.g. cancellation).

I haven't tested yet if the app-level focus loss does this on other session types, but in Sway it's very bothersome because all it takes is mouse movement. The popup window can also "outgrow" the parent main window so moving the mouse towards any buttons inside it can easily lead to focus loss on i3 like WMs.