X backend now understands flexible min widths

This commit is contained in:
Sasha Koshka 2023-01-17 14:17:26 -05:00
parent 7398f146ba
commit 91e60900ad
2 changed files with 4 additions and 5 deletions

View File

@ -205,7 +205,7 @@ func (window *Window) resizeChildToFit () {
window.skipChildDrawCallback = true
if child, ok := window.child.(tomo.Flexible); ok {
minimumHeight := child.MinimumHeightFor(window.metrics.width)
_, minimumWidth := child.MinimumSize()
minimumWidth, _ := child.MinimumSize()
icccm.WmNormalHintsSet (
@ -254,6 +254,7 @@ func (window *Window) childDrawCallback (region tomo.Canvas) {
}
func (window *Window) childMinimumSizeChangeCallback (width, height int) {
println("x thinks:",width, height)
icccm.WmNormalHintsSet (
window.backend.connection,
window.xWindow.Id,

View File

@ -99,6 +99,7 @@ func (layout Vertical) MinimumSize (
width += theme.Padding() * 2
height += theme.Padding() * 2
}
println(width, height)
return
}
@ -112,6 +113,7 @@ func (layout Vertical) MinimumHeightFor (
) {
if layout.Pad {
width -= theme.Padding() * 2
height += theme.Padding() * 2
}
for index, entry := range entries {
@ -127,9 +129,5 @@ func (layout Vertical) MinimumHeightFor (
height += theme.Padding()
}
}
if layout.Pad {
height += theme.Padding() * 2
}
return
}