Skip to content

Commit 7abb694

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 4a8b5fc commit 7abb694

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

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

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

206207
private void handlePaintItem(Event event) {

0 commit comments

Comments
 (0)