summaryrefslogtreecommitdiff
path: root/src/w32xfns.c
diff options
context:
space:
mode:
authorJason Rumney <jasonr@gnu.org>2007-09-14 23:28:37 +0000
committerJason Rumney <jasonr@gnu.org>2007-09-14 23:28:37 +0000
commitb668cc18b59c232b319d38f613f095646c6029c4 (patch)
tree43ddc049cdcb27d98a7c7470754a1d5da2867f4e /src/w32xfns.c
parent5c2c9c79dc64e2a2074b1fe7690525e3a832fa1e (diff)
downloademacs-b668cc18b59c232b319d38f613f095646c6029c4.tar.gz
(get_next_msg): Consolidate WM_PAINT messages.
Diffstat (limited to 'src/w32xfns.c')
-rw-r--r--src/w32xfns.c41
1 files changed, 41 insertions, 0 deletions
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;
}