Skip to content

Commit 2f682b0

Browse files
committed
Also remove SWT.BACKGROUND when handling SWT.EraseItem
Removing the bit is necessary so that Linux and Mac do not overwrite the background color later. This was noticed by @Christopher-Hermann during a review and the problem showed up in the AST view.
1 parent 8763def commit 2f682b0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnViewerSelectionColorListener.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,10 @@ private void handleEraseItem(Event event) {
196196
int rowWidth = (event.widget instanceof Scrollable s) ? s.getClientArea().width : event.width;
197197
gc.fillRectangle(0, event.y, rowWidth, event.height);
198198

199-
// Prevent native selection drawing
200-
event.detail &= ~SWT.SELECTED;
199+
// Remove SELECTED and BACKGROUND flags to prevent native drawing from
200+
// overwriting our custom colors. Removing SWT.BACKGROUND is necessary for Linux
201+
// and Mac (Windows works just fine even when the bit has not been removed
202+
event.detail &= ~(SWT.SELECTED & SWT.BACKGROUND);
201203
}
202204

203205
private void handlePaintItem(Event event) {

0 commit comments

Comments
 (0)