egui icon indicating copy to clipboard operation
egui copied to clipboard

`with_position` method of ViewportBuilder does not seem to work on wayland

Open XDream8 opened this issue 1 year ago • 0 comments

eframe = "0.27.2"
egui_extras = "0.27.2"

Describe the bug

ViewportBuilder's with_position method does not seem to work on sway/wayland

Desktop (please complete the following information):

  • OS: Linux(Wayland, musl-libc)

Additional context

code:

(...)

// UI part
pub fn run_ui(
    config: &AppConfig,
    header: Option<String>,
    content: String,
) -> Result<(), eframe::Error> {
    let options = eframe::NativeOptions {
        viewport: egui::ViewportBuilder::default()
            .with_app_id(String::from("evilbee-notification"))
            .with_inner_size([
                config.width.unwrap_or(160.0),
                config.heigth.unwrap_or(120.0),
            ])
            .with_resizable(false)
            .with_taskbar(false)
            .with_decorations(true)
            .with_position([0.0, 0.0])
            .with_window_level(egui::WindowLevel::AlwaysOnTop),
        ..Default::default()
    };
    eframe::run_native(
        "EvilBee Notification",
        options,
        Box::new(|cc| {
            // This gives us image support:
            egui_extras::install_image_loaders(&cc.egui_ctx);

            Box::new(EvilBeeUI {
                header,
                content,
                timer: 0,
            })
        }),
    )
}

(...)

also when i try to access inner_rect and outer_rect information they return None

(...)

                if let Some(inner_rect) = ctx.input(|i| i.viewport().inner_rect) {
                    ui.label(format!(
                        "Inner Rect: Pos: {:?}, Size: {:?} (points)",
                        inner_rect.min,
                        inner_rect.size()
                    ));
                }
                if let Some(outer_rect) = ctx.input(|i| i.viewport().outer_rect) {
                    ui.label(format!(
                        "Outer Rect: Pos: {:?}, Size: {:?} (points)",
                        outer_rect.min,
                        outer_rect.size()
                    ));
                }

(...)

XDream8 avatar May 06 '24 15:05 XDream8