emilk / egui

egui: an easy-to-use immediate mode GUI in Rust that runs on both web and native
https://www.egui.rs/
Apache License 2.0
22.53k stars 1.61k forks source link

bad window decorations without sudo #5354

Closed avitran0 closed 2 weeks ago

avitran0 commented 2 weeks ago

Describe the bug when starting any egui application on my system the window decorations are borked. when running the program with sudo, the decorations are fine.

To Reproduce Steps to reproduce the behavior:

  1. build egui_demo_project on fedora
  2. without sudo, decorations are broken
  3. with sudo, they are fine

Expected behavior window decorations should work without sudo

Screenshots without sudo: without_sudo with sudo: with_sudo

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context running default fedora install with gnome, wayland and a nvidia gpu. all other applications have working window decorations.

lucasmerlin commented 2 weeks ago

My guess would be that this is a winit issue, can you try running one of the winit examples to see if the same thing happens there?

avitran0 commented 2 weeks ago

just tried that, it indeed seems to be a winit issue. thank you.

lucasmerlin commented 2 weeks ago

@avitran0 did you find / open a winit issue? If so, please link it here, so others can easily find it if they have the same problem.

avitran0 commented 2 weeks ago

i opened one here. this seems to be wayland-specific, because the wayland server does not provide window decorations, the client has to do it themselves. winit draws the decorations itself with the sctk crate, and not with libdecor or gtk, which is why it does not look like other system decorations. when running with sudo, it runs under x11, whose server does provide decorations.

avitran0 commented 2 weeks ago

to force winit to run under x11, you can use std::env::remove_var("WAYLAND_DISPLAY"); before the egui/eframe initialization. this will also make options like hiding the maximize button work.

avitran0 commented 2 weeks ago

on winit versions before 0.29.2, you would have to use std::env::set_var("WINIT_UNIX_BACKEND", "x11");.