You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wxGTK3/wxGTK3-3.0.2-paint-clipping...

41 lines
1.4 KiB

From cd8811bf142172c4920ba13a685472ceb405ef78 Mon Sep 17 00:00:00 2001
From: Paul Cornett <paulcor@users.noreply.github.com>
Date: Thu, 3 Nov 2016 09:14:30 -0700
Subject: [PATCH] Fix paint clipping region with GTK+ >= 3.20
Apparently the clip is no longer set properly. Fixes wxDC::Clear() overwriting
areas outside the window. Problem can be seen in the Audacity toolbars.
(cherry picked from commit bca7313499c11a6d7fecd2baa355ac09fd3ac83b)
---
src/gtk/window.cpp | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp
index 41fffb4..96789de 100644
--- a/src/gtk/window.cpp
+++ b/src/gtk/window.cpp
@@ -4099,9 +4099,21 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region)
#endif
{
#ifdef __WXGTK3__
- m_paintContext = cr;
+ {
+ cairo_region_t* region = gdk_window_get_clip_region(gtk_widget_get_window(m_wxwindow));
+ cairo_rectangle_int_t rect;
+ cairo_region_get_extents(region, &rect);
+ cairo_region_destroy(region);
+ cairo_rectangle(cr, rect.x, rect.y, rect.width, rect.height);
+ cairo_clip(cr);
+ }
double x1, y1, x2, y2;
cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
+
+ if (x1 >= x2 || y1 >= y2)
+ return;
+
+ m_paintContext = cr;
m_updateRegion = wxRegion(int(x1), int(y1), int(x2 - x1), int(y2 - y1));
#else // !__WXGTK3__
m_updateRegion = wxRegion(region);