[Win32SS]
authorJames Tabor <james.tabor@reactos.org>
Thu, 24 Nov 2016 18:18:28 +0000 (18:18 +0000)
committerJames Tabor <james.tabor@reactos.org>
Thu, 24 Nov 2016 18:18:28 +0000 (18:18 +0000)
- HAX : Fix paint message spam. See CORE-12169 and related issues.

svn path=/trunk/; revision=73372

reactos/win32ss/user/ntuser/message.c
reactos/win32ss/user/ntuser/painting.c
reactos/win32ss/user/ntuser/painting.h

index 9e7c6b7..9ef8467 100644 (file)
@@ -789,8 +789,8 @@ IntDispatchMessage(PMSG pMsg)
     {
         Window->state2 &= ~WNDS2_WMPAINTSENT;
         /* send a WM_ERASEBKGND if the non-client area is still invalid */
-        ERR("Message WM_PAINT\n");
-        co_IntPaintWindows( Window, RDW_NOCHILDREN, FALSE );
+        ERR("Message WM_PAINT count %d Internal Paint Set? %s\n",Window->head.pti->cPaintsReady, Window->state & WNDS_INTERNALPAINT ? "TRUE" : "FALSE");
+        IntPaintWindow( Window );
     }
 
     return retval;
index 9f071fc..309dd64 100644 (file)
@@ -1157,6 +1157,36 @@ IntFindWindowToRepaint(PWND Window, PTHREADINFO Thread)
    return Window;
 }
 
+//
+// Hax around internal painting of windows.
+//
+VOID FASTCALL
+IntPaintWindow( PWND Window )
+{
+   // Handle normal painting.
+   co_IntPaintWindows( Window, RDW_NOCHILDREN, FALSE );
+
+   // Hack to prevent more spamming from misbehaving application.
+   // Handle it like a begin/end paint
+   if (Window->hrgnUpdate != NULL)
+   {
+      ERR("HAX hrgnUpdate not NULL! Dec Paint Count!\n");
+      MsqDecPaintCountQueue(Window->head.pti);
+      IntGdiSetRegionOwner(Window->hrgnUpdate, GDI_OBJ_HMGR_POWNED);
+      GreDeleteObject(Window->hrgnUpdate);
+      Window->state &= ~WNDS_UPDATEDIRTY;
+      Window->hrgnUpdate = NULL;
+   }
+   else
+   {
+      if (!(Window->state & WNDS_INTERNALPAINT))
+      {
+         ERR("HAX WNDS_INTERNALPAINT not set! Dec Paint Count!\n");
+         MsqDecPaintCountQueue(Window->head.pti);
+      }
+   }
+}
+
 BOOL FASTCALL
 IntGetPaintMessage(
    PWND Window,
index 5c8ef72..e885028 100644 (file)
@@ -40,3 +40,4 @@ BOOL FASTCALL IntIsWindowDrawable(PWND);
 BOOL UserDrawCaption(PWND,HDC,RECTL*,HFONT,HICON,const PUNICODE_STRING,UINT);
 VOID FASTCALL UpdateThreadWindows(PWND,PTHREADINFO,HRGN);
 VOID FASTCALL UserSyncAndPaintWindows(PWND pWnd, ULONG Flags);
+VOID FASTCALL IntPaintWindow(PWND);