]> git.eshelyaron.com Git - emacs.git/commitdiff
(get_next_msg): Consolidate WM_PAINT messages.
authorJason Rumney <jasonr@gnu.org>
Fri, 14 Sep 2007 23:28:37 +0000 (23:28 +0000)
committerJason Rumney <jasonr@gnu.org>
Fri, 14 Sep 2007 23:28:37 +0000 (23:28 +0000)
src/w32xfns.c

index 9d50676f9214f83636d0edf3a8cb59877c90bb45..8c87fde3ef9e044e7f2c540aab0402b0aa87730b 100644 (file)
@@ -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;
     }