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

`background: transparent` doesn't work in sway in fullscreen #6145

Open dustdfg opened 1 week ago

dustdfg commented 1 week ago

If I set background: transparent on a tiled window it works good but if I open it in a fullscreen mode, I get black background

OS: Debian testing. Sway (Wayland) 1.9 Lang: Rust

ogoffart commented 3 days ago

I wonder if this is not a sway bug rather than a Slint issue. My guess is that sway optimizes for fullscreen window and only render then one window. But I might be wrong and the bug may be in winit or in the renderer. What renderer are you using? Did you try if the problem exist with all the renderer? (skia, femtovg, software).

What is your use case? Maybe you can get the same result with a maximized window?

dustdfg commented 2 days ago
  1. I think you are right about sway optimization for rendering only one window but I am not sure about it
  2. I've tried to start learning slint several times but something happened each time and I didn't have time for learning so I am able to only to open "basic" window and play with crate features...
  3. I've tried all three renderers and it didn't work. I hope that just disabling default features and enabling only one specific was correct way to test all three renderers
  4. My use case is custom wlogout which should open on top of all the apps and ideally ignore current open workspace too
  5. As I googled I think I need something like wlr-layershell which as I assume isn't implemented in winit
dustdfg commented 2 days ago

It seems that maximized doesn't have any effect...

dustdfg commented 2 days ago

And just in case if you say about popup window for my use case. As I understand popup windows doesn't fit because they are bound to my original window. Thought I don't know slint and can't be sure if it should be bound to a main window or not... screen-1726682020

fn main() {
    let app = MainWindow::new().unwrap();
    app.window().set_maximized(true);
    app.run().unwrap();
}

slint::slint! {
    export component MainWindow inherits Window {
        background: transparent;
        no-frame: true;
        popup := PopupWindow {
            Rectangle { height:100%; width: 100%; background: yellow; }
            x: 0px; y: 0px; height: 500px; width: 100px;
        }
        TouchArea {
            height:100%; width: 100%;
            clicked => { popup.show(); }
        }
    }
}
dustdfg commented 2 days ago

And I also found two discussion which are about layer shell:

https://github.com/slint-ui/slint/discussions/3119 https://github.com/slint-ui/slint/discussions/1765