From 13b84bffd8d7e91c7c83f27ef282d58c86647378 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 11:16:29 -0400 Subject: [PATCH] Fullscreen startup and dock the unit display MegaMek opened at 800x600 inside the browser viewport with the unit display, minimap and report pane all floating. Fixed via a seeded preferences file, no patch. Fullscreen without hardcoding a resolution: AbstractClientGUI.initializeFrame() honours a stored window size, and UIUtil.updateWindowBounds() then clamps it to the union of screen device bounds. Under Webswing the "screen" is the browser viewport, so an absurdly large stored size collapses to exactly the viewport at 0,0 - correct at any browser size. Docking: UnitDisplayLocation and MiniReportLocation are 0 = floating dialog, 1 = docked into the main split pane (ClientGUI.setUnitDisplayLocation). Both set to 1. Also turned off the keybinds overlay to reclaim map area (Ctrl+K toggles it) and moved the minimap clear of the left panel. MegaMek rewrites clientsettings.xml on exit, so start.sh re-seeds it from a template every launch, the same way it materialises webswing.config. Verified by screenshot in a live session: frame fills the viewport, unit display is a docked full-height left panel, title and menu bars are visible, map area is substantially larger, and the glyph fixes still hold. Two gaps recorded in TODO. The minimap has no location preference and is dialog-only, so docking it needs a MegaMek patch. The mini report is configured to dock but only appears in report phases, which a headless run cannot reach - no shipped scenario pre-places units, so deployment always blocks - and is therefore verified by code path only. Co-Authored-By: Claude Opus 5 --- README.md | 2 +- TODO.md | 17 +++++++- spike-webswing/clientsettings.xml.template | 48 ++++++++++++++++++++++ spike-webswing/start.sh | 4 ++ 4 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 spike-webswing/clientsettings.xml.template diff --git a/README.md b/README.md index 54a3fd2..577cce7 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ Applied, and verified to be the only differences from the stock jar: - `harness/src/spike/` — `HostForHuman` (server + bot, one slot open for a human), `WatchGame` + `TextRenderer` (observer client dumping full text state; the adapter-pattern prototype) -- `spike-webswing/` — Webswing config template and `start.sh` +- `spike-webswing/` — Webswing + MegaMek settings templates, `start.sh` - `patches/` — patchset, archive, patched-jar builder - `scripts/` — `fetch-deps.sh`, `gen-fontconfig.sh` (legacy fontconfig Webswing's toolkit needs), `cdp-screenshot.py`, `summarize.py` diff --git a/TODO.md b/TODO.md index 959910b..ba7aa70 100644 --- a/TODO.md +++ b/TODO.md @@ -22,8 +22,21 @@ between them — basic punctuation (`/ : ,` parens) turns to boxes and the armor pips disappear. Also ruled out earlier: trusting MegaMek's `data/fonts` alone, which removed all font-load rejections but fixed nothing. -**Open fullscreen** — the frame opens small inside a large viewport. Webswing -already passes `webswing.screenWidth`/`screenHeight` to the app JVM. +**Startup layout — done, one gap.** `spike-webswing/clientsettings.xml.template` +is seeded into `mmconf/` on every launch (MegaMek rewrites it on exit, so once is +not enough). Fullscreen works without hardcoding a resolution: a huge stored +window size is clamped by `UIUtil.updateWindowBounds()` to the screen union, +which under Webswing is the browser viewport. The unit display is docked +(`UnitDisplayLocation=1`), the keybinds overlay is off to reclaim map area, and +the minimap is nudged clear of the left panel. + +*The minimap cannot dock* — unlike the unit display and mini report it has no +location preference and is dialog-only. Docking it would need a MegaMek patch. + +*Unverified:* the mini report is set to dock (`MiniReportLocation=1`, the same +0=float/1=dock mechanism as the unit display) but only appears in report phases, +which a headless run cannot reach — no shipped scenario pre-places units, so +deployment always blocks. Confirm during a real match. **Victory drops you** — the host prints a result, sleeps 5s, then kills everything, so the page dies with no summary. Decouple "game over" from "process diff --git a/spike-webswing/clientsettings.xml.template b/spike-webswing/clientsettings.xml.template new file mode 100644 index 0000000..1b569ac --- /dev/null +++ b/spike-webswing/clientsettings.xml.template @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spike-webswing/start.sh b/spike-webswing/start.sh index 10fa424..8e6e9f6 100755 --- a/spike-webswing/start.sh +++ b/spike-webswing/start.sh @@ -53,6 +53,10 @@ fi # Materialise the Webswing config with absolute paths for this checkout. sed "s|@ROOT@|$ROOT|g" "$ROOT/spike-webswing/webswing.config.template" > "$WS/webswing.config" +# Seed MegaMek's GUI preferences: fullscreen frame, docked unit display and +# report pane. MegaMek rewrites this file on exit, so re-seed every launch. +cp "$ROOT/spike-webswing/clientsettings.xml.template" "$MM/mmconf/clientsettings.xml" + WS_PID="" HOST_PID="" TAIL_PID="" -- 2.51.2