Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop Window Tranparency Not Rendering Correctly #3821

Open
imgurbot12 opened this issue Mar 3, 2025 · 0 comments
Open

Desktop Window Tranparency Not Rendering Correctly #3821

imgurbot12 opened this issue Mar 3, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@imgurbot12
Copy link
Contributor

Problem

Dioxus fails to rerender properly when transparency is enabled in desktop mode, leaving the old material underneath the new frame.

Steps To Reproduce

use dioxus::prelude::*;

const STYLES: &'static str = r#"
    #body {
        display: flex;
    }
    p {
        font-size: 100px;
    }
"#;

const IPSUM: &'static str = r#"
    Lorem ipsum dolor sit amet, consectetur adipiscing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
    nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
    reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
    pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
    culpa qui officia deserunt mollit anim id est laborum.
"#;

const BACON: &'static str = r#"
    Bacon ipsum dolor amet jowl pig pork meatball pork belly.
    Beef ribs buffalo hamburger burgdoggen. Pig pancetta pastrami
    shoulder fatback bacon kevin ham hock doner sirloin prosciutto
    t-bone meatloaf. Sausage swine flank pork, spare ribs pork loin
    ribeye beef ribs hamburger. Tongue pork chuck, biltong spare ribs
    pig jerky salami frankfurter flank drumstick leberkas pork chop
    pastrami jowl. Buffalo cupim alcatra tongue prosciutto, pork chop
    short ribs pancetta meatloaf corned beef chicken flank sirloin
    spare ribs. Boudin meatball andouille tenderloin meatloaf.
"#;

fn gui() -> Element {
    let mut scene = use_signal(|| false);

    let content = if scene.with(|b| *b) { IPSUM } else { BACON };

    rsx! {
        style { "{STYLES}" }
        div {
            id: "body",
            onclick: move |_| {
                let value = scene.with(|b| *b);
                scene.set(!value);
            },
            p { "{content}" }
        }
    }
}

fn main() {
    let window = dioxus_desktop::WindowBuilder::default()
        .with_decorations(false)
        .with_transparent(true);
    let config = dioxus_desktop::Config::default().with_window(window);

    LaunchBuilder::desktop().with_cfg(config).launch(gui);
}

Screenshots

Image

Environment:

  • Dioxus version: 0.6.3
  • Rust version: rustc 1.85.0 (4d91de4e4 2025-02-17)
  • OS info: EndeavourOS (Hyprland v0.47.1)
  • App platform: Desktop

Questionnaire

I'm interested in fixing this myself but don't know where to start.

@imgurbot12 imgurbot12 added the bug Something isn't working label Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant