KDE `ViewportCommand::InnerSize` is undone via instantaneous `WindowEvent::Resized`
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
**Describe the bug**
When running egui under kde the window cannot be resized programmatically.
This is **not** fixed by https://github.com/emilk/egui/pull/4211 nor https://github.com/emilk/egui/pull/4182.
Here's a truncated annotated `WAYLAND_DEBUG` spew:
```
# The window buffer is created at size 875x597 (wl_buffer@87)
[1863912.251] -> zwp_linux_buffer_params_v1@85.create_immed(new id wl_buffer@87, 875, 597, 875713112, 0)
# Previous buffer is destroyed
[1863912.694] -> wl_buffer@61.destroy()
# New buffer (wl_buffer@87) is attached to window
[1863928.273] -> wl_surface@25.attach(wl_buffer@87, 0, 0)
# Client requests resize to 1280x720
[1871323.978] -> xdg_surface@26.set_window_geometry(0, 0, 1280, 720)
[1871323.983] -> wp_viewport@29.set_destination(1280, 720)
[2024-03-28T15:47:08Z INFO egui_winit] ViewportCommand::InnerSize, not will be delivered later with the [WindowEvent::Resized]
[1871324.007] -> xdg_toplevel@27.unset_fullscreen()
# New window buffer is created at size 1280x720 (wl_buffer@100)
[1871329.109] -> zwp_linux_buffer_params_v1@98.create_immed(new id wl_buffer@100, 1280, 720, 875713112, 0)
# Previous buffer is destroyed (wl_buffer@87)
[1871329.698] -> wl_buffer@87.destroy()
# Compositor requests the client resize to 875x597
[1871330.256] xdg_toplevel@27.configure(875, 597, array[4])
# Client resizes to 875x597
[1871330.318] -> xdg_surface@26.set_window_geometry(0, 0, 875, 597)
[1871330.323] -> wp_viewport@29.set_destination(875, 597)
# New window buffer is created at size 875x597 (wl_buffer@109)
[1871334.217] -> zwp_linux_buffer_params_v1@64.create_immed(new id wl_buffer@109, 875, 597, 875713112, 0)
# Previous buffer is destroyed (wl_buffer@100)
[1871334.574] -> wl_buffer@100.destroy()
# New buffer (wl_buffer@109) is attached to window
[1871338.805] -> wl_surface@25.attach(wl_buffer@109, 0, 0)
```
[Full `WAYLAND_DEBUG` log](https://github.com/emilk/egui/files/14792296/egui_noresize.txt)
I think the `xdg_toplevel@27.configure` is becoming a `WindowEvent::Resized` and undoing the resize.
I'm not certain but it could be that the `wl_buffer@87.destroy()` of the currently attached buffer is triggering a configure.
This happens on KDE but not weston or Gnome. The winit example client doesn't exhibit this behaviour.
**To Reproduce**
Steps to reproduce the behavior:
1. Run KDE
You can launch a nested KDE session via:
```bash
export $(dbus-launch)
kwin_wayland --xwayland --no-lockscreen
```
2. Run the egui demo:
If you're running nested:
```bash
WAYLAND_DEBUG=1 WAYLAND_DISPLAY=wayland-1 cargo run -p egui_demo_app [--features wgpu]
```
3. Resize the window using the "Resize to..." drop-down.
4. Note that the window doesn't change size
**Expected behavior**
Window should resize.
**Screenshots**
**Desktop (please complete the following information):**
- OS: Fedora 39 (plasma)
**Additional context**
This was brought to my attention by ruffle developers: https://github.com/ruffle-rs/ruffle/pull/15781
Contributor guide
Research direction
First reproduce the failure with the egui demo's “Resize to...” drop-down in a nested KDE session using the provided WAYLAND_DEBUG and cargo run commands. Then inspect egui_winit handling of ViewportCommand::InnerSize and the resulting WindowEvent::Resized; done means the requested window size remains applied on KDE instead of reverting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100