feat(settings): "Smart window size" toggle to opt out of monitor-relative

launch sizing

Players who specifically prefer the literal 1280×800 baseline on
every fresh-install launch had no way to opt out of the v0.19.0
smart-default sizer. Adds a Gameplay-section toggle (mirrors the
"Winnable deals only" pattern) so they can flip it off.

- New `Settings::disable_smart_default_size: bool` field with
  `#[serde(default)]` so legacy `settings.json` files load to the
  shipped behaviour (smart sizer enabled).
- Settings panel gains a "Smart window size" row with ON/OFF label
  inverting the negative flag, and a tooltip clarifying that saved
  window geometry always wins over both branches.
- `solitaire_app::main` reads the flag once at startup and skips
  the `apply_smart_default_window_size` registration when it's set.
  Mid-session changes apply on next launch (documented on the
  field).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
funman300
2026-05-07 04:00:43 +00:00
parent 67c150bd7b
commit e1b8766e15
3 changed files with 83 additions and 1 deletions
+15
View File
@@ -181,6 +181,20 @@ pub struct Settings {
/// solver retry loop — see `solitaire_engine::handle_new_game`.
#[serde(default)]
pub winnable_deals_only: bool,
/// When `true`, suppresses the launch-time
/// `apply_smart_default_window_size` system: the window opens at
/// the literal `(1280, 800)` default instead of resizing to ~70 %
/// of the primary monitor's logical size on the first frame. For
/// players who specifically prefer the 1280×800 baseline on every
/// fresh launch (i.e. installs without saved geometry).
///
/// Older `settings.json` files written before this field existed
/// deserialize cleanly to `false` via `#[serde(default)]`, which
/// preserves the smart-default behaviour shipped in v0.19.0.
/// Saved-geometry launches are unaffected by this flag — the
/// player's last window size always wins.
#[serde(default)]
pub disable_smart_default_size: bool,
/// Per-move duration during replay playback, in seconds. Range
/// `[REPLAY_MOVE_INTERVAL_MIN_SECS, REPLAY_MOVE_INTERVAL_MAX_SECS]`;
/// default mirrors `solitaire_engine::replay_playback::REPLAY_MOVE_INTERVAL_SECS`
@@ -306,6 +320,7 @@ impl Default for Settings {
tooltip_delay_secs: default_tooltip_delay(),
time_bonus_multiplier: default_time_bonus_multiplier(),
winnable_deals_only: false,
disable_smart_default_size: false,
replay_move_interval_secs: default_replay_move_interval_secs(),
}
}