# Objective Closes #52429 Closes #56735 Closes #62495 Closes #62878 Reverts #13071 This PR fixes Zed windows sometimes remaining blank when first opened on X11. The issue remained very inconsistent across WMs and conditions to reproduce and was finally consistently reproducable on my dwm build with no compositor and on i3 with no compositor after removing the workaround earlier added, which made it occur in i3 but not on my dwm build because it was more aggressive with it's EWMH policy. It happened only on opening a newer repo not opened the last time. While running foreground work, a synchronous X11 request can read events from the socket and place them in x11rb's internal event queue, calloop monitors the underlying socket rather than this internal queue, so if the socket is empty when the foreground work finishes, these events may remain unprocessed until unrelated X11 activity occurs. window is mapped -> events are buffered by x11rb -> X11 socket is no longer readable -> calloop does not wake -> MapNotify is not processed -> refresh loop does not start -> window remains blank This explains why the problem was inconsistent and differed between window managers. Later focus, scrolling (on any window), exposure, or other X11 activity could make the connection readable again and incidentally process the older events. My earlier PR #61162 fixed the related case where an already processed `Expose` event could wait indefinitely for a stopped refresh loop. It did not fix this initial-window case because the relevant events had not reached Zed's event handler yet, which was again not perfectly reproducable and lead me to assume was fixed. ## Solution Process any X11 events buffered by x11rb after each foreground runnable completes: foreground work completes -> buffered X11 events are processed -> MapNotify starts the refresh loop -> initial window contents are displayed This also removes the unconditional [`SetInputFocus`](https://tronche.com/gui/x/xlib/input/XSetInputFocus.html) added in #13071. That call frequently masked the issue by generating additional X11 activity, but also bypassed the window manager's focus policy despite Zed already sending the standard `_NET_ACTIVE_WINDOW` request. With the event queue handled correctly, Zed no longer needs to force focus to make the initial frame appear. ## Testing Repeatedly opened fresh and existing workspaces under dwm while another application retained focus with a new-project being opened everytime (at least not the previous one). Before this change, fresh windows could remain blank until later X11 activity occurred. After this change, they render immediately without focusing, scrolling, resizing, or switching workspaces. Also verified that window activation is left to the window manager through `_NET_ACTIVE_WINDOW`. ## Self-Review Checklist: * [x] I've reviewed my own diff for quality, security, and reliability * [x] Unsafe blocks (if any) have justifying comments * [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) * [ ] Tests cover the new/changed behavior * [x] Performance impact has been considered and is acceptable Release Notes: * Fixed Zed windows sometimes remaining blank when first opened on X11 * Fixed Zed overriding window-manager focus policies when activating windows |
||
|---|---|---|
| .agents/skills | ||
| .cargo | ||
| .cloudflare | ||
| .config | ||
| .factory | ||
| .github | ||
| .wezel | ||
| .zed | ||
| assets | ||
| ci | ||
| crates | ||
| docs | ||
| extensions | ||
| legal | ||
| nix | ||
| script | ||
| tooling | ||
| .git-blame-ignore-revs | ||
| .gitattributes | ||
| .gitignore | ||
| .mailmap | ||
| .prettierrc | ||
| .rules | ||
| AGENTS.md | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CLAUDE.md | ||
| clippy.toml | ||
| CODE_OF_CONDUCT.md | ||
| compose.yml | ||
| CONTRIBUTING.md | ||
| debug.plist | ||
| default.nix | ||
| Dockerfile-collab | ||
| Dockerfile-collab.dockerignore | ||
| Dockerfile-cross.dockerignore | ||
| Dockerfile-distros | ||
| Dockerfile-distros.dockerignore | ||
| flake.lock | ||
| flake.nix | ||
| GEMINI.md | ||
| LICENSE-APACHE | ||
| LICENSE-GPL | ||
| livekit.yaml | ||
| lychee.toml | ||
| Procfile | ||
| Procfile.web | ||
| README.md | ||
| renovate.json | ||
| REVIEWERS.conl | ||
| rust-toolchain.toml | ||
| rustfmt.toml | ||
| shell.nix | ||
| typos.toml | ||
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).
Other platforms are not yet available:
- Web (tracking discussion)
Developing Zed
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
Zed source code is licensed primarily under GPL-3.0-or-later, with Apache-2.0 components where marked.
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Sponsorship
Zed is developed by Zed Industries, Inc., a for-profit company.
If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.