Skip to content

Commit d21764f

Browse files
committed
[GTK] Temporary workaround for LineNumberRulerColumn regression #2740
This temporarily reverts the image creation for the LineNumberRulerColumn on Linux to the state before initializing the buffer image with an ImageGcDrawer. This does currently not work properly for all use cases on Linux/GTK because of an issue with the initialization of Image based on existing ImageData due to the usage of cairo_image_surface_create. Linux-specific workaround for #2740
1 parent 25cd854 commit d21764f

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java

+17-12
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
import org.eclipse.swt.widgets.Control;
4343
import org.eclipse.swt.widgets.Display;
4444

45+
import org.eclipse.core.runtime.Platform.OS;
46+
4547
import org.eclipse.jface.text.BadLocationException;
4648
import org.eclipse.jface.text.IDocument;
4749
import org.eclipse.jface.text.IRegion;
@@ -687,24 +689,27 @@ private void doubleBufferPaint(GC dest) {
687689
}
688690

689691
if (fBuffer == null) {
690-
fBuffer= newFullBufferImage(size);
692+
newFullBufferImage(size);
691693
} else {
692694
doPaint(visibleLines, size);
693695
}
694696
dest.drawImage(fBuffer, 0, 0);
695697
}
696698

697-
private Image newFullBufferImage(Point size) {
698-
ImageGcDrawer imageGcDrawer= (gc, imageWidth, imageHeight) -> {
699-
ILineRange lines= JFaceTextUtil.getVisibleModelLines(fCachedTextViewer);
700-
if (lines == null) {
701-
return;
702-
}
703-
// We redraw everything; paint directly into the buffer
704-
initializeGC(gc, 0, 0, imageWidth, imageHeight);
705-
doPaint(gc, lines);
706-
};
707-
return new Image(fCanvas.getDisplay(), imageGcDrawer, size.x, size.y);
699+
private void newFullBufferImage(Point size) {
700+
if (OS.isLinux()) {
701+
fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
702+
ILineRange visibleLines= JFaceTextUtil.getVisibleModelLines(fCachedTextViewer);
703+
doPaint(visibleLines, size);
704+
} else {
705+
ImageGcDrawer imageGcDrawer= (gc, imageWidth, imageHeight) -> {
706+
ILineRange lines= JFaceTextUtil.getVisibleModelLines(fCachedTextViewer);
707+
// We redraw everything; paint directly into the buffer
708+
initializeGC(gc, 0, 0, imageWidth, imageHeight);
709+
doPaint(gc, lines);
710+
};
711+
fBuffer= new Image(fCanvas.getDisplay(), imageGcDrawer, size.x, size.y);
712+
}
708713
}
709714

710715
private void doPaint(ILineRange visibleLines, Point size) {

0 commit comments

Comments
 (0)