Skip to main content
diff options
authorSimeon Andreev2018-04-13 08:48:11 +0000
committerAndrey Loskutov2018-04-16 17:47:21 +0000
commit802688f6202feab16b46f81f6e6b893c37341a30 (patch)
treee878d49c4b5a1b3668e3d7bcd0593b8b21ad3ae5 /bundles/org.eclipse.swt/Eclipse SWT PI/gtk
parent28b870c25e2d6c47b6d9c9bf84183034f8c2535d (diff)
Bug 533533 - [GTK3] Provide a way to disable fix for Control.print()
Bug 531667 reports a defect in Canvas.pring(GC). The fix provided for 531667 exposes a number of problems which were initially fixed for Bug 421127 (while breaking Canvas.pring(GC)). These problems were originally caused by breaking API change between GTK 3.09 and GTK 3.10. The known problems were fixed also in the context of Bug 531667. Since the GTK API change has massive implications for SWT, there may be further undiscovered defects. This change provides a switch for the fixes done for Bug 531667, as a last resort in case of severe defects that cannot be fixed (e.g. due to a platform which cannot be changed). The fixes can be deactivated by specifying -Dorg.eclipse.swt.internal.gtk.cairoContextReuse=false in the command line arguments of Eclipse (e.g. via eclipse.ini). Change-Id: I7722a1bb4afb4bf54ba2a6a1613c51de867ee0d9 Signed-off-by: Simeon Andreev <>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/gtk')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/
index 85386b46e6..ec0375a0c2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/
@@ -728,6 +728,27 @@ public class OS extends C {
+ /* Fix for Bug 421127 causes regression in Control.print(GC), namely Canvas.print(GC) doesn't work.
+ * To avoid dealing with breaking API change in GTK 3.10, the fix initializes a new Cairo object for each widget.
+ * Fixes for Bug 531667 ensures that the print method functions, by propagating the same Cairo object to each widget.
+ * Since any number of classes can be affected by this change, its not clear whether the present fixes are sufficient.
+ * We therefore add a kill switch for this patch, which is to be used as last resort
+ * in case of widget rendering problems due to incomplete fixes.
+ *
+ * Use by adding a VM argument: -Dorg.eclipse.swt.internal.gtk.cairoContextReuse=false
+ *
+ * For more information see:
+ * Bug 421127, Bug 531667
+ */
+ public static final boolean CAIRO_CONTEXT_REUSE;
+ static {
+ boolean cairoContextReuse = true;
+ if ("false".equals(System.getProperty("org.eclipse.swt.internal.gtk.cairoContextReuse"))) {
+ cairoContextReuse = false;
+ }
+ CAIRO_CONTEXT_REUSE = cairoContextReuse;
+ }
protected static byte [] ascii (String name) {
int length = name.length ();
char [] chars = new char [length];

Back to the top