code: func compressConfigureNotify(X *xgbutil.XUtil,
  	ev xevent.ConfigureNotifyEvent) xevent.ConfigureNotifyEvent {
  
  	// Catch up with all X events as much as we can.
  	X.Sync()
  	xevent.Read(X, false) // non-blocking
  
  	laste := ev
  	for i, ee := range xevent.Peek(X) {
  		if ee.Err != nil {
  			continue
  		}
  		if cn, ok := ee.Event.(xproto.ConfigureNotifyEvent); ok {
  			// Only compress this ConfigureNotify if it matches the window
  			// of the original event.
  			if ev.Event == cn.Event && ev.Window == cn.Window {
  				laste = xevent.ConfigureNotifyEvent{&cn}
  				defer func(i int) { xevent.DequeueAt(X, i) }(i)
  			}
  		}
  	}
  	return laste
  }
docs: // compressConfigureNotify "compresses" incoming ConfigureNotify events so that
  // event processing never lags behind gradient drawing.
  // This is necessary because drawing a gradient cannot keep up with the rate
  // at which ConfigureNotify events are sent to us, thereby creating a "lag".
  // Compression works by examining the "future" of the event queue, and skipping
  // ahead to the most recent ConfigureNotify event and throwing away the rest.
  //
  // A more detailed treatment of event compression can be found in
  // xgbutil/examples/compress-events.