Fix window auto-resizing when content changes

Resolved issue where window would resize itself based on dynamic content
like progress bars and queue updates. Window now maintains the size that
the user sets, regardless of content changes.

**Problem:**
- When progress bars updated or queue content changed, the window would
  automatically resize to fit the new content MinSize
- This caused the window to get larger or smaller unexpectedly
- User-set window size was not being preserved

**Solution:**
- Modified setContent() to capture current window size before setting new content
- Restore the window size after SetContent() completes
- This prevents Fyne from auto-resizing based on content MinSize changes
- Window only resizes when user manually drags edges or maximizes

**Impact:**
- Window maintains stable size through all content changes
- Progress bars, queue updates, and module switches no longer trigger resize
- User retains full control of window size via manual resize/maximize
- Improves professional appearance and user experience

Reported by: Jake

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-21 14:19:50 -05:00
parent 58ad59a0c7
commit 0f24b786c2

10
main.go
View File

@ -1384,15 +1384,23 @@ func (r *mouseButtonRenderer) BackgroundColor() color.Color {
func (s *appState) setContent(body fyne.CanvasObject) {
update := func() {
// Preserve current window size to prevent auto-resizing when content changes
// This ensures the window maintains the size the user set, even when content
// like progress bars or queue items change dynamically
currentSize := s.window.Canvas().Size()
bg := canvas.NewRectangle(backgroundColor)
// Don't set a minimum size - let content determine layout naturally
if body == nil {
s.window.SetContent(bg)
// Restore window size after setting content
s.window.Resize(currentSize)
return
}
// Wrap content with mouse button handler
wrapped := newMouseButtonHandler(container.NewMax(bg, body), s)
s.window.SetContent(wrapped)
// Restore window size after setting content
s.window.Resize(currentSize)
}
// Use async Do() instead of DoAndWait() to avoid deadlock when called from main goroutine