canonical / mir

The Mir compositor
GNU General Public License v2.0
625 stars 100 forks source link

IntelliJ/CLion using X11 backend renders incorrectly on resize #3570

Open tarek-y-ismail opened 1 month ago

tarek-y-ismail commented 1 month ago

How to reproduce

  1. Open up IntelliJ/CLion
  2. Try resizing the window, you'll see two different behaviors: If you enlarge or shrink the window, you'll see the UI update, but the rendering will be still confined to the old boundaries

https://github.com/user-attachments/assets/fa0c5b7a-f12e-46a1-b132-f1745396ae22

AlanGriffiths commented 1 month ago

Hmm. I've not seen this, but I've been using the preview Wayland support for the past few weeks

AlanGriffiths commented 1 month ago

Hmm. I've not seen this, but I've been using the preview Wayland support for the past few weeks

I can confirm the above weirdness. I wonder if it is related to the clipping mentioned in https://github.com/canonical/mir/issues/3560#issuecomment-2306522977

tarek-y-ismail commented 1 month ago

Happens as far back as 2.13 (can't get earlier versions to build)

tarek-y-ismail commented 3 weeks ago

So I found the cause of the bug. If you watch the video, you'll see it happening with only vertical or horizontal resizing and not corner resizing (although that's broken as well).

The culprit was these few lines: https://github.com/canonical/mir/blob/b56aa20a219a29b6b23d3a8742e0507b7ee82622/src/server/frontend_xwayland/xwayland_surface.cpp#L1231-L1237

Which broke this conversion from shell::SurfaceSpecification to miral::WindowSpecification: https://github.com/canonical/mir/blob/b56aa20a219a29b6b23d3a8742e0507b7ee82622/src/miral/window_specification.cpp#L88-L89

The most apparent solution is to consume both the width and height if they're both equal to the current content size, otherwise, both pass even if one hasn't changed. Another solution would be to modify the logic of miral::WindowSpecification to allow width and height to be set separately, but that'll probably open up another can of worms that is probably better left closed

This also exhibits something similar to #3560 and corner resizing, where resizing stops immediately once the cursor leaves the application window. In #3560, this manifests by not being able to resize at all as the widgets are outside the visible window.