X backend now conforms to new API
This commit is contained in:
parent
d5028317ef
commit
6d6a0c59a1
@ -13,6 +13,7 @@ type Window struct {
|
|||||||
backend *Backend
|
backend *Backend
|
||||||
xWindow *xwindow.Window
|
xWindow *xwindow.Window
|
||||||
xCanvas *xgraphics.Image
|
xCanvas *xgraphics.Image
|
||||||
|
canvas tomo.BasicCanvas
|
||||||
child tomo.Element
|
child tomo.Element
|
||||||
onClose func ()
|
onClose func ()
|
||||||
skipChildDrawCallback bool
|
skipChildDrawCallback bool
|
||||||
@ -194,6 +195,9 @@ func (window *Window) OnClose (callback func ()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (window *Window) reallocateCanvas () {
|
func (window *Window) reallocateCanvas () {
|
||||||
|
window.canvas = tomo.NewBasicCanvas (
|
||||||
|
window.metrics.width,
|
||||||
|
window.metrics.height)
|
||||||
if window.xCanvas != nil {
|
if window.xCanvas != nil {
|
||||||
window.xCanvas.Destroy()
|
window.xCanvas.Destroy()
|
||||||
}
|
}
|
||||||
@ -203,12 +207,12 @@ func (window *Window) reallocateCanvas () {
|
|||||||
0, 0,
|
0, 0,
|
||||||
window.metrics.width,
|
window.metrics.width,
|
||||||
window.metrics.height))
|
window.metrics.height))
|
||||||
|
|
||||||
window.xCanvas.CreatePixmap()
|
window.xCanvas.CreatePixmap()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (window *Window) redrawChildEntirely () {
|
func (window *Window) redrawChildEntirely () {
|
||||||
window.pushRegion(window.paste(window.child))
|
window.pushRegion(window.paste(window.child))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (window *Window) resizeChildToFit () {
|
func (window *Window) resizeChildToFit () {
|
||||||
@ -228,15 +232,10 @@ func (window *Window) resizeChildToFit () {
|
|||||||
|
|
||||||
if window.metrics.height >= minimumHeight &&
|
if window.metrics.height >= minimumHeight &&
|
||||||
window.metrics.width >= minimumWidth {
|
window.metrics.width >= minimumWidth {
|
||||||
|
window.child.DrawTo(window.canvas)
|
||||||
window.child.Resize (
|
|
||||||
window.metrics.width,
|
|
||||||
window.metrics.height)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
window.child.Resize (
|
window.child.DrawTo(window.canvas)
|
||||||
window.metrics.width,
|
|
||||||
window.metrics.height)
|
|
||||||
}
|
}
|
||||||
window.skipChildDrawCallback = false
|
window.skipChildDrawCallback = false
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user