fix(start): DPI-scale the Start-button rect and default to centered alignment#67
Conversation
…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>
|
Warning Review limit reached
Next review available in: 23 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
| // 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); |
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:GetDpiForWindow(tray)— per-monitor correct)TaskbarAltreated 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(x*dpi+95)/96; safe because half-openContainsexcludesRight— the first pinned app can't be swalloweddpi==0fabricated an undersized rect (tray died mid-query), silently replacing the hook's last good rectEnsureRectFreshkeeps the last good rectStartButtonWidthrenamed toCenteredIconStep(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
(55*96+95)/96 = 55), so the fix verified live on the reporter's machine is preserved exactly.🤖 Generated with Claude Code