slint
slint copied to clipboard
Window resizing issue on wayland
See https://github.com/slint-ui/slint/issues/4069#issuecomment-1848684932
Original description:
After executing "cargo r", I'm unable to resize the window using the up, down, left, or right arrows. However, it works fine for resizing the window within the Slin extension in Visual Studio Code. ui_test.zip
After executing "cargo r", I'm unable to resize the window using the up, down, left, or right arrows. However, it works fine for resizing the window within the Slin extension in Visual Studio Code. ui_test.zip
I consider myself a novice in Slint, but I don't believe there are any significant issues with the code I have written. If it's possible and convenient for you, could you kindly provide any feedback or suggestions on potential areas for improvement? I would greatly appreciate it.
I do not see anything in your code trigger on key presses (maybe I missed something?).
The resize overall is limited by the width and height in the GridLayout
: That gives that element a fixed size. So the VerticalLayout
also becomes fixed as there is nothing in it that can actually scale. That makes the Window fixed.
For such a simple case as this: You can leave out both Layouts and all the sizes and it should work better with less code.
Wrt. the preview: You found an interesting bug there: The preview will always use the preferred size, and assumes it to be between the minimum and maximum size. That is not the case in your example (you explicitly set the preferred size). I'll open a bug report on that: We should at least warn or maybe even error out in this case. That's #4075 for your reference.
I am not clear what you mean by "resize the window using the up/down/left/right arrow keys". I do not see any code in the example that listens to key events, so I assume that those keys are handled by your GUI environment (which one is that by the way?).
Setup:
Ubuntu 23.10 without Qt installed (need to use App without it).
Steps to reproduce :
- clone slint
- in fullscreen Gnome Terminal cd into slint dir than run
cargo run --release --bin todo
- move mouse in and out todo App Window
What is wrong:
- Cursor not changing from Insert Bar once Cursor leaves window and reenters the Window
- Resizing border areas are not changing cursor to any of Resize Icons. But when left button is pressed in the right area then it's possible to resize and the Cursor changes to Resize Icon.
- When close button pressed and after PopupBox confirmed window is not closing.
After recreating todo as separate project :
- no matter what I do I can not set window position programmatically from fn main(), even when winit::Window used
- config.toml file:
[env]
SLINT_NO_QT=1
SLINT_STYLE="native"
SLINT_BACKEND = "winit-femtovg"
SLINT_FULLSCREEN = true
- Close button is working. After PopupBox confirmed App is closing.
- Cursor and resize problems still exist.
- When window gets focus it almost invisible. Probably could be fixed with Theme and some boilerplate code??
I can reproduce some of these on Ubuntu 23.10. AFAICS these are basically issues with wayland support, for which we use winit. It works when unsetting WAYLAND_DISPLAY
and connecting to xwayland instead.
- Cursor shape isn't changing when the cursor enters/leaves the window
- Resize handles are not (reliably) indicated when the mouse is at the window edges
For me the window closes though when confirming the popup.
unsetting
WAYLAND_DISPLAY
and connecting to xwayland
Could you show how can I unset WAYLAND_DISPLAY and connect to xwayland, please.
You can for example make it empty: export WAYLAND_DISPLAY=
Not sure if it is the same issue, but is also reproducing on Ubuntu 22.04, with cargo-ui project.
setting export WAYLAND_DISPLAY=
seams to solve the problem.
Regarding the test case from @lethargy123, it seems the window has a fixed layout, so that explain why it cannot be resized.
I've been trying with the weston compositor, and it seems that the minimum and maxium size are not working properly on wayland.
I can reproduce the same problem with the winit resizable
example from the winit repository. It is supposed to have a minimum size, but it doesn't work. Not sure if bug in weston or in winit.