From: Jason Rumney Date: Fri, 14 Sep 2007 23:28:37 +0000 (+0000) Subject: (get_next_msg): Consolidate WM_PAINT messages. X-Git-Tag: emacs-pretest-23.0.90~8295^2~329 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b668cc18b59c232b319d38f613f095646c6029c4;p=emacs.git (get_next_msg): Consolidate WM_PAINT messages. --- diff --git a/src/w32xfns.c b/src/w32xfns.c index 9d50676f921..8c87fde3ef9 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -192,6 +192,47 @@ get_next_msg (lpmsg, bWait) } 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; }