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

Package name "overlay" causes window to have a black background #5512

Open
Cerabbite opened this issue Dec 22, 2024 · 0 comments
Open

Package name "overlay" causes window to have a black background #5512

Cerabbite opened this issue Dec 22, 2024 · 0 comments
Labels
bug Something is broken

Comments

@Cerabbite
Copy link

Describe the bug

https://github.com/user-attachments/assets/bdb24ced-e0ea-4afa-9ec5-59061014604d
image

Changing the package name in Cargo.toml to overlay causes the window to have a black background.

To Reproduce
Steps to reproduce the behavior:

  1. Copy the code from below or create a transparent window using Eframe and Egui
// src/main.rs

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release

use eframe::egui;

fn main() -> eframe::Result {
    env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).

    let options = eframe::NativeOptions {
        viewport: egui::ViewportBuilder::default()
            .with_decorations(true) // Hide the OS-specific "chrome" around the window
            .with_transparent(true)
            .with_position(egui::pos2(100., 200.))
            .with_inner_size(egui::vec2(300., 400.))
            .with_always_on_top(),
        ..Default::default()
    };
    eframe::run_native(
        "My egui App",
        options,
        Box::new(|cc| {
            // This gives us image support:

            Ok(Box::<MyApp>::default())
        }),
    )
}

struct MyApp {
    name: String,
}

impl Default for MyApp {
    fn default() -> Self {
        Self {
            name: String::new(),
        }
    }
}

impl eframe::App for MyApp {
    fn clear_color(&self, _visuals: &egui::Visuals) -> [f32; 4] {
        egui::Rgba::TRANSPARENT.to_array() // Make sure we don't paint anything behind the rounded corners
    }

    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        let panel_frame = egui::Frame {
            fill: egui::Color32::from_rgba_premultiplied(10, 10, 0, 5),
            ..Default::default()
        };

        egui::CentralPanel::default()
            .frame(panel_frame)
            .show(ctx, |ui| ui.button("Click me"));
    }
}
# Cargo.toml
[package]
edition = "2021"
name = "test-project"
version = "0.1.0"

[dependencies]
eframe = "0.30.0"
env_logger = "0.11.6"

[patch.crates-io]
egui = {git = "https://github.com/emilk/egui", branch = "master"}
# if you're using eframe:
eframe = {git = "https://github.com/emilk/egui", branch = "master"}
  1. Run the code to make sure that the window is transparent
  2. Change Cargo.toml to this
# Cargo.toml
[package]
edition = "2021"
name = "overlay"
version = "0.1.0"

[dependencies]
eframe = "0.30.0"
env_logger = "0.11.6"

[patch.crates-io]
egui = {git = "https://github.com/emilk/egui", branch = "master"}
# if you're using eframe:
eframe = {git = "https://github.com/emilk/egui", branch = "master"}
  1. Run the project the window is now black

Expected behavior

The created window is (semi) transparent no matter the name of my package.

Screenshots

image

Desktop (please complete the following information):

  • OS: Windows 11 Pro
  • Version 23H2
@Cerabbite Cerabbite added the bug Something is broken label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant