diff --git a/context/glass-cockpit.md b/context/glass-cockpit.md index 88daf0d..bcf1dbc 100644 --- a/context/glass-cockpit.md +++ b/context/glass-cockpit.md @@ -139,6 +139,34 @@ at exactly 777,333 after the re-snap fired). Save fires on `WM_EXITSIZEMOVE` (su since it writes as soon as a drag finishes) with a teardown write as backstop. This is the native analogue of TeslaRel410 `emulator/pod-launch`'s per-rig `--bridge-pos`/`--layout` placement args. +### `,noframe` — per-window chrome removal (2026-07-29) [T2 live] + +Append it to a window's line and that window loses its title bar and border (`WS_POPUP`) — for a +multi-monitor wall where the chrome is just noise: + +``` +Heat MFD=1920,0,657,539,noframe +``` + +Hand-edited (the file is otherwise machine-written). Options are comma-separated after the +numbers and **unknown ones are ignored**, so an older build reading a newer file loses the option +but never the line — the `bindings.txt` grammar rule applied here. + +Two consequences it has to carry, or the option would be a trap: +- **A frameless window has no title bar to drag** — which is the entire sticky-layout workflow. + So a `noframe` window is dragged **by its surface**: `WM_NCHITTEST` returns `HTCAPTION` + anywhere that is not a button and `HTCLIENT` over one, so buttons stay clickable and the drag + still ends in `WM_EXITSIZEMOVE` and still saves. +- **`SaveLayout` rewrites the whole file**, so it writes the flag back — otherwise the first save + after a drag would silently strip it. + +The flag is read BEFORE frame sizing (a `LoadLayout(quiet)` pre-pass), because `AdjustWindowRect` +and therefore `ComputeLayout`'s ring placement depend on whether a window carries chrome. + +Verified live: two flagged windows came up caption-less while the other five kept theirs, a click +still dispatched on the frameless radar (`CLICK 'Secondary / Radar' addr=0x18`), and a +finished-drag save round-tripped both flags back into the file. + **Verified 2026-07-26 [T2]:** `BT_RIOBANK_LOG=1` dumps every bank's rects; `scratchpad/checkbank.py` reports the per-bank census and proves no address is SHADOWED (has a point no earlier button covers); `scratchpad/clickbank.py` then posts a real click at every diff --git a/docs/GLASS_COCKPIT.md b/docs/GLASS_COCKPIT.md index 2208e71..dec9238 100644 --- a/docs/GLASS_COCKPIT.md +++ b/docs/GLASS_COCKPIT.md @@ -764,3 +764,36 @@ per-rig `--bridge-pos`/`--layout` args. - round-trip: relaunched `load` against the game-written cfg → after 12 s (past the re-snap) the *Flight Controls* window was physically at (777,333), all 7 at their saved coords — the re-snap guard held. + +## 2026-07-29 — glass_layout.cfg gains a per-line ",noframe" option + +Requested: strip a window's title bar from the layout file. Appending `,noframe` to a window's +line makes that window a bare `WS_POPUP` -- no caption, no border, nothing but the display and its +buttons -- for a multi-monitor wall where the chrome is only noise. + + Heat MFD=1920,0,657,539,noframe + +Options are comma-separated after the four numbers and unknown ones are IGNORED, so an older build +reading a newer file loses the option but never the line (the bindings.txt grammar rule applied +here). Hand-edited; the file is otherwise machine-written. + +### The two things that would have made it a trap +1. **A frameless window has no title bar to drag** -- which is the entire point of the sticky + layout. So a noframe window is dragged BY ITS SURFACE: `WM_NCHITTEST` returns `HTCAPTION` + anywhere that is not a button and `HTCLIENT` over one. Buttons stay clickable, and because + Windows drives the move, the drag still ends in `WM_EXITSIZEMOVE` -- so it still SAVES. +2. **SaveLayout rewrites the whole file**, so it writes the flag back. Without that the first + finished-drag after adding the option would have silently stripped it. + +### Ordering +The flag is read BEFORE frame sizing (`LoadLayout(quiet)` pre-pass, then the normal pass after +`ComputeLayout`): `AdjustWindowRect` -- and therefore the ring placement -- depends on whether a +window carries chrome. The pre-pass is quiet so the restore still logs exactly once. + +### Verified live +- Two flagged windows (`Heat MFD`, `Secondary / Radar`) came up with `WS_CAPTION` CLEAR while the + other five kept it -- read back out of the live windows with `GetWindowLong(GWL_STYLE)`. +- A click still dispatched on the frameless radar: `[glasswin] CLICK 'Secondary / Radar' addr=0x18`. +- A finished-drag save (`WM_EXITSIZEMOVE`) round-tripped BOTH flags back into the rewritten file, + header comment and all. +- surround / exploded / layout=off / pod / dev: boot + simulate, zero faults. diff --git a/engine/MUNGA_L4/L4GLASSWIN.cpp b/engine/MUNGA_L4/L4GLASSWIN.cpp index b17f096..fd05659 100644 --- a/engine/MUNGA_L4/L4GLASSWIN.cpp +++ b/engine/MUNGA_L4/L4GLASSWIN.cpp @@ -114,6 +114,7 @@ struct GWin int frameW, frameH; int wantX, wantY; int restored; // wantX/wantY came from glass_layout.cfg -> don't re-snap + int noFrame; // ",noframe" in the cfg -> WS_POPUP, drag by the surface }; static GWin gWins[8]; @@ -379,12 +380,38 @@ static void // a later geometry change can't distort an old save. Windows carry WS_CAPTION // in every mode, so they are always draggable -- the gate only controls whether // a drag STICKS. +// +// PER-LINE OPTION ",noframe" (2026-07-29): append it to a window's line and +// that window loses its title bar and border (WS_POPUP) -- for a clean +// multi-monitor wall where the chrome is just noise. Hand-edited; the file +// is otherwise machine-written. +// +// Heat MFD=1920,0,657,539,noframe +// +// Two consequences it has to carry, or the option would be a trap: +// - a frameless window has NO TITLE BAR TO DRAG, which is how the whole +// sticky-layout workflow works. So a noframe window is draggable BY ITS +// SURFACE (WM_NCHITTEST -> HTCAPTION anywhere that is not a button); the +// buttons stay clickable, and the drag still ends in WM_EXITSIZEMOVE so it +// still saves. +// - SaveLayout rewrites the whole file, so it must WRITE THE FLAG BACK or the +// first save after a drag would silently strip it. //########################################################################### enum { LayoutOff = 0, LayoutLoad = 1, LayoutSave = 2 }; static const char *layoutFileName = "glass_layout.cfg"; +// A framed window is a normal tool window; ",noframe" makes it a bare +// WS_POPUP -- no caption, no border, nothing but the display and its buttons. +static DWORD + GlassWindowStyle(const GWin &w) +{ + return w.noFrame + ? (DWORD)WS_POPUP + : (DWORD)(WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX); +} + static int GlassLayoutMode() { @@ -424,7 +451,7 @@ static GWin * // computed spot. Restored windows are flagged so the WM_TIMER re-snap (which // re-runs ComputeLayout once the main window appears) leaves them alone. static void - LoadLayout() + LoadLayout(int quiet) { if (GlassLayoutMode() == LayoutOff) return; @@ -432,8 +459,9 @@ static void FILE *f = fopen(layoutFileName, "rt"); if (f == NULL) { - DEBUG_STREAM << "[glasswin] no " << layoutFileName - << " yet (using computed placement)\n" << std::flush; + if (!quiet) + DEBUG_STREAM << "[glasswin] no " << layoutFileName + << " yet (using computed placement)\n" << std::flush; return; } @@ -459,17 +487,34 @@ static void if (sscanf(eq + 1, "%d,%d,%d,%d", &x, &y, &w, &h) < 2) continue; + // Trailing options after the numbers, comma-separated. Unknown ones + // are ignored (so an older build reading a newer file just loses the + // option, never the line) -- the bindings.txt grammar rule. + int noframe = 0; + for (const char *opt = strchr(eq + 1, ','); opt != NULL; opt = strchr(opt + 1, ',')) + { + const char *t = opt + 1; + while (*t == ' ' || *t == '\t') ++t; + if (_strnicmp(t, "noframe", 7) == 0) + { + noframe = 1; + break; + } + } + GWin *gw = FindGWinByTitle(s); if (gw == NULL) continue; gw->wantX = x; gw->wantY = y; + gw->noFrame = noframe; gw->restored = 1; ++restored; } fclose(f); - DEBUG_STREAM << "[glasswin] restored " << restored << " window position(s) from " - << layoutFileName << "\n" << std::flush; + if (!quiet) + DEBUG_STREAM << "[glasswin] restored " << restored << " window position(s) from " + << layoutFileName << "\n" << std::flush; } // Write every window's current on-screen frame rect. Whole-file rewrite (it is @@ -490,7 +535,10 @@ static void } fputs("# BT411 glass cockpit window layout (BT_GLASS_LAYOUT=save writes this\n" - "# on finished-drag/exit; =load restores it).