Skip to content

Commit 9fa9407

Browse files
committed
fix(overlay): skip the zero-size viewport destination at a fractional scale
A fractional-scale event can reach the overlay's layer surface before the compositor has configured its size. gpui-pre-linux then calls wp_viewport.set_destination(0, 0), a protocol error that ends the whole Wayland connection, so the Actions Ring never opens at any fractional scale, on every output (#1989). Patch gpui-pre-linux through a vendored copy so set_size_and_scale only sets the viewport destination once both dimensions are positive; the configure that assigns the real size calls back in and sets it then. Reporters confirmed this exact guard on KWin, Hyprland and wlroots. The patch is dropped once a gpui-pre release carries zed-industries/zed#61368. Refs #1989
1 parent fd31184 commit 9fa9407

5 files changed

Lines changed: 27 additions & 5 deletions

File tree

‎.config/typos.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ extend-exclude = [
1111
"!crates/openlogi-ui/locales/en.toml",
1212
"docs/README.*.md",
1313
".github/scripts/i18n/merge_crowdin_download.py",
14+
# Third-party crate kept byte-for-byte except for the patch it carries.
15+
"vendor/",
1416
]
1517

1618
[default]

‎Cargo.lock‎

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[workspace]
22
resolver = "3"
3+
# `vendor/` holds patched third-party crates (see `[patch.crates-io]`); they
4+
# are path dependencies, not members, so workspace lints never apply to them.
5+
exclude = ["vendor"]
36
members = [
47
"crates/openlogi",
58
"crates/openlogi-core",
@@ -117,6 +120,12 @@ swr-gpui = { package = "swr-gpui-pre", version = "0.1" }
117120
# release after 0.4.1 is on crates.io.
118121
[patch.crates-io]
119122
calloop-wayland-source = { git = "https://github.com/Smithay/calloop-wayland-source", rev = "cab67860c4e8fef8a92cb11f6f3a08dd3b05536a" }
123+
# gpui-pre-linux 0.3.10 with one guard in `set_size_and_scale`: it skips
124+
# `wp_viewport.set_destination(0, 0)`, a protocol error that a fractional
125+
# scale event sends to a layer surface the compositor has not sized yet, so
126+
# the Actions Ring never opened at a fractional scale (#1989). Drop this patch
127+
# once a gpui-pre release carries zed-industries/zed#61368.
128+
gpui-pre-linux = { path = "vendor/gpui-pre-linux" }
120129

121130
[workspace.lints.rust]
122131
# Denied workspace-wide, but `deny` (not `forbid`) so a crate that genuinely

‎packaging/linux/package.nix‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ let
6262
# xtask's packaged-bins test include_str!s this; omitting it fails
6363
# `cargo test --workspace` inside the Nix sandbox.
6464
(src + "/packaging/linux/nfpm.yaml")
65+
# Patched third-party crates the workspace `[patch.crates-io]` points at.
66+
(src + "/vendor")
6567
(src + "/xtask")
6668
];
6769
};

‎vendor/gpui-pre-linux/src/linux/wayland/window.rs‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,9 +1533,20 @@ impl WaylandWindowStatePtr {
15331533

15341534
{
15351535
let state = self.state.borrow();
1536-
if let Some(viewport) = &state.viewport {
1537-
viewport
1538-
.set_destination(f32::from(size.width) as i32, f32::from(size.height) as i32);
1536+
// OpenLogi patch (#1989): a layer surface whose size the
1537+
// compositor has not configured yet still has 0x0 bounds when a
1538+
// fractional-scale event arrives, and `set_destination(0, 0)` is
1539+
// a protocol error that kills the whole Wayland connection. Skip
1540+
// it until the compositor assigns a real size; the configure that
1541+
// follows calls back in here with it. Upstream:
1542+
// https://github.com/zed-industries/zed/pull/61368
1543+
let width = f32::from(size.width) as i32;
1544+
let height = f32::from(size.height) as i32;
1545+
if let Some(viewport) = &state.viewport
1546+
&& width > 0
1547+
&& height > 0
1548+
{
1549+
viewport.set_destination(width, height);
15391550
}
15401551
}
15411552
}

0 commit comments

Comments
 (0)