From 6d6a0c59a19e159779b33fc56942264a2c0642fc Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 31 Jan 2023 16:13:20 -0500 Subject: [PATCH] X backend now conforms to new API --- backends/x/window.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/backends/x/window.go b/backends/x/window.go index 30ef7ce..8215b0d 100644 --- a/backends/x/window.go +++ b/backends/x/window.go @@ -13,6 +13,7 @@ type Window struct { backend *Backend xWindow *xwindow.Window xCanvas *xgraphics.Image + canvas tomo.BasicCanvas child tomo.Element onClose func () skipChildDrawCallback bool @@ -194,6 +195,9 @@ func (window *Window) OnClose (callback func ()) { } func (window *Window) reallocateCanvas () { + window.canvas = tomo.NewBasicCanvas ( + window.metrics.width, + window.metrics.height) if window.xCanvas != nil { window.xCanvas.Destroy() } @@ -203,12 +207,12 @@ func (window *Window) reallocateCanvas () { 0, 0, window.metrics.width, window.metrics.height)) - window.xCanvas.CreatePixmap() } func (window *Window) redrawChildEntirely () { window.pushRegion(window.paste(window.child)) + } func (window *Window) resizeChildToFit () { @@ -228,15 +232,10 @@ func (window *Window) resizeChildToFit () { if window.metrics.height >= minimumHeight && window.metrics.width >= minimumWidth { - - window.child.Resize ( - window.metrics.width, - window.metrics.height) + window.child.DrawTo(window.canvas) } } else { - window.child.Resize ( - window.metrics.width, - window.metrics.height) + window.child.DrawTo(window.canvas) } window.skipChildDrawCallback = false }