feat(window): no minimum size
The window would not go below 1100x700. That was a fair guess at where the layout stops being comfortable and no business of ours to enforce: an operator wanting OpsLog as a narrow strip beside a decoder, parked on a second screen, or on a small laptop, hit a wall with nothing to show for it. The panels already scroll and collapse. Zero is how Wails says "do not constrain" — winc fills PtMinTrackSize only when the value is above zero, checked in the library rather than assumed — so Windows applies its own floor, about the width of the caption buttons, and nothing here adds to it. Removing the constant meant three other users of it had to be sorted out, since each wanted something different from "the minimum": - The saved-geometry sanity check now has its own floor, 200x150. That is not a minimum the operator feels; it decides when a stored size is corrupt rather than chosen. A window restored at 0x0 cannot be grabbed to fix it, and that is the one state there is no way back from. - The maximised-corner monitor check was passing the minimum AS a size, which would now be a zero-sized rectangle. It uses the saved size. - Leaving compact mode validated its captured geometry against the minimum; it uses the sane floor. SetCompactHeight keeps its 900 minimum: it returns early unless compact is on, and leaving compact resets the minimum to none.
This commit is contained in:
@@ -67,3 +67,28 @@ func TestOnSomeMonitorTrustsSavedPositionWhenBoundsUnknown(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The window has no minimum size: an operator who wants OpsLog as a narrow
|
||||
// strip beside a decoder gets to have one. Zero is how Wails says "do not
|
||||
// constrain" — winc only fills PtMinTrackSize when the value is above zero — so
|
||||
// Windows applies its own floor and nothing here adds to it.
|
||||
func TestTheWindowHasNoMinimumSize(t *testing.T) {
|
||||
if normalMinW != 0 || normalMinH != 0 {
|
||||
t.Errorf("normalMin is %dx%d — anything but 0x0 is a wall the operator hits", normalMinW, normalMinH)
|
||||
}
|
||||
}
|
||||
|
||||
// The sane floor is a different thing from a minimum: it decides when a SAVED
|
||||
// geometry is corrupt rather than chosen. It has to stay small enough not to
|
||||
// second-guess a deliberately tiny window, and large enough that what is
|
||||
// restored can be grabbed and resized — a window reopened at 0x0 is the one
|
||||
// state there is no way back from.
|
||||
func TestSavedGeometryFloorIsSmallButGrabbable(t *testing.T) {
|
||||
if windowSaneW <= 0 || windowSaneH <= 0 {
|
||||
t.Fatal("a zero floor would restore a window that cannot be grabbed")
|
||||
}
|
||||
if windowSaneW > 400 || windowSaneH > 300 {
|
||||
t.Errorf("the floor is %dx%d — big enough to reject a window somebody chose",
|
||||
windowSaneW, windowSaneH)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user