Project: SWT
Bug 288468 [Widgets] Setup of event.detail argument incorrect in Tree paintItem event under Cocoa
Reported: 2009-09-03 09:09:30 | Status: resolved fixed

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 Build Identifier: 3.5 Line 1140 of the SWT cocoa source file org/eclipse/swt/widgets/Tree.java sets up the SWT.SELECTED bit incorrectly for the event parameter for the PaintItem event of the Tree. Currently the line reads: if (drawSelection) event.detail |= SWT.SELECTED; The drawSelection variable however is the result of a previous EraseItem event. According to the spec (and the behavior under Windows) the SWT.SELECTED bit should be set in event.detail when the respective tree cell is actually selected, even when a precious call to EraseItem prevented the drawing of a selection background for the cell by clearing the bit. Reproducible: Always Can be easily fixed by changing line 1140 of the SWT cocoa source file org/eclipse/swt/widgets/Tree.java from if (drawSelection) event.detail |= SWT.SELECTED; to if (isSelected) event.detail |= SWT.SELECTED;

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java