]> git.saurik.com Git - wxWidgets.git/commitdiff
Patch #1197009 [wxMSW] Proper repainting when resizing
authorRobin Dunn <robin@alldunn.com>
Sat, 7 May 2005 19:12:23 +0000 (19:12 +0000)
committerRobin Dunn <robin@alldunn.com>
Sat, 7 May 2005 19:12:23 +0000 (19:12 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33982 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

index 9048400d3005d8e816304e0ce24459c01aa85f7d..8b74242c95be3a74fc607ab98b2b99bf7d381d70 100644 (file)
@@ -1555,7 +1555,7 @@ void wxWindowMSW::DoMoveWindow(int x, int y, int width, int height)
     HDWP hdwp = parent && !IsTopLevel() ? (HDWP)parent->m_hDWP : NULL;
 #else
     HDWP hdwp = 0;
-#endif    
+#endif
 
     wxMoveWindowDeferred(hdwp, this, GetHwnd(), x, y, width, height);
 
@@ -2310,6 +2310,31 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
             break;
 #endif // !__WXWINCE__
 
+        case WM_WINDOWPOSCHANGED:
+            {
+                WINDOWPOS *lpPos = (WINDOWPOS *)lParam;
+
+                if ( !(lpPos->flags & SWP_NOSIZE) )
+                {
+                    RECT rc;
+                    ::GetClientRect(GetHwnd(), &rc);
+
+                    AutoHRGN hrgnClient(::CreateRectRgnIndirect(&rc));
+                    AutoHRGN hrgnNew(::CreateRectRgn(lpPos->x,  lpPos->y,
+                                                     lpPos->cx, lpPos->cy));
+                    AutoHRGN hrgn(::CreateRectRgn(0, 0, 0, 0));
+
+                    // we need to invalidate any new exposed areas here
+                    // to force them to repaint
+                    if ( ::CombineRgn(hrgn, hrgnNew, hrgnClient, RGN_DIFF) != NULLREGION )
+                        ::InvalidateRgn(GetHwnd(), hrgn, TRUE);
+                    if ( ::CombineRgn(hrgn, hrgnClient, hrgnNew, RGN_DIFF) != NULLREGION )
+                        ::InvalidateRgn(GetHwnd(), hrgn, TRUE);
+
+                }
+            }
+            break;
+
 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
         case WM_ACTIVATEAPP:
             // This implicitly sends a wxEVT_ACTIVATE_APP event
@@ -3511,7 +3536,7 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd),
     if ( !::GetCursorPosWinCE(&pt))
 #else
     if ( !::GetCursorPos(&pt) )
-#endif        
+#endif
     {
         wxLogLastError(wxT("GetCursorPos"));
     }
@@ -4144,13 +4169,13 @@ bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam)
         numChildren ++;
     }
 
-    // Protect against valid m_hDWP being overwritten    
+    // Protect against valid m_hDWP being overwritten
     bool useDefer = false;
 
     if ( numChildren > 1 )
     {
         if (!m_hDWP)
-        {        
+        {
             m_hDWP = (WXHANDLE)::BeginDeferWindowPos(numChildren);
             if ( !m_hDWP )
             {
@@ -4203,7 +4228,7 @@ bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam)
         // may have depending on what the users EVT_SIZE handler does...)
         HDWP hDWP = (HDWP)m_hDWP;
         m_hDWP = NULL;
-        
+
         // do put all child controls in place at once
         if ( !::EndDeferWindowPos(hDWP) )
         {