Trying to sync X11 application with vertical retrace.

Hi!

I'm trying to write an X11 application with the Xext extension and I'd like to update window content during/after the vertical retrace so they appear smoothly and don't shear.

I've found xsync-flip.c at Index of /xorgsync which should do the trick but that produces:

X Error of failed request: XSyncBadCounter
Major opcode of failed request: 132 (SYNC)
Minor opcode of failed request: 5 (X_SyncQueryCounter)
Counter in failed request: 0x2400001
Serial number of failed request: 17
Current serial number in output stream: 17

Does anyone have a working example using XSyncAwait & company?

Thanks.