code: func newGradientWindow(X *xgbutil.XUtil, width, height int,
  	start, end color.RGBA) {
  
  	// Generate a new window id.
  	win, err := xwindow.Generate(X)
  	if err != nil {
  		log.Fatal(err)
  	}
  
  	// Create the window and die if it fails.
  	err = win.CreateChecked(X.RootWin(), 0, 0, width, height, 0)
  	if err != nil {
  		log.Fatal(err)
  	}
  
  	// In order to get ConfigureNotify events, we must listen to the window
  	// using the 'StructureNotify' mask.
  	win.Listen(xproto.EventMaskStructureNotify)
  
  	// Paint the initial gradient to the window and then map the window.
  	paintGradient(X, win.Id, width, height, start, end)
  	win.Map()
  
  	xevent.ConfigureNotifyFun(
  		func(X *xgbutil.XUtil, ev xevent.ConfigureNotifyEvent) {
  			// If the width and height have not changed, skip this one.
  			if int(ev.Width) == width && int(ev.Height) == height {
  				return
  			}
  
  			// Compress ConfigureNotify events so that we don't lag when
  			// drawing gradients in response.
  			ev = compressConfigureNotify(X, ev)
  
  			// Update the width and height and paint the gradient image.
  			width, height = int(ev.Width), int(ev.Height)
  			paintGradient(X, win.Id, width, height, start, end)
  		}).Connect(X, win.Id)
  }
docs: // newGradientWindow creates a new X window, paints the initial gradient
  // image, and listens for ConfigureNotify events. (A new gradient image must
  // be painted in response to each ConfigureNotify event, since a
  // ConfigureNotify event corresponds to a change in the window's geometry.)