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

with_position method of ViewportBuilder does not seem to work on wayland #4469

Open
XDream8 opened this issue May 6, 2024 · 0 comments
Open
Labels
bug Something is broken

Comments

@XDream8
Copy link

XDream8 commented May 6, 2024

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 XDream8 added the bug Something is broken label May 6, 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