]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
freeze whole window for TLW
[wxWidgets.git] / src / msw / window.cpp
index 0ebb93aa599e036d279ed77d1dbe9b6cce83667e..da62175805dfcb6b06a7923017254dd9b0182a54 100644 (file)
@@ -4224,6 +4224,8 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd),
             y = pt.y;
         ScreenToClient(&x, &y);
         wxSetCursorEvent event(x, y);
             y = pt.y;
         ScreenToClient(&x, &y);
         wxSetCursorEvent event(x, y);
+        event.SetId(GetId());
+        event.SetEventObject(this);
 
         bool processedEvtSetCursor = HandleWindowEvent(event);
         if ( processedEvtSetCursor && event.HasCursor() )
 
         bool processedEvtSetCursor = HandleWindowEvent(event);
         if ( processedEvtSetCursor && event.HasCursor() )
@@ -4739,7 +4741,7 @@ wxColour wxWindowMSW::MSWGetThemeColour(const wchar_t *themeName,
                                         int themePart,
                                         int themeState,
                                         MSWThemeColour themeColour,
                                         int themePart,
                                         int themeState,
                                         MSWThemeColour themeColour,
-                                        wxSystemColour fallback)
+                                        wxSystemColour fallback) const
 {
 #if wxUSE_UXTHEME
     const wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
 {
 #if wxUSE_UXTHEME
     const wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
@@ -4763,7 +4765,7 @@ wxColour wxWindowMSW::MSWGetThemeColour(const wchar_t *themeName,
                 wxFAIL_MSG(wxT("unsupported theme colour"));
         };
 
                 wxFAIL_MSG(wxT("unsupported theme colour"));
         };
 
-        wxUxThemeHandle hTheme(this, themeName);
+        wxUxThemeHandle hTheme((const wxWindow *)this, themeName);
         COLORREF col;
         HRESULT hr = theme->GetThemeColor
                             (
         COLORREF col;
         HRESULT hr = theme->GetThemeColor
                             (
@@ -4796,6 +4798,15 @@ wxColour wxWindowMSW::MSWGetThemeColour(const wchar_t *themeName,
 // painting
 // ---------------------------------------------------------------------------
 
 // painting
 // ---------------------------------------------------------------------------
 
+// this variable is used to check that a paint event handler which processed
+// the event did create a wxPaintDC inside its code and called BeginPaint() to
+// validate the invalidated window area as otherwise we'd keep getting an
+// endless stream of WM_PAINT messages for this window resulting in a lot of
+// difficult to debug problems (e.g. impossibility to repaint other windows,
+// lack of timer and idle events and so on)
+extern bool wxDidCreatePaintDC;
+bool wxDidCreatePaintDC = false;
+
 bool wxWindowMSW::HandlePaint()
 {
     HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
 bool wxWindowMSW::HandlePaint()
 {
     HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
@@ -4810,11 +4821,20 @@ bool wxWindowMSW::HandlePaint()
 
     m_updateRegion = wxRegion((WXHRGN) hRegion);
 
 
     m_updateRegion = wxRegion((WXHRGN) hRegion);
 
+    wxDidCreatePaintDC = false;
+
     wxPaintEvent event(m_windowId);
     event.SetEventObject(this);
 
     bool processed = HandleWindowEvent(event);
 
     wxPaintEvent event(m_windowId);
     event.SetEventObject(this);
 
     bool processed = HandleWindowEvent(event);
 
+    if ( processed && !wxDidCreatePaintDC )
+    {
+        // do call MSWDefWindowProc() to validate the update region to avoid
+        // the problems mentioned above
+        processed = false;
+    }
+
     // note that we must generate NC event after the normal one as otherwise
     // BeginPaint() will happily overwrite our decorations with the background
     // colour
     // note that we must generate NC event after the normal one as otherwise
     // BeginPaint() will happily overwrite our decorations with the background
     // colour