Skip to content

KDE ViewportCommand::InnerSize is undone via instantaneous WindowEvent::Resized #4259

@ColinKinloch

Description

@ColinKinloch

Describe the bug

When running egui under kde the window cannot be resized programmatically.

This is not fixed by #4211 nor #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

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:
export $(dbus-launch)
kwin_wayland --xwayland --no-lockscreen
  1. Run the egui demo:
    If you're running nested:
WAYLAND_DEBUG=1 WAYLAND_DISPLAY=wayland-1 cargo run -p egui_demo_app [--features wgpu]
  1. Resize the window using the "Resize to..." drop-down.
  2. 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: ruffle-rs/ruffle#15781

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is brokennative-linuxProblem specific to Linux

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions