From 91e60900ad4e9393aed87ac93d390a3247d3140d Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 17 Jan 2023 14:17:26 -0500 Subject: [PATCH] X backend now understands flexible min widths --- backends/x/window.go | 3 ++- layouts/vertical.go | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/backends/x/window.go b/backends/x/window.go index f1921da..0602007 100644 --- a/backends/x/window.go +++ b/backends/x/window.go @@ -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, diff --git a/layouts/vertical.go b/layouts/vertical.go index 84c05fd..46614da 100644 --- a/layouts/vertical.go +++ b/layouts/vertical.go @@ -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 }