Skip to content

fix(start): DPI-scale the Start-button rect and default to centered alignment#67

Merged
Alpaq92 merged 1 commit into
mainfrom
fix/start-rect-dpi
Jul 9, 2026
Merged

fix(start): DPI-scale the Start-button rect and default to centered alignment#67
Alpaq92 merged 1 commit into
mainfrom
fix/start-rect-dpi

Conversation

@Alpaq92

@Alpaq92 Alpaq92 commented Jul 9, 2026

Copy link
Copy Markdown
Owner

What

Follow-up to #64, produced by an adversarially-verified multi-agent review of that change (33 candidates → 11 verified findings). Fixes every confirmed geometry defect in StartButtonLocator:

Finding Fix
Centered branch never DPI-scaled (CONFIRMED) — icon-pitch constants are 96-DPI units compared against physical pixels, so the #64 leak class persisted for centered taskbars (the Win 11 default alignment) at >100% scaling Both branches now scale by the tray's monitor DPI (GetDpiForWindow(tray) — per-monitor correct)
Missing TaskbarAl treated as left-aligned (CONFIRMED) — Win 11 OOB is centered and the value only appears after the user first toggles alignment; fresh profiles got a rect over the widgets corner and MenYou never intercepted their Start clicks Missing value / unreadable key now defaults to centered (1)
Truncation reopened a 1-px dead sliver at fractional scales (125%: 68.75→68) Integer ceiling (x*dpi+95)/96; safe because half-open Contains excludes Right — the first pinned app can't be swallowed
dpi==0 fabricated an undersized rect (tray died mid-query), silently replacing the hook's last good rect Returns empty like the sibling failure paths; EnsureRectFresh keeps the last good rect
Stale/contradictory docs (band description, "~69px" comment vs 68 actual, refresh contract, hook cost enumeration) All corrected; StartButtonWidth renamed to CenteredIconStep (it was never the button's width after #64)

Coordination

A parallel session is implementing secondary-monitor taskbar coverage (Shell_SecondaryTrayWnd) on top of this file — that work should rebase onto this branch (or land after it) so its per-tray rects inherit the DPI scaling, which matters most on mixed-DPI multi-monitor setups.

Verification

  • Release build: 0 warnings / 0 errors.
  • At 100% DPI the math is bit-identical to fix(start): stop the native Start menu leaking on some taskbar clicks #64's shipped behavior ((55*96+95)/96 = 55), so the fix verified live on the reporter's machine is preserved exactly.
  • Remaining known gap (deliberate): the centered branch is still a heuristic band (~7 icon-pitches left of midpoint) — the durable fix is the documented off-hook-thread UI-Automation lookup.

🤖 Generated with Claude Code

…lignment

Follow-up to #64, from an adversarially-verified review of that change
(11 findings). The 55px left-aligned width was a 100%-DPI measurement
compared against physical hook pixels, so the click-leak persisted at
125%/150% scaling; the centered branch had the same physical-vs-logical
mismatch in its icon-pitch constants.

- Scale both branches by the tray's monitor DPI (GetDpiForWindow of the
  tray hwnd — per-monitor correct, Explorer is PMv2-aware).
- Round the left-aligned width UP with integer ceiling ((x*dpi+95)/96):
  truncation left a 1-px dead sliver at fractional scale factors
  (125% → 68.75), and the half-open RECT.Contains already excludes
  Right, so rounding up cannot swallow the first pinned app.
- dpi==0 (tray hwnd died mid-query) now returns an empty rect like the
  sibling failure paths, so StartClickHook.EnsureRectFresh keeps the
  last good rect instead of adopting an unscaled 55px one.
- GetTaskbarAlignment now treats a missing TaskbarAl value as CENTERED:
  Win 11's out-of-box taskbar is centered and the value is only written
  once the user first toggles alignment — fresh profiles were getting
  the left-aligned rect (leftmost ~55px) for a centered Start button,
  so MenYou never intercepted their taskbar clicks at all.
- Renamed StartButtonWidth → CenteredIconStep (it was never the
  button's width after #64), removed a dead local, and made the class
  docs match the code (band description, DPI caveats, refresh
  contract, hook-side cost enumeration).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Alpaq92, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 88b34b7b-6f10-45f1-98a4-c04b128f6a95

📥 Commits

Reviewing files that changed from the base of the PR and between fdea126 and 7c41f17.

📒 Files selected for processing (2)
  • src/MenYou/Platform/Windows/StartButtonLocator.cs
  • src/MenYou/Platform/Windows/StartClickHook.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/start-rect-dpi

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Alpaq92 Alpaq92 enabled auto-merge (squash) July 9, 2026 11:30
// GetWindowRect above — return empty like the sibling failure paths so
// EnsureRectFresh keeps the last good rect instead of adopting an
// unscaled one.
var dpi = (int)GetDpiForWindow(tray);
private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);

[DllImport("user32.dll")]
private static extern uint GetDpiForWindow(IntPtr hWnd);
@Alpaq92 Alpaq92 disabled auto-merge July 9, 2026 12:14
@Alpaq92 Alpaq92 merged commit 879fcb7 into main Jul 9, 2026
10 checks passed
@Alpaq92 Alpaq92 deleted the fix/start-rect-dpi branch July 9, 2026 12:14
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.

2 participants