Skip to content

Fixes #4834 - Border transparency#4835

Open
tig wants to merge 11 commits intogui-cs:v2_developfrom
tig:issue-4834-border
Open

Fixes #4834 - Border transparency#4835
tig wants to merge 11 commits intogui-cs:v2_developfrom
tig:issue-4834-border

Conversation

@tig
Copy link
Collaborator

@tig tig commented Mar 14, 2026

Fixes

Summary

Make Border support ViewportSettingsFlags.Transparent and ViewportSettingsFlags.TransparentMouse. This is a prerequisite for the Border-based TabView redesign (#4183).

  • Transparent: Only border lines and title text are drawn; the empty interior shows underlying views through.
  • TransparentMouse: Clicks on border lines/title go to the Border; clicks on the empty interior pass through to views underneath.

Plan

See plans/per-cell-transparent-mouse.md for the full implementation plan including root cause analysis and detailed implementation steps.

Progress

Item Status
Border transparency failing tests Done — 2 skipped, 1 passes (wrong reason)
DoDrawComplete comment rewrite Done
DoDrawComplete baseline tests Done — 8 tests, all passing
Phase 1: Visual transparency for Border Not started
Phase 2: Drawn-region-aware TransparentMouse Not started

Proposed Changes

Phase 1: Visual Transparency for Border

  • Fix Border LineCanvas ownership (Border writes to Parent.LineCanvas instead of its own)
  • Make Border participate in DrawContext clip exclusion when Transparent is set (relax the Adornment guard in DoDrawComplete)

Phase 2: Drawn-Region-Aware TransparentMouse

  • Cache each view's drawn Region after drawing
  • During mouse hit-testing, check whether the specific screen point falls within the cached drawn region rather than blanket-excluding the entire view
  • Benefits Border, Margin, and ShadowView

Test plan

  • DoDrawCompleteTests — 8 baseline tests for existing clip exclusion behavior
  • BorderTransparentTests — 3 tests for Border transparency (2 skipped pending implementation)
  • Remove Skip from Border transparency tests once implementation is complete
  • Verify no regressions in UICatalog Transparent and Arrangement scenarios

tig and others added 11 commits March 14, 2026 07:47
Refactored code and docs to distinguish "margins" from "shadows". Renamed `Margin.DrawMargins` to `Margin.DrawShadows` and updated all usages, comments, and test assertions. Expanded documentation in `View.md` and `drawing.md` to describe the two-pass shadow rendering process. Added new tests for shadow rendering in `MarginTests.cs` and improved code style for clarity and consistency. Enhanced comments to explain the shadow drawing workflow.
…lete comments

- Add BorderTransparentTests with 3 tests for Issue gui-cs#4834:
  - Border_Transparent_Shows_Underlying_Content_In_Interior (Skip - not yet implemented)
  - Border_TransparentMouse_Interior_Clicks_Pass_Through (passes for wrong reason)
  - Border_TransparentMouse_BorderLine_Clicks_Are_Captured (Skip - not yet implemented)
- Add implementation plan in plans/per-cell-transparent-mouse.md
- Rewrite DoDrawComplete comments to explain the purpose and mechanics of
  clip exclusion, the Adornment guard, transparent vs opaque paths, and
  how DrawContext flows between parent and child views

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Moved Border_Is_Cleared_After_Margin_Thickness_Change from AdornmentTests.cs to BorderTests.cs for better test organization.
- Updated object initializations in BorderTests.cs to use explicit types and target-typed new () per code style.
- Replaced Rectangle assertions with new Rectangle(...) for clarity.
- Standardized test string literals and output formatting.
- Refactored TransparentTests.cs for style consistency; switched to triple-quoted strings for multiline output.
- Simplified driver creation and variable declarations in ViewDrawingFlowTests.cs; ensured base.OnXxx() is called in TestView overrides.
- Added DoDrawCompleteTests.cs with comprehensive unit tests for DoDrawComplete, covering clip exclusion, border/padding, adornment, and DrawContext.
- Added spelling/grammar exceptions for "border line" and "border lines" in Terminal.sln.DotSettings.
This change means:
- Border adds lines to its own LineCanvas
- Border's `RenderLineCanvas` is skipped (because `SuperViewRendersLineCanvas = true`)
- Parent's draw loop merges Border's LineCanvas into its own
- Parent's `RenderLineCanvas` renders all lines and reports the drawn region to the parent's context
- Border's own DrawContext tracks what IT drew (title text, etc.)
- Relax Adornment guard in DoDrawComplete: transparent adornments now
  participate in clip exclusion so only their drawn cells are excluded
- Skip viewport clearing when Border has Transparent set, allowing
  underlying content to show through the border interior
- Parent views with a transparent Border use the transparent clip
  exclusion path (exclude only drawn cells, not entire frame)
- Enable Border_Transparent_Shows_Underlying_Content_In_Interior test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix Border title occlusion: report title rect to DrawContext so it
  participates in clip exclusion for transparent borders
- Fix clip region clamping: use Border.FrameToScreen() instead of
  ViewportToScreen() when Border is transparent, so border lines and
  title outside the viewport are included in clip exclusion
- Add occlusion tests verifying border lines and title occlude
  underlying peer subviews
- Add Border SubView AnchorEnd rendering and resize tests
- Add Adornment ContentSize tracking test
- Fix ViewportSettingsEditor.ContentSizeValueChanging (gui-cs#4837)
- Update Adornments scenario and editors from tabview branch
- Update plan status

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Border should support ViewportSettings.Transparent & ViewportSettings.TransparentMouse

1 participant