Skip to content

Menu and Browser: defer to the toolkit's own scale instead of ignoring it - #209

Merged
tannevaled merged 1 commit into
mainfrom
feat/one-scale
Aug 16, 2026
Merged

Menu and Browser: defer to the toolkit's own scale instead of ignoring it#209
tannevaled merged 1 commit into
mainfrom
feat/one-scale

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Both grew a Scale field before SetMetricScale existed, and answered only to it. So a host had to choose: set the global and watch the menu stay small while everything around it grew, or set both and hope nothing was scaled twice.

(Since neither widget routes anything through scaled(), setting both would in fact have been safe — but nothing said so, and "hope" is not an interface. This is the double-scaling risk that window#49 could not rule out without reading both packages.)

What changes

The field now replaces the global rather than falling back to 1:

Menu.Scale unset Menu.Scale = 1.5
MetricScale() == 1 1 (unchanged) 1.5 (unchanged)
MetricScale() == 2 2 1.5, not 3

So a host that set the field before the knob existed gets exactly what it asked for, and one that sets only the knob gets a menu and a browser that follow it like every other widget. Asserted at both ends, including that a menu scaled by the global comes out the same height as one scaled by its field — the two ways of saying the same thing must agree.

This is what makes it safe for window.Run to set SetMetricScale for a NativeScale window: there is one scale, and setting it twice is not an error.

🤖 Generated with Claude Code

…g it

Both grew a Scale field before SetMetricScale existed, and answered only to it.
So a host had to choose: set the global and watch the menu stay small while
everything around it grew, or set both and hope nothing was scaled twice. Since
neither widget routes anything through scaled(), setting both would in fact have
been safe -- but nothing said so, and "hope" is not an interface.

The field now REPLACES the global rather than falling back to 1: a host that set
it before the knob existed gets exactly what it asked for, and one that sets
only the knob gets a menu and a browser that follow it like every other widget.
1.5 under a global of 2 is 1.5, not 3.

Co-Authored-By: Claude Opus 5 <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.

1 participant