Skip to content

Fix: Enable Xpra desktop canvas resize during browser window resize#1650

Open
gdeyoung wants to merge 3 commits into
agent0ai:readyfrom
gdeyoung:fix/desktop-xpra-resize
Open

Fix: Enable Xpra desktop canvas resize during browser window resize#1650
gdeyoung wants to merge 3 commits into
agent0ai:readyfrom
gdeyoung:fix/desktop-xpra-resize

Conversation

@gdeyoung
Copy link
Copy Markdown
Contributor

@gdeyoung gdeyoung commented May 19, 2026

Fix: Corrected Xpra Desktop Canvas Resize (Fixes #1649)

Problem

The Xpra desktop canvas was not resizing when the browser window was resized.

Root Cause

The __a0ViewportResizing flag was checked in installXpraDesktopClientPatches but was only being set via incomplete logic in refreshFrameOnly. The flag was missing the actual resize propagation logic, causing client._screen_resized() to never be called during viewport resizes.

Solution

This PR provides the complete corrected fix:

Changes in plugins/_desktop/webui/desktop-store.js

  1. _screen_resized guard (lines 1908-1916):

    • Patched to check __a0ViewportResizing === true and allow resizes when the flag is set
  2. refreshFrameOnly lambda (lines 2109-2132) - CORRECTED:

    • Get client directly from frame.contentWindow.client
    • Early return if client not found
    • Set client.__a0ViewportResizing = true before resize
    • Synchronize desktop_width and desktop_height from actual container dimensions
    • Directly call client._screen_resized(new Event("resize")) for proper Xpra resize propagation
    • Use try/finally to ensure flag cleanup

How It Works

Now when the browser window is resized:

  1. refreshFrameOnly sets __a0ViewportResizing = true before doing work
  2. Dimensions are synchronized to match the actual viewport
  3. client._screen_resized(new Event("resize")) is called directly
  4. The patched _screen_resized sees the flag is set and allows the resize
  5. In finally, the flag is cleared

This allows viewport resizes to properly propagate through the Xpra flow while maintaining security against accidental/unexpected resizes.

gdeyoung added 3 commits May 19, 2026 05:31
The client.__a0ViewportResizing flag was checked in installXpraDesktopClientPatches
but never actually set during the queueDesktopResize flow. This prevented the
desktop canvas from resizing when the user resized their browser window.

- Modified refreshFrameOnly() in queueDesktopResize() to set/unset the
  __a0ViewportResizing flag around applyXpraDesktopFrameMode calls
- This allows the patched _screen_resized function to permit resizes from
  the viewport sync flow while maintaining security against accidental resizes

Fixes agent0ai#1649
The previous fix was incomplete. This update provides the complete solution:

**Changes:**
1. Properly get client from frame.contentWindow.client (not XPRA_CLIENT.client)
2. Add early return if client not found
3. Set __a0ViewportResizing flag before dimensions sync
4. Sync desktop_width/desktop_height from actual container dimensions
5. Directly call client._screen_resized(new Event('resize')) for proper resize propagation
6. Use try/finally to ensure flag cleanup

**Fixes:** The __a0ViewportResizing flag checked in _screen_resized guard is now both set AND used to drive the actual resize, allowing viewport resizes to propagate through the Xpra flow while blocking accidental resizes.

Fixes agent0ai#1649
_kg_pipeline (88 tests, 1989 lines):
- Crash recovery checkpoints (atomic state saves)
- Append-only audit trail (JSONL provenance)
- LLM-augmented token compression (29%+ reduction)
- 5-dimension entity health scoring + tiers
- String+LLM entity resolution (504 duplicates merged)

_kg_dreamer (48 tests, 3605 lines):
- 6 dream operations: connect, strengthen, prune, contradict, pattern, insight
- Autonomous background intelligence (runs every 6h)
- LLM-powered insight generation via Qwen3.6-35B
- Separate plugin for zero-risk rollback

Documentation:
- KG System Architecture (386 lines)
- Entity resolution spike report
- Octopoda+OpenHuman enhancement plan v3

Total: 136 tests, 5594 lines, $0 cloud cost
@3clyp50 3clyp50 changed the base branch from main to ready May 21, 2026 13:23
@3clyp50
Copy link
Copy Markdown
Contributor

3clyp50 commented May 21, 2026

Hello! Thanks for the PR. Can I ask you if you mind removing usr/plugins and docs directories from the scope of this PR? I have rebased to the ready branch, which is our in-flight branch for PRs.

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.

Desktop canvas (Xpra) does not resize when browser window resizes

2 participants