From: Robin Dunn Date: Sat, 7 May 2005 19:12:23 +0000 (+0000) Subject: Patch #1197009 [wxMSW] Proper repainting when resizing X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3fca879ce0ab3b75b232e0407f14137c20ccf9eb?ds=sidebyside Patch #1197009 [wxMSW] Proper repainting when resizing git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33982 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 9048400d30..8b74242c95 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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) ) {