Enforce minimum window size via content guard
This commit is contained in:
parent
8a12f69169
commit
db381b92df
7
main.go
7
main.go
|
|
@ -1786,14 +1786,16 @@ func (s *appState) setContent(body fyne.CanvasObject) {
|
||||||
currentSize := s.window.Canvas().Size()
|
currentSize := s.window.Canvas().Size()
|
||||||
|
|
||||||
bg := canvas.NewRectangle(backgroundColor)
|
bg := canvas.NewRectangle(backgroundColor)
|
||||||
|
sizeGuard := canvas.NewRectangle(color.Transparent)
|
||||||
|
sizeGuard.SetMinSize(fyne.NewSize(800, 600))
|
||||||
if body == nil {
|
if body == nil {
|
||||||
s.window.SetContent(bg)
|
s.window.SetContent(container.NewMax(bg, sizeGuard))
|
||||||
// Restore window size after setting content
|
// Restore window size after setting content
|
||||||
s.window.Resize(currentSize)
|
s.window.Resize(currentSize)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Wrap content with mouse button handler
|
// Wrap content with mouse button handler
|
||||||
wrapped := newMouseButtonHandler(container.NewMax(bg, body), s)
|
wrapped := newMouseButtonHandler(container.NewMax(bg, sizeGuard, body), s)
|
||||||
s.window.SetContent(wrapped)
|
s.window.SetContent(wrapped)
|
||||||
// Restore window size after setting content
|
// Restore window size after setting content
|
||||||
s.window.Resize(currentSize)
|
s.window.Resize(currentSize)
|
||||||
|
|
@ -6551,7 +6553,6 @@ func runGUI() {
|
||||||
}
|
}
|
||||||
// Adaptive window sizing for professional cross-resolution support
|
// Adaptive window sizing for professional cross-resolution support
|
||||||
w.SetFixedSize(false) // Allow manual resizing and maximizing
|
w.SetFixedSize(false) // Allow manual resizing and maximizing
|
||||||
w.SetMinSize(fyne.NewSize(800, 600))
|
|
||||||
|
|
||||||
// Use compact default size (800x600) that fits on any screen
|
// Use compact default size (800x600) that fits on any screen
|
||||||
// Window can be resized or maximized by user using window manager controls
|
// Window can be resized or maximized by user using window manager controls
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user