diff --git a/backends/x/window.go b/backends/x/window.go index 4b04fbb..7bd7781 100644 --- a/backends/x/window.go +++ b/backends/x/window.go @@ -10,13 +10,11 @@ import "github.com/jezek/xgbutil/xgraphics" import "git.tebibyte.media/sashakoshka/tomo" type Window struct { - backend *Backend - xWindow *xwindow.Window - xCanvas *xgraphics.Image - child tomo.Element - onClose func () - drawCallback func (region tomo.Image) - minimumSizeChangeCallback func (width, height int) + backend *Backend + xWindow *xwindow.Window + xCanvas *xgraphics.Image + child tomo.Element + onClose func () skipChildDrawCallback bool metrics struct { @@ -89,9 +87,7 @@ func (window *Window) Adopt (child tomo.Element) { }) window.resizeChildToFit() } - window.childMinimumSizeChangeCallback ( - child.MinimumWidth(), - child.MinimumHeight()) + window.childMinimumSizeChangeCallback(child.MinimumSize()) } func (window *Window) Child () (child tomo.Element) { diff --git a/tomo.go b/tomo.go index ca57fd2..fa93222 100644 --- a/tomo.go +++ b/tomo.go @@ -94,16 +94,12 @@ type Element interface { // the parent element or containing any reference to it. When a parent // element adopts a child element, it must set these callbacks. SetParentHooks (callbacks ParentHooks) - - // MinimumWidth specifies the minimum amount of pixels this element's - // width may be set to. If the element is resized to an amount smaller - // that MinimumWidth, it will instead set its width to MinimumWidth. - MinimumWidth () (minimum int) - // MinimumHeight specifies the minimum amount of pixels this element's - // height may be set to. If the element is resized to an amount smaller - // that MinimumHeight, it will instead set its height to MinimumHeight. - MinimumHeight () (minimum int) + // MinimumSize specifies the minimum amount of pixels this element's + // width and height may be set to. If the element is given a resize + // event with dimensions smaller than this, it will use its minimum + // instead of the offending dimension(s). + MinimumSize () (width, height int) } // Window represents a top-level container generated by the currently running