Example #1
0
func newGradientWindow(width, height int) {
	win := createWindow()
	xproto.ConfigureWindow(
		X.Conn(), win, xproto.ConfigWindowWidth|xproto.ConfigWindowHeight,
		[]uint32{uint32(width), uint32(height)})
	xwindow.Listen(X, win, xproto.EventMaskStructureNotify)

	xproto.MapWindow(X.Conn(), win)

	xgraphics.PaintImg(X, win, gradient(width, height))

	xevent.ConfigureNotifyFun(
		func(X *xgbutil.XUtil, ev xevent.ConfigureNotifyEvent) {
			img := gradient(int(ev.Width), int(ev.Height))
			log.Printf("Painting new image (%d, %d)", ev.Width, ev.Height)
			xgraphics.PaintImg(X, win, img)
		}).Connect(X, win)
}
Example #2
0
func (w *Window) FlushImage() {
	if w.closed {
		return
	}
	xgraphics.PaintImg(w.xu, w.id, w.buffer)
}