x-backend #2
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user