From 01f43a03a4cf6e7bfe775b78f8b2117927aa2f6e Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 9 Nov 2022 19:07:40 -0500 Subject: [PATCH] A canvas is now created --- backends/x/x.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/backends/x/x.go b/backends/x/x.go index 517c8b3..a514a65 100644 --- a/backends/x/x.go +++ b/backends/x/x.go @@ -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()