Skip to content

Commit

Permalink
Fixing window position / size maths
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jan 26, 2025
1 parent 22adb9a commit 8782c4d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions container/innerwindow.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ func (i *innerWindowRenderer) Layout(size fyne.Size) {
th := i.win.Theme()
pad := th.Size(theme.SizeNamePadding)

pos := fyne.NewSquareOffsetPos(pad / -2)
size = size.Add(fyne.NewSquareSize(pad))
i.LayoutShadow(size, pos)
i.LayoutShadow(size, fyne.Position{})
i.bg.Resize(size)

barHeight := i.win.Theme().Size(theme.SizeNameWindowTitleBarHeight)
Expand All @@ -156,19 +154,19 @@ func (i *innerWindowRenderer) Layout(size fyne.Size) {
i.win.content.Resize(innerSize)

cornerSize := i.corner.MinSize()
i.corner.Move(pos.Add(size).Subtract(cornerSize).AddXY(1, 1))
i.corner.Move(fyne.NewPos(size.Components()).Subtract(cornerSize).AddXY(1, 1))
i.corner.Resize(cornerSize)
}

func (i *innerWindowRenderer) MinSize() fyne.Size {
th := i.win.Theme()
pad := th.Size(theme.SizeNamePadding)
contentMin := i.win.content.MinSize()
barMin := i.bar.MinSize()
barHeight := th.Size(theme.SizeNameWindowTitleBarHeight)

innerWidth := fyne.Max(barMin.Width, contentMin.Width)
innerWidth := fyne.Max(i.bar.MinSize().Width, contentMin.Width)

return fyne.NewSize(innerWidth+pad*2, contentMin.Height+pad+barMin.Height).Add(fyne.NewSquareSize(pad))
return fyne.NewSize(innerWidth+pad*2, contentMin.Height+pad+barHeight)
}

func (i *innerWindowRenderer) Refresh() {
Expand Down

0 comments on commit 8782c4d

Please sign in to comment.