| Summary: | [GTK] Virtual Tree does not resize correctly horizontally | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Pawel Piech <pawel.1.piech> | ||||||
| Component: | SWT | Assignee: | Eric Williams <ericwill> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | darin.eclipse, eclipse.felipe, ericwill, markus.kell.r | ||||||
| Version: | 3.5 | Keywords: | triaged | ||||||
| Target Milestone: | 4.9 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux-GTK | ||||||||
| See Also: |
https://git.eclipse.org/r/123478 https://git.eclipse.org/r/123542 https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=2bd7cc57d6f8db85984adca7abc84236618f0b2d https://git.eclipse.org/c/platform/eclipse.platform.swt.binaries.git/commit/?id=4a1a10fc2fc99f6ee7f995f5952e40da40b3dede |
||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 252677 | ||||||||
| Attachments: |
|
||||||||
Created attachment 119979 [details]
Patch with suggested fix.
This patch fixes the problem by causing the column size to be updated after an item's text/image/font has been set. It seems safe to me, but I can't claim to be an SWT expert...
>Our tree viewer implementation calls setTesxt() and setImage()
>in a separate update from setData().
When exactly do you call setText/setImage ? Why can't you call it from SetData ?
Can you provide a simple snippet for us to reproduce the problem here ? Thanks (In reply to comment #2) > When exactly do you call setText/setImage ? Why can't you call it from SetData > ? The debugger views allow the label information to be calculated asynchronously (e.g. in a job), based on the element that was set to the item. (In reply to comment #3) > Can you provide a simple snippet for us to reproduce the problem here ? Thanks Will do. The following snippet, which is a modified virtual tree snippet demonstrates the problem. After the view appears, expand some elements and resize the shell to make some of the elements not fit. The scroll bars do not appear as they should public class Bug258192 { public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout (new FillLayout()); final Tree tree = new Tree(shell, SWT.VIRTUAL | SWT.BORDER); tree.addListener(SWT.SetData, new Listener() { public void handleEvent(Event event) { final TreeItem item = (TreeItem)event.item; TreeItem parentItem = item.getParentItem(); String text = null; if (parentItem == null) { text = "node "+tree.indexOf(item); } else { text = parentItem.getText()+" - "+parentItem.indexOf(item); } item.setData(text); item.setItemCount(10); display.asyncExec(new Runnable() { public void run() { if (!item.isDisposed()) { item.setText(item.getData().toString()); } } }); } }); tree.setItemCount(20); shell.setSize(400, 300); shell.open(); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } } ping It seems that this problem has cropped up from the recent versions of GTK (might be from 2.14 or 2.16). (In reply to comment #7) > It seems that this problem has cropped up from the recent versions of GTK > (might be from 2.14 or 2.16). Does that mean that my suggested fix may be accepted? ;-) ping Still reproducible on GTK3.22, 4.8 M7, and Fedora 28. New Gerrit change created: https://git.eclipse.org/r/123478 (In reply to Eclipse Genie from comment #11) > New Gerrit change created: https://git.eclipse.org/r/123478 Will merge in 4.9. New Gerrit change created: https://git.eclipse.org/r/123542 Gerrit change https://git.eclipse.org/r/123478 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=2bd7cc57d6f8db85984adca7abc84236618f0b2d Gerrit change https://git.eclipse.org/r/123542 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.binaries.git/commit/?id=4a1a10fc2fc99f6ee7f995f5952e40da40b3dede Patches for bumping versions merged along with the actual patch as well. |
Created attachment 119978 [details] Image of the Debug view with missing scroll bar. I ran into a problem with the virtual tree on Linux. Our tree viewer implementation calls setTesxt() and setImage() in a separate update from setData(). However, the width of the column is calculated only right after setData() is called, which can leave with some of the items being cut off in the tree. See the attached screenshot. To easily reproduce the problem: - Make sure there is something in the Debug view - Make the debug view narrow enough so that there is a horizontal scroll bar. - Close and reopen the Debug view. - The text is cut off, but there is no horizontal scroll bar.