| Summary: | On Linux in RTL mode Tree.getItem(Point) gives incorrect results | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Chris Goldthorpe <cgold> | ||||||
| Component: | SWT | Assignee: | Felipe Heidrich <eclipse.felipe> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | daniel_megert, eclipse.felipe, Mike_Wilson, Silenio_Quarti | ||||||
| Version: | 3.7 | Keywords: | polish | ||||||
| Target Milestone: | 3.7 M7 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Chris Goldthorpe
Created attachment 193104 [details]
plug-in which reproduces the problem
I have marked this as a polish item because it causes problems for the help view in RTL mode - see Bug 342617. Silenio, any idea what's going on here? Works for me on Fedora 14 (gtk 2.22),
Chris please try my snippet and let me know if it works or it fails on your machine.
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
public class PR342648 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Listener listener = new Listener () {
public void handleEvent(Event event) {
Tree tree = (Tree)event.widget;
Point p = new Point(event.x, event.y);
TreeItem item = tree.getItem(p);
System.out.println("point " + p + " item " + item);
}
};
final Tree tree = new Tree(shell, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
for (int i = 0; i < 4; i++) {
TreeItem item = new TreeItem(tree, SWT.NONE);
item.setText("root " + i);
for (int j = 0; j < 4; j++) {
TreeItem subItem = new TreeItem(item, SWT.NONE);
subItem.setText("item " + j);
for (int k = 0; k < 4; k++) {
TreeItem subsubItem = new TreeItem(subItem, SWT.NONE);
subsubItem.setText("subsubitem " + k);
}
}
}
tree.addListener(SWT.MouseDown, listener);
final Tree treeRTL = new Tree(shell, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.RIGHT_TO_LEFT);
for (int i = 0; i < 4; i++) {
TreeItem item = new TreeItem(treeRTL, SWT.NONE);
item.setText("rootRTL " + i);
for (int j = 0; j < 4; j++) {
TreeItem subItem = new TreeItem(item, SWT.NONE);
subItem.setText("itemRTL " + j);
for (int k = 0; k < 4; k++) {
TreeItem subsubItem = new TreeItem(subItem, SWT.NONE);
subsubItem.setText("subsubitemRTL " + k);
}
}
}
treeRTL.addListener(SWT.MouseDown, listener);
shell.setSize(400, 400);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
On my machine the test fails in the following way: If I click on an expander in the RTL side of the screen I do not see "item null" as expected, instead I see item TreeItem. Created attachment 193870 [details]
patch
Fixed in HEAD Verified in I20110421-1800 *** Bug 342617 has been marked as a duplicate of this bug. *** |