X11: How to delay repainting until all events are processed?
问题 I'm writing a program that has an X11/Xlib interface, and my event processing loop looks like this: while (XNextEvent(display, &ev) >= 0) { switch (ev.type) { // Process events } } The problem is when the window is resized, I get a bunch of Expose events telling me which parts of the window to redraw. If I redraw them in direct response to the events, the redraw operation lags terribly because it is so slow (after resizing I get to see all the newly invalidated rectangles refresh one by one.)