mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-24 06:37:43 +00:00
fix(wayland): preserve unmatched streams and validate display offset cache (#17073)
* fix(wayland): preserve unmatched streams and validate display offset cache - Keep unmatched streams in `sort_streams` instead of dropping them when no monitor sits at `(0, 0)` (e.g. vertically offset multi-monitor layouts). - Reject stale `wayland-pipewire-display-offset` entries whose offsets do not match any current display origin, skip caching unresolved `(0, 0)` defaults, and fall back to rotated/logical display dimensions in `try_fill_positions`. - Replace global `HAS_POSITION_ATTR` with per-stream `has_position` and per-session `positions_filled` tracking. - Do not latch `PIPEWIRE_INITIALIZED` when `init_displays` yields no displays. Fixes https://github.com/rustdesk/rustdesk/issues/17027 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(wayland): restrict fallback display matching to unique outputs - Keep `try_fill_positions` exact physical-mode matching for multi-match cursor disambiguation, and apply rotated/logical-size fallback only when a single display matches uniquely (leaving ambiguous cases unchanged and uncached). - Inline the unmatched-stream preservation directly into `sort_streams` without the generic `sort_by_display_order` wrapper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(wayland): cache only resolved display offsets and drop the size fallback - Remove `unique_fallback_origin`: a unique rotated output is already placed by `reconciled_origin`, and matching a stream size against `logical_size` could bind a region or virtual stream to a scaled output and cache it. - Report from `fill_multi_matched_positions` whether every stream was told apart, and do not cache the offsets when it was not (no embedded cursor mode, or a probe failed). - Require each cached offset to name a display of its own, so a cache holding two streams on one output is rejected; mirrored outputs still pass. - Import `serde_json` in the test module: on Linux scrap only gets it through `hbb_common`. - Leave `init_displays` as on master: once `sort_streams` keeps unmatched streams the display list is no longer emptied, so the empty-list check cannot fire, and the initialization-state change is a separate matter. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkkfvhEPKVg85ZHovfs * chore(wayland): drop edits unrelated to the fix - Remove the comment left over from HAS_POSITION_ATTR. - Restore Vec::new() in sort_streams. - Drop the empty-token check in validate_display_offset_cache: the cache is never written without a token, and the token comparison already rejects an empty current token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkkfvhEPKVg85ZHovfs * fix(wayland): narrow the #17027 fix to sort_streams Revert the offset-cache, position-flag and disambiguation changes from the earlier commits; only sort_streams changes now. - sort_streams keeps a stream whose position names no display (the KDE full-workspace stream at (0, 0) in #17027) and, as on master, still drops a stream at an origin another stream already took. Keeping that one too let a same-size stream left at another display's origin send pointer input to that display. - With the stream kept, the stale [[0, 0]] offset cache and the global HAS_POSITION_ATTR no longer break #17027: a cached (0, 0) gives the position recomputing would. Both stay as on master. - The offset cache test goes with the validation it covered. sort_streams takes PipeWireCapturable, which holds a D-Bus connection and a fd, so it has no unit test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkkfvhEPKVg85ZHovfs --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 file changed
+13
@@ -1798,6 +1798,19 @@ fn sort_streams(
|
||||
}
|
||||
}
|
||||
}
|
||||
// Keep a stream whose position names no display, e.g. a full-workspace stream at (0, 0) when
|
||||
// no display sits there (#17027). A stream at an origin another stream already took is still
|
||||
// dropped.
|
||||
for (s, d) in streams.drain(..).zip(shared_displays.drain(..)) {
|
||||
if !displays
|
||||
.displays
|
||||
.iter()
|
||||
.any(|wd| (wd.x, wd.y) == s.position)
|
||||
{
|
||||
sorted_streams.push(s);
|
||||
sorted_shared_displays.push(d);
|
||||
}
|
||||
}
|
||||
*streams = sorted_streams;
|
||||
*shared_displays = sorted_shared_displays;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user