From bcacb15d3647ce38855a79f2ceaa882f18a315ab Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Fri, 6 Jun 2003 20:12:39 +0000 Subject: [PATCH] Fixed Refresh to clip update rectangles to the visible area of a (scrolled) window. If there are many invisible/partly visible rectangles in the update region GTK+-1.2.10 starts complaining about bad match errors and soon crashes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20966 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 10 ++++++++++ src/gtk1/window.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 1cda4f11ba..29ecd4b3fe 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -3627,6 +3627,16 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect ) #ifndef __WXGTK20__ if (g_isIdle) wxapp_install_idle_handler(); + wxRect myRect (0, 0, m_wxwindow->allocation.width, + m_wxwindow->allocation.height); + + if (rect){ + myRect.Intersect(*rect); + if (!myRect.width || !myRect.height) + // nothing to do, rectangle is empty + return; + rect = &myRect; + } if (eraseBackground && m_wxwindow && m_wxwindow->window) { diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 1cda4f11ba..29ecd4b3fe 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -3627,6 +3627,16 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect ) #ifndef __WXGTK20__ if (g_isIdle) wxapp_install_idle_handler(); + wxRect myRect (0, 0, m_wxwindow->allocation.width, + m_wxwindow->allocation.height); + + if (rect){ + myRect.Intersect(*rect); + if (!myRect.width || !myRect.height) + // nothing to do, rectangle is empty + return; + rect = &myRect; + } if (eraseBackground && m_wxwindow && m_wxwindow->window) {