Skip to content

Commit ffc6bba

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 4a38dc8 commit ffc6bba

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

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

Lines changed: 15 additions & 12 deletions
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,25 @@ private void doubleBufferPaint(GC dest) {
687689
}
688690

689691
if (fBuffer == null) {
690-
fBuffer= newFullBufferImage(size);
692+
newFullBufferImage(visibleLines, 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(ILineRange visibleLines, Point size) {
700+
if (OS.isLinux()) {
701+
fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
702+
doPaint(visibleLines, size);
703+
} else {
704+
ImageGcDrawer imageGcDrawer= (gc, imageWidth, imageHeight) -> {
705+
// We redraw everything; paint directly into the buffer
706+
initializeGC(gc, 0, 0, imageWidth, imageHeight);
707+
doPaint(gc, visibleLines);
708+
};
709+
fBuffer= new Image(fCanvas.getDisplay(), imageGcDrawer, size.x, size.y);
710+
}
708711
}
709712

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

0 commit comments

Comments
 (0)