# HG changeset patch # User Jason Rumney # Date 1189812517 0 # Node ID 524f82fbf3efd5f09d90175e24622dcc50d6ffdb # Parent 8be09e8e2c972592d78647d3871facc96bcdf5be (get_next_msg): Consolidate WM_PAINT messages. diff -r 8be09e8e2c97 -r 524f82fbf3ef src/w32xfns.c --- a/src/w32xfns.c Thu Sep 13 13:37:26 2007 +0000 +++ b/src/w32xfns.c Fri Sep 14 23:28:37 2007 +0000 @@ -192,6 +192,47 @@ } nQueue--; + /* Consolidate WM_PAINT messages to optimise redrawing. */ + if (lpmsg->msg.message == WM_PAINT && nQueue) + { + int_msg * lpCur = lpHead; + int_msg * lpPrev = NULL; + int_msg * lpNext = NULL; + + while (lpCur && nQueue) + { + lpNext = lpCur->lpNext; + if (lpCur->w32msg.msg.message == WM_PAINT) + { + /* Remove this message from the queue. */ + if (lpPrev) + lpPrev->lpNext = lpNext; + else + lpHead = lpNext; + + if (lpCur == lpTail) + lpTail = lpPrev; + + /* Adjust clip rectangle to cover both. */ + if (!UnionRect (&(lpmsg->rect), &(lpmsg->rect), + &(lpCur->w32msg.rect))) + { + SetRectEmpty(&(lpmsg->rect)); + } + + myfree (lpCur); + + nQueue--; + + lpCur = lpNext; + } + else + { + lpPrev = lpCur; + lpCur = lpNext; + } + } + } bRet = TRUE; }