fix: 5px horizontal safety margin on the widget (no right-edge clipping)

Windows DPI rounding could shave a couple of pixels off the right edge of
the floating widget; macOS was fine. Add WIDGET_WIDTH_SAFETY_PX = 5 to the
idle/recording/call-stack widget width and bump the Rust WIDGET_WIDTH to
match (114). The widget window is transparent, so the extra width is
invisible padding and the centered pill keeps its position.
This commit is contained in:
David Perov 2026-06-24 11:15:57 +03:00
parent 321f40b7f5
commit 06aafaf910
2 changed files with 11 additions and 2 deletions

View file

@ -10,7 +10,9 @@ pub const NOTICE_HEIGHT: f64 = 52.0;
/// Must match NOTICE_WIDGET_GAP in src/windows/widget/widgetConstants.ts (logical pixels).
pub const NOTICE_GAP: f64 = 2.0;
/// Must match CALL_STACK_WIDGET_WIDTH/HEIGHT in src/windows/widget/widgetConstants.ts.
pub const WIDGET_WIDTH: f64 = 109.0;
/// Width includes WIDGET_WIDTH_SAFETY_PX (5) so the pill is never clipped on the
/// right under Windows DPI rounding: 91 (idle) + 1 (gap) + 22 (call bubble).
pub const WIDGET_WIDTH: f64 = 114.0;
pub const WIDGET_HEIGHT: f64 = 34.0;
const WIDGET_EXPANDED_OFFSET_RATIO: f64 = 0.20;

View file

@ -14,7 +14,14 @@ export const WIDGET_SHELL_HEIGHT = 22;
export const IDLE_HOVER_SCALE = 1;
export const ACTIVE_WIDGET_SHELL_WIDTH = WIDGET_SHELL_WIDTH * IDLE_HOVER_SCALE;
export const ACTIVE_WIDGET_SHELL_HEIGHT = WIDGET_SHELL_HEIGHT * IDLE_HOVER_SCALE;
export const IDLE_HOVER_WIDGET_WIDTH = ACTIVE_WIDGET_SHELL_WIDTH + 12;
/**
* Extra horizontal slack so the pill is never clipped on the right. Windows DPI
* rounding could shave a couple of pixels off the right edge (macOS never did);
* the widget window is transparent, so this reads as invisible padding.
*/
export const WIDGET_WIDTH_SAFETY_PX = 5;
export const IDLE_HOVER_WIDGET_WIDTH =
ACTIVE_WIDGET_SHELL_WIDTH + 12 + WIDGET_WIDTH_SAFETY_PX;
export const IDLE_HOVER_WIDGET_HEIGHT = ACTIVE_WIDGET_SHELL_HEIGHT + 12;
export const IDLE_WIDGET_WIDTH = IDLE_HOVER_WIDGET_WIDTH;
export const IDLE_WIDGET_HEIGHT = IDLE_HOVER_WIDGET_HEIGHT;