You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: canvas.go
    path of file: ./repos/fyne/internal/driver/common
    
    the code of the file until where you have to start completion: package common

import (
	"image/color"
	"reflect"
	"sync"
	"sync/atomic"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/canvas"
	"fyne.io/fyne/v2/internal"
	"fyne.io/fyne/v2/internal/app"
	"fyne.io/fyne/v2/internal/async"
	"fyne.io/fyne/v2/internal/cache"
	"fyne.io/fyne/v2/internal/driver"
	"fyne.io/fyne/v2/internal/painter/gl"
)

// SizeableCanvas defines a canvas with size related functions.
type SizeableCanvas interface {
	fy
    
func (c *Canvas) EnsureMinSize() bool {
	if c.impl.Content() == nil {
		return false
	}
	windowNeedsMinSizeUpdate := false
	csize := c.impl.Size()
	min := c.impl.MinSize()

	c.RLock()
	defer c.RUnlock()

	var parentNeedingUpdate *RenderCacheNode

	ensureMinSize := func(node *RenderCacheNode, pos fyne.Position) {
		obj := node.obj
		cache.SetCanvasForObject(obj, c.impl, func() {
			if img, ok := obj.(*canvas.Image); ok {
				c.RUnlock()
				img.Refresh() // this may now have a different texScale
				c.RLock()
			}
		})

		if parentNeedingUpdate == node {
			c.updateLayout(obj)
			parentNeedingUpdate = nil
		}

		c.RUnlock()
		if !obj.Visible() {
			c.RLock()
			return
		}
		minSize := obj.MinSize()
		c.RLock()

		minSizeChanged := node.minSize != minSize
		if minSizeChanged {
			node.minSize = minSize
			if node.parent != nil {
				parentNeedingUpdate = node.parent
			} else {
				windowNeedsMinSizeUpdate = true
				c.RUnlock()
				size := obj.Size()
				c.RLock()
				expectedSize := minSize.Max(size)
				if expectedSize != size && size != csize {
					c.RUnlock()
					obj.Resize(expectedSize)
					c.RLock()
				} else {
					c.updateLayout(obj)
				}
			}
		}
	}
	c.WalkTrees(nil, ensureMinSize)

	shouldResize := windowNeedsMinSizeUpdate && (csize.Width < min.Width || csize.Height < min.Height)
	if shouldResize {
		c.RUnlock()
		c.impl.Resize(csize.Max(min))
		c.RLock()
	}
	return windowNeedsMinSizeUpdate
}