diff options
| author | srdusr <[email protected]> | 2025-11-04 11:55:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2025-11-04 11:55:00 +0200 |
| commit | a8991f65602abc5ecee740c443c58fa96ecd15e1 (patch) | |
| tree | 31c9d1e15915b6e3757b293140e6ee47b6d28008 /crates/wayland/src/udev | |
| parent | a4710d792a1b16698fc30b9e97e6c08c82129d6d (diff) | |
| download | srdwm-a8991f65602abc5ecee740c443c58fa96ecd15e1.tar.gz srdwm-a8991f65602abc5ecee740c443c58fa96ecd15e1.zip | |
Fix window memory never saving on close, and split-screen icon/primary bugs
Screenshotted the just-split display on request rather than guessing --
it showed why windows never seem to remember placement/size, plus two
real split-screen bugs.
Window memory (WindowManager::remembered_geometry) was correctly wired
on the read side, but the only writes came from end_drag/end_resize in
dragresize.rs - a real drag or resize. A window the user opens, looks
at, and closes without ever touching its edges had nothing recorded, so
reopening it always fell back to a fresh cascade placement, for what is
probably most ordinary window lifecycles. remove_window now also
snapshots geometry (same app_id-non-empty gate the drag/resize sites
use), persisted at both of its wayland-side call sites the same way the
drag/resize-release site already does.
desktop_icon_origins mirrored the full icon set onto every Monitor entry
when general.desktop_icons_all_monitors is on - which, after a
srd.monitor.split, is one entry per split part of the same physical
screen, not one per real monitor. Extracted into a separately-tested
icon_origins_for that collapses split parts of the same connector back
to one origin, keeping a genuinely separate monitor's own origin intact.
Found while fixing that: every split part also reported primary: true
(computed from the connector's name, which doesn't vary per part) --
fixed by gating on part == 0 too.
Diffstat (limited to 'crates/wayland/src/udev')
| -rw-r--r-- | crates/wayland/src/udev/platform.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/wayland/src/udev/platform.rs b/crates/wayland/src/udev/platform.rs index 37abf5d..d7132ee 100644 --- a/crates/wayland/src/udev/platform.rs +++ b/crates/wayland/src/udev/platform.rs @@ -856,7 +856,16 @@ impl Platform for UdevPlatform { // erasing the split it was placed to respect. m.full_geometry = srdwm_core::monitor::split_rect(full, part, parts, rows); m.maximize_geometry = srdwm_core::monitor::split_rect(maximize, part, parts, rows); - m.primary = primary_name.as_deref() == Some(name.as_str()); + // Only the first part of a split connector, not every one + // of them - `primary_name` names the *connector*, which + // doesn't change across `0..parts`, so this used to mark + // every split part primary at once. Two (or more) `Monitor` + // entries all claiming `primary: true` broke the "exactly + // one primary" assumption every caller of this field + // reasonably makes (`desktop_icon_origins`'s own single- + // monitor branch, concretely, which just took whichever + // `.find(|m| m.primary)` happened to match first). + m.primary = part == 0 && primary_name.as_deref() == Some(name.as_str()); m.split = parts > 1; m.scale = scale; out.push(m); |