From 57351df0a60b1f2302f66a8d687285c3f5a54fd0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 5 Sep 2002 10:54:30 +0000 Subject: [PATCH 1/1] fix Union(empty rect) bug git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16982 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/region.cpp | 6 ++++++ src/gtk1/region.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp index e1394a48b4..7ca7653e2a 100644 --- a/src/gtk/region.cpp +++ b/src/gtk/region.cpp @@ -185,6 +185,12 @@ void wxRegion::Clear() bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { + // workaround for a strange GTK/X11 bug: taking union with an empty + // rectangle results in an empty region which is definitely not what we + // want + if ( !width || !height ) + return TRUE; + GdkRectangle rect; rect.x = x; rect.y = y; diff --git a/src/gtk1/region.cpp b/src/gtk1/region.cpp index e1394a48b4..7ca7653e2a 100644 --- a/src/gtk1/region.cpp +++ b/src/gtk1/region.cpp @@ -185,6 +185,12 @@ void wxRegion::Clear() bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { + // workaround for a strange GTK/X11 bug: taking union with an empty + // rectangle results in an empty region which is definitely not what we + // want + if ( !width || !height ) + return TRUE; + GdkRectangle rect; rect.x = x; rect.y = y; -- 2.45.2