A canvas is now created

This commit is contained in:
Sasha Koshka 2022-11-09 19:07:40 -05:00
parent acbf2a3954
commit 01f43a03a4

View File

@ -74,6 +74,11 @@ func (backend *Backend) calculateWindowSize () (x, y int) {
return
}
func (backend *Backend) bindCanvas () {
backend.canvas.XSurfaceSet(backend.window.Id)
backend.canvas.XDraw()
backend.canvas.XPaint(backend.window.Id)
}
// factory instantiates an X backend.
func factory (application *stone.Application) (output stone.Backend, err error) {
@ -106,6 +111,15 @@ func factory (application *stone.Application) (output stone.Backend, err error)
0)
backend.window.Map()
// create a canvas
backend.canvas = xgraphics.New (
backend.connection,
image.Rect (
0, 0,
windowWidth,
windowHeight))
backend.bindCanvas()
// attatch graceful close handler
backend.window.WMGracefulClose (func (window *xwindow.Window) {
backend.window.Destroy()