Ok, so printf("%u\n", XAllocID(dpy)); printf("%u\n", XAllocID(dpy)); gives me 58720257 0 and no XFlush(), XSync(), XFlushGC() between the two changes that. I'm using XAllocIDs() instead which seems to work properly, but is this expected behaviour for XAllocID()?