Skip to main content
diff options
authorEric Williams2018-06-20 13:58:02 +0000
committerEric Williams2018-07-03 15:29:35 +0000
commit089e20dd5dd1cda17e7f3cad6f6838423b58074f (patch)
treef680efaebe44d6bbdeeec451af2fbb815445c1a1 /bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.h
parent5b059c753c4145ff08c434a27ea7776a245547bc (diff)
Bug 475784: half transparent composite as overlay composite not work
with gtk3 ATTEMPT #2: fix regression from original patch. Instead of keeping the NO_BACKGROUND flag, cache it in Control and remove it as intended in Composite.checkStyle(). Original commit message: We have to handle some corner case drawing situations, since Control.setRegion() now uses Cairo entirely. In particular, we need to handle the case where a user is using an SWT.NO_BACKGROUND Composite as an overlay. This means the Composite has a region set, and a paintListener attached to perform custom drawing. Previously, Control.setRegion() "physically" manipulate the Composite's GdkWindow to prevent any drawing outside the given region. Since Cairo is now responsible for drawing the set region we have to handle this geometry ourselves. This patch fixes numerous issues all rolled into one. First, it adds a field in GCData which corresponds to the Cairo region. This is set in gtk_draw() so that GC.fill* methods will clip themselves accordingly and not fill where they aren't supposed to. Second, it checks for a PaintListener, NO_BACKGROUND, and a region being set. If these conditions are met, we draw a transparent background in Control.drawBackground() to ensure the region and custom drawing succeeds. Last, we copy the region at the Cairo level to ensure there are no crashes when calling setRegion(region) followed by region.dispose(). Tested on GTK3.22 using the snippet attached and a child Eclipse. No AllNonBrowser JUnit tests fail. Change-Id: I6a6245052e9756d6c9bdd0e46ef20a74413acc6b Signed-off-by: Eric Williams <>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.h')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.h
index 2554ab6068..fecaef595a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.h
@@ -32,6 +32,7 @@
#define cairo_ps_surface_set_size_LIB LIB_CAIRO
#define cairo_region_num_rectangles_LIB LIB_CAIRO
#define cairo_region_contains_point_LIB LIB_CAIRO
+#define cairo_region_copy_LIB LIB_CAIRO
#define cairo_region_get_rectangle_LIB LIB_CAIRO
#define cairo_surface_set_device_scale_LIB LIB_CAIRO
#define cairo_surface_get_device_scale_LIB LIB_CAIRO

Back to the top