egui icon indicating copy to clipboard operation
egui copied to clipboard

No window title when running egui-app on Wayland

Open anarsoul opened this issue 4 years ago • 5 comments

Describe the bug There's no window title in window header when egui app is running on Wayland

To Reproduce Steps to reproduce the behavior: cd egui cargo run --bin egui_demo_app

Window header is solid white.

Screenshot from 2021-12-23 21-48-55

Expected behavior

Window header contains window title that is returned by epi::App::name

Screenshots See above

Desktop (please complete the following information):

  • OS: archlinux
  • Version: rolling release

Additional context

I understand that it's a winit/client-toolkit bug, see https://github.com/Smithay/client-toolkit/issues/196

Basically neither winit nor client-toolkit want to mess with font rendering. Yet it affects egui. It would be nice to be able to render window decorations at egui level.

anarsoul avatar Dec 24 '21 05:12 anarsoul

AFAIK, the only cross-platform way to do this is creating the window without decorations and drawing client-side decorations, handling drag and double-click events in platform-specific ways, etc. And doing nothing on Android, iOS, and web platforms because they don't have window decorations anyway (at least the decorations cannot be controlled by winit). This is the method used by the Spotify and Discord clients, for example.

On the other hand, doing this client-side decorations thing only for Wayland might be an acceptable way to "plug the leak".

parasyte avatar Dec 30 '21 21:12 parasyte

A lot of egui users have been making their own decorations, so it is definitely possible (see for instance https://www.youtube.com/watch?v=NtUkr_z7l84). It would be very nice with an official eframe example for how to make your own window decoration.

Related to this: we need to fix https://github.com/emilk/egui/issues/943 and add support for minimizing the native window.

emilk avatar Dec 30 '21 22:12 emilk

There is an example of painting your own window frame in https://github.com/emilk/egui/tree/master/examples/custom_window_frame

emilk avatar Apr 16 '22 20:04 emilk

There is an example of painting your own window frame in https://github.com/emilk/egui/tree/master/examples/custom_window_frame

I tried the example on Wayland, and the close button doesn't work. Once I clicked the close button, other buttons stop working. But then after I drag the window for a bit, it seems other buttons ( which control the theme) fall back to normal. However, the close button still doesn't do it's job after dragging.

Krysme avatar Jul 19 '22 06:07 Krysme

@Krysme have you tried debugging it? Is close_response.clicked() ever true? Is frame.quit(); called?

emilk avatar Jul 22 '22 08:07 emilk

There is an example of painting your own window frame in https://github.com/emilk/egui/tree/master/examples/custom_window_frame

I tried the example on Wayland, and the close button doesn't work. Once I clicked the close button, other buttons stop working. But then after I drag the window for a bit, it seems other buttons ( which control the theme) fall back to normal. However, the close button still doesn't do it's job after dragging.

To do this for my own app I had to resize the title space. What seemed to be happening is the horizontal layout was overlapping the close button. See https://gitlab.com/asus-linux/asusctl/-/blob/main/rog-control-center/src/widgets/top_bar.rs#L50

flukejones avatar Aug 08 '22 03:08 flukejones

Closed by https://github.com/emilk/egui/pull/1914

emilk avatar Aug 15 '22 12:08 emilk