Skip to content

X11: a host's suggested scale factor takes precedence over Xft.dpi for embedded windows - #376

Open
podulator wants to merge 2 commits into
RustAudio:nextfrom
podulator:next-host-scale
Open

podulator wants to merge 2 commits into
RustAudio:nextfrom
podulator:next-host-scale

Conversation

@podulator

@podulator podulator commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

The second half of #359: for an embedded window (my Godot use case), the host's suggested scale now takes precedence over Xft.dpi. Windows without a parent keep today's order, so standalone apps see no change.

As you pointed out in #359, a Wayland-native host knows the per-monitor scale its own UI is drawn at, which Xft.dpi (one value for the whole X display) can't express. CLAP's set_scale() is documented to "override any OS info", and with #361 the host learns whether it did.

This builds on #375 (same function): only the second commit is new here...

Also, the window's first size now uses the same rule as scale_factor(): with no Xft.dpi and a fallback_scale_factor in the settings, it was created at 1.0 while reporting the fallback scale.

Tested on X11 (Xvfb), a 600×400 window suggested 2.0 then 1.5:

Xft.dpi window before (#375) this PR
none standalone 1200×800, 900×600 (used) same
none embedded 1200×800, 900×600 (used) same
192 (2.0) standalone 1200×800 (not used) same
192 (2.0) embedded 1200×800 (not used) 1200×800, then 900×600 (used)

Only X11 changes; Win32 and macOS are untouched.

podulator added 2 commits November 26, 2026 10:15
… to next

handle_host_suggest_scale_factor() converted the current physical size back to logical pixels
with a scale of 1.0 instead of the scale in use, so a second suggested scale compounded on the
first. RustAudio#358 fixed this on master after next branched; this is the same change on next.
…r embedded windows

A window with a parent is a host's child (a plug-in's editor, say), and the host knows the scale
its own UI is drawn at, which Xft.dpi, one value for the whole X display, may not match (a
Wayland-native host, per-monitor scaling). CLAP's set_scale() is documented to override any OS
info. Windows without a parent keep the current order: Xft.dpi first, then the suggestion.

The window's first size now uses the same rule as scale_factor(), so they agree from the start.
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