Skip to content

Conversation

@aviralgarg05
Copy link

Title: Fix display layout re-entrancy and add headless layout tests #430

Summary

  • Problem: On complex multi-monitor arrangements (3+), dragging and auto-alignment could cause redundant GObject notify storms leading to layout resets or, in rare cases, crashes (stack traces implicated move_y/move_x).
  • Fix: Batch x/y movement updates and guard geometry changes to minimize re-entrant property notifications.
  • Validation: Added a headless test suite for layout logic (overlap resolution, edge adjacency, origin normalization) that passes in container environments without a compositor.

Changes

  1. Widgets/DisplayWidget.vala

    • Add move_by(dx, dy): freezes/thaws notify around both deltas; queues one resize.
    • move_x/move_y: early return on zero delta to avoid no-op notifies.
    • set_virtual_monitor_geometry: update only when values actually change; queue resize once.
  2. Widgets/DisplaysOverlay.vala

    • Use move_by in drag updates and in alignment/overlap resolution paths to coalesce updates.
  3. Tests

    • tests/test_layout.vala: GLib-only tests that simulate multi-monitor layout behavior:
      • resolve overlaps among 3+ displays
      • normalize origin to (0,0)
      • ensure displays remain connected by edges (no isolated enabled displays)
    • Added to Meson and runs with meson test -C build

Risk / Compatibility

  • No public API changes; behavior change is internal (coalesced movements and guarded geometry updates).
  • Build still emits the same GTK deprecation warnings as before; no new warnings/errors introduced.

Issue coverage

  • Addresses the reported instability by preventing re-entrant notify storms during drag/auto-align cycles, which previously could cascade through connected signals.

…less layout tests and docs\n\n- Add move_by batching and guarded set_virtual_monitor_geometry\n- Use move_by in drag/align paths to reduce re-entrant notifies\n- Add headless GLib tests for overlap resolution, connectivity, origin normalization\n- Update README with test instructions; add PR notes
@aviralgarg05
Copy link
Author

please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant