Here's another small patch, written by Phil Landman (one of our
programmers) for PeekMessage that solves the problem of winelib apps
taking 99% of the cpu when they're idle. It's just a counter that waits
a little bit if we haven't recieved any messages in a while. You'll
see... Anyway, it works well, we only use 5% when we're in the background.

I'm going to have to give you guys little bits as I come across them.
I'm still working on fixing some of the bugs introduced in canvas when I
picked up the latest wine. So, I'm trying to get beta3 out the door...
--- /devel/corelwineVirgin/corelwine/windows/message.c  Mon May 15 10:48:44 2000
+++ windows/message.c   Tue May 23 21:31:39 2000
@@ -1137,6 +1137,7 @@
 static BOOL MSG_PeekMessage( int type, LPMSG msg, HWND hwnd, 
                              DWORD first, DWORD last, WORD flags, BOOL peek )
 {
+    static long gTimerCount=0;
     int mask;
     MESSAGEQUEUE *msgQueue;
     HQUEUE16 hQueue;
@@ -1296,6 +1297,14 @@
         msgQueue->wakeMask = mask;
         QUEUE_WaitBits( mask, INFINITE );
         QUEUE_Unlock( msgQueue );
+
+       gTimerCount++;
+               
+       if(gTimerCount>10)
+               {
+               //MessageBeep(-1);
+               Sleep(500);
+               }
     }
 
     WIN_RestoreWndsLock(iWndsLocks);
@@ -1320,6 +1329,9 @@
        else if (message == WM_KEYUP || message == WM_SYSKEYUP)
            QueueKeyStateTable[msg->wParam & 0xff] &= ~0x80;
     }
+
+    if (msg->message!=WM_TIMER)
+            gTimerCount=0;
 
     if (peek)
         return TRUE;

Reply via email to