diff options
author | Eric Williams | 2016-03-09 19:43:24 +0000 |
---|---|---|
committer | Eric Williams | 2016-03-14 15:07:43 +0000 |
commit | ddba351a9ef141e70b1dde8c86e9f49a972beb1a (patch) | |
tree | 0b65c7c3cb54202dfa5aaf2da64a835e70e35e39 /org.eclipse.jface.text | |
parent | e04b0f8285c60f3f072a522b8f1dd9c8f40d3b9d (diff) | |
download | eclipse.platform.text-ddba351a9ef141e70b1dde8c86e9f49a972beb1a.tar.gz eclipse.platform.text-ddba351a9ef141e70b1dde8c86e9f49a972beb1a.tar.xz eclipse.platform.text-ddba351a9ef141e70b1dde8c86e9f49a972beb1a.zip |
Bug 467499 - [GTK3] Issue in layout of editors ("leaking" rulers)I20160314-1400
This bug was primarily caused by Canvases being re-painted without
checking for visibility of said Canvas. In SWT, there are methods in
Control called redraw() and update(), which re-paint a Control. These
methods include visibility checks to prevent double painting. Paint
event cases stay the same, as paint events are not triggered by
invisible regions.
Instead of creating a new GC and calling doubleBufferPaint(), we can use
redraw() and update() to re-paint editor rulers. This is already done on
OSX, so the code already exists. Only the if statement needs to be
edited to allow the code path to exist on GTK.
This will also increase performance, as creating a new GC involves
native machinery which is relatively expensive compared to using
existing Controls.
Tested on GTK3.18, 3.16, 3.14, and 2.24. No SWT tests ran as this is a
platform patch. Windows and OSX behavior is unaffected.
Change-Id: I5e7d21cb68ccc67999abdc83071c8f64376748b4
Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'org.eclipse.jface.text')
5 files changed, 17 insertions, 10 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java index e0676c3c9ad..fc0643f651c 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -44,6 +44,8 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; +import org.eclipse.jface.util.Util; + import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; @@ -849,7 +851,7 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul @Override public void redraw() { if (fCanvas != null && !fCanvas.isDisposed()) { - if (VerticalRuler.IS_MAC_BUG_298936) { + if (VerticalRuler.IS_MAC_BUG_298936 || Util.isGtk()) { fCanvas.redraw(); fCanvas.update(); } else { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java index a613503d17d..e3bf5233218 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -34,6 +34,7 @@ import org.eclipse.core.runtime.Assert; import org.eclipse.jface.internal.text.revisions.RevisionPainter; import org.eclipse.jface.internal.text.source.DiffPainter; +import org.eclipse.jface.util.Util; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.text.BadLocationException; @@ -321,7 +322,7 @@ public final class ChangeRulerColumn implements IChangeRulerColumn, IRevisionRul public void redraw() { if (fCachedTextViewer != null && fCanvas != null && !fCanvas.isDisposed()) { - if (VerticalRuler.IS_MAC_BUG_298936) { + if (VerticalRuler.IS_MAC_BUG_298936 || Util.isGtk()) { fCanvas.redraw(); fCanvas.update(); } else { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java index 4513e962a58..5536b2d9c9e 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -40,6 +40,8 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.TypedListener; +import org.eclipse.jface.util.Util; + import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; @@ -873,7 +875,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { } if (fCachedTextViewer != null && fCanvas != null && !fCanvas.isDisposed()) { - if (VerticalRuler.IS_MAC_BUG_298936) { + if (VerticalRuler.IS_MAC_BUG_298936 || Util.isGtk()) { fCanvas.redraw(); fCanvas.update(); } else { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java index 7f060da4b5f..803a1ef32de 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -44,6 +44,8 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.ScrollBar; +import org.eclipse.jface.util.Util; + import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; @@ -900,7 +902,7 @@ public class OverviewRuler implements IOverviewRulerExtension, IOverviewRuler { return; if (fCanvas != null && !fCanvas.isDisposed()) { - if (VerticalRuler.IS_MAC_BUG_298936) { + if (VerticalRuler.IS_MAC_BUG_298936 || Util.isGtk()) { fCanvas.redraw(); fCanvas.update(); } else { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java index b710fafa605..21e2e21c700 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -466,7 +466,7 @@ public final class VerticalRuler implements IVerticalRuler, IVerticalRulerExtens */ private void redraw() { if (fCanvas != null && !fCanvas.isDisposed()) { - if (IS_MAC_BUG_298936) { + if (IS_MAC_BUG_298936 || Util.isGtk()) { fCanvas.redraw(); fCanvas.update(); } else { |