Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window Content Misaligned From Decorations on X11 Linux #11236

Closed
1 task done
someone13574 opened this issue May 1, 2024 · 1 comment · Fixed by #12604
Closed
1 task done

Window Content Misaligned From Decorations on X11 Linux #11236

someone13574 opened this issue May 1, 2024 · 1 comment · Fixed by #12604
Labels
defect [core label] linux workspace Feedback for workspace management, layout, interactions, etc

Comments

@someone13574
Copy link
Contributor

someone13574 commented May 1, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

When on X11 Linux, the window contents will occasionally not be aligned with the window decorations. More specifically, the contents will be shifted up and to the left by some amount. Without changing anything between starts, this will occur seemingly randomly. There was at least one other user on the discord encountering this problem as well (they said it occurred at ~5-10% of the time, but can also reproduce using the method below).

Video of repeatedly restarting Zed until it occurs, with no changes between runs (though interestingly the window appears lower on the iteration before the bug):
randomly.webm

However, there seems to be a way to force trigger it, at least on my system (edit: and another user in the discord who is on gnome). This can be done by opening Zed, resizing the window, closing Zed, and opening it again. This will cause it to open in the misaligned state every time.
force-trigger.webm

Lastly, this state cannot be exited by normal resizing or dragging of the window, but snapping it to an edge using the mouse or keyboard will cause it to be re-aligned. Bringing it out of a snap will keep it properly aligned.
snap-reset.webm

Environment

Zed: v1.0.0 (Zed) (actually 0.132.4, not sure why this doesn't report correctly)
OS: Linux 1.0.0
Memory: 31.3 GiB
Architecture: x86_64

Extra Info:
Linux: Void Linux (kernel: 6.6.29)
NVIDIA GTX 1660 Super
Gnome X11 45.5 (Mutter 45.5)

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

@someone13574 someone13574 added admin read Pending admin review defect [core label] triage Maintainer needs to classify the issue labels May 1, 2024
@JosephTLyons JosephTLyons added workspace Feedback for workspace management, layout, interactions, etc linux and removed triage Maintainer needs to classify the issue admin read Pending admin review labels May 3, 2024
@mrnugget
Copy link
Member

mrnugget commented Jun 3, 2024

Thanks for providing the steps to reproduce! I've been running into this myself on GNOME/X11. Pretty sure there's a race condition in there somewhere.

image

mrnugget added a commit that referenced this issue Jun 3, 2024
This fixes #11236 by ignoring the `bounds.origin` values when the window
is only being resized.

The cause for the issue was that the `ConfigureNotify` event would
contain "wrong" values when the window was being resized (by dragging a
corner).

In my case it would *always* contain x:14/y:49, which is I
think maps to the origin of the top bar in GNOME.

We would then persist these wrong values when serializing the workspace.
On restart, we'd use these values and end up with the window decorations
in the wrong place.

What I still don't know:
1. What exactly the 14/49 map to, because it's not the origin of the top
   bar in GNOME. I also tried the X11 TranslateCoordinates call but
   couldn't get meaningful results back (even taking scale factor into
   account).
2. Why the window decorations end up looking wrong vs. the window being
   in the first place. But if you look at my screenshot in #11236, it
   looks like the decorations are off exactly by 14/49px.

That being said, I think the solution here is a good one for now: we
don't do an additional X11 call and when we're resizing, we're not
interested in the origin changing.
mrnugget added a commit that referenced this issue Jun 3, 2024
This fixes #11236 by ignoring the `bounds.origin` values when the window
is only being resized.

The cause for the issue was that the `ConfigureNotify` event would
contain "wrong" values when the window was being resized (by dragging a
corner).

In my case it would *always* contain x:14/y:49, which is I think might
map to the origin of the top bar in GNOME.

We would then persist these wrong values when serializing the workspace.
On restart, we'd use these values and end up with the window decorations
in the wrong place.

What I still don't know:
1. What exactly the 14/49 map to, because it's not the origin of the top
bar in GNOME. I also tried the X11 TranslateCoordinates call but
couldn't get meaningful results back (even taking scale factor into
account).
2. Why the window decorations end up looking wrong vs. the window being
in the first place. But if you look at my screenshot in #11236, it looks
like the decorations are off exactly by 14/49px.

That being said, I think the solution here is a good one for now: we
don't do an additional X11 call and when we're resizing, we're not
interested in the origin changing.



Release Notes:

- N/A

Proof:

[Screencast from 2024-06-03
15-08-36.webm](https://github.com/zed-industries/zed/assets/1185253/90efccfc-8ec6-42d2-8380-1625eff57805)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect [core label] linux workspace Feedback for workspace management, layout, interactions, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants