Skip to content

fix(ui): make UI scale work in DAWs (live zoom + window resize)#4

Open
Hornfisk wants to merge 1 commit into
masterfrom
fix/ui-scale-daw
Open

fix(ui): make UI scale work in DAWs (live zoom + window resize)#4
Hornfisk wants to merge 1 commit into
masterfrom
fix/ui-scale-daw

Conversation

@Hornfisk
Copy link
Copy Markdown
Collaborator

Fixes #3.

Problem

The UI 1.5x badge only wrote ui_scale.txt (read solely by the standalone launcher via --dpi-scale). In a DAW nothing read it and Editor::set_scale_factor was never driven from it, so clicking the badge — and resizing the window — did nothing in every host.

Fix

Drive egui content zoom + a matching programmatic window resize from one scale value, every frame:

ctx.set_zoom_factor(scale);
if editor_state.size() != BASE_WINDOW_SIZE * scale {
    editor_state.set_requested_size(...);
}

With baseview's native scale pinned to 1.0 (DAW hosts default to it; the launcher now passes --dpi-scale 1.0), effective ppp == scale: the host window grows to 680×444 × scale physical px while the layout keeps drawing into a fixed 680×444 logical space. Uniform scale, no reflow — knob rows never move relative to each other.

Changes

  • src/ui/editor.rs — per-frame zoom + resize reconcile; honest badge tooltip/log.
  • src/params.rs — open pre-scaled (new BASE_WINDOW_SIZE const) to avoid a first-frame resize flash.
  • tools/niner-launch.sh — pin --dpi-scale 1.0; plugin owns scaling now.
  • Cargo.toml — repoint nih_plug/nih_plug_egui to Hornfisk/nih-plug@8b51e93 (upstream 28b149e + one line exposing EguiState::set_requested_size, private upstream — mirrors the existing Hornfisk/baseview patch pattern).

Verification

  • cargo check clean; cargo test green (7 tests).
  • ⚠️ Needs DAW verification on geek (couldn't test from WSL): open in Reaper, click badge through 1x/1.5x/2x → window + content scale live, layout intact, knobs aligned. Repeat in Bitwig (texture-cache reopen path) and standalone via niner-launch.sh. If a host ignores request_resize, it degrades to opening at the right size (still better than today).

🤖 Generated with Claude Code

The UI-scale badge only wrote `ui_scale.txt`, which is read solely by the
standalone launcher (`niner-launch.sh --dpi-scale`). In a DAW nothing read
it and `Editor::set_scale_factor` was never driven from it, so clicking the
badge was a no-op in every host (not distro/WM-specific). Resizing the
window also did nothing — the editor never participated in host resize.

Drive both egui's content zoom and a matching programmatic window resize
from a single scale value, every frame:

  ctx.set_zoom_factor(scale);
  if editor_state.size() != BASE * scale { editor_state.set_requested_size(..) }

With baseview's native scale pinned to 1.0 (DAW hosts default to it; the
standalone launcher now passes `--dpi-scale 1.0`), effective ppp == scale:
the host window grows to BASE × scale physical pixels while the layout keeps
drawing into a fixed 680×444 logical space. Uniform scale, no reflow — knob
rows never move relative to each other.

- src/ui/editor.rs: per-frame zoom + resize reconcile; honest badge tooltip/log.
- src/params.rs: open pre-scaled (new BASE_WINDOW_SIZE const) to avoid a
  first-frame resize flash.
- tools/niner-launch.sh: pin --dpi-scale 1.0; plugin owns scaling now.
- Cargo.toml: repoint nih_plug/nih_plug_egui to Hornfisk/nih-plug@8b51e93,
  which exposes EguiState::set_requested_size (private upstream).

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

UI scale control has no effect in DAWs (only standalone)

1 participant