Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 277268 - [Forms] section header labels are cut off on Gtk
Summary: [Forms] section header labels are cut off on Gtk
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.5   Edit
Hardware: PC Linux
: P2 major (vote)
Target Milestone: 3.5 RC3   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 276402 276613 277575 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-05-21 00:57 EDT by Steffen Pingel CLA
Modified: 2009-06-03 13:15 EDT (History)
11 users (show)

See Also:
snorthov: review+
Silenio_Quarti: review+
eclipse.felipe: review+


Attachments
section header (should be "Description") (3.62 KB, image/png)
2009-05-21 00:58 EDT, Steffen Pingel CLA
no flags Details
scrollbar (21.75 KB, image/png)
2009-05-21 22:48 EDT, Steffen Pingel CLA
no flags Details
Label patch (839 bytes, patch)
2009-05-26 15:16 EDT, Bogdan Gheorghe CLA
no flags Details | Diff
Updated patch (878 bytes, patch)
2009-05-26 16:07 EDT, Bogdan Gheorghe CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Pingel CLA 2009-05-21 00:57:51 EDT
After updating to 3.5RC1 I noticed that the section header labels in the Mylyn Task Editor where cut off (see screenshot). Once I reflow the form, e.g. by toggling one of the sections, all labels appear with the full text.

Not sure if this is a bug in Forms or in SWT.
Comment 1 Steffen Pingel CLA 2009-05-21 00:58:35 EDT
Created attachment 136609 [details]
section header (should be "Description")
Comment 2 Chris Goldthorpe CLA 2009-05-21 01:33:44 EDT
What version were you using before you upgraded?
Comment 3 Steffen Pingel CLA 2009-05-21 01:38:05 EDT
I was running 3.5M7. We are not seeing this problem on other platforms or older versions.
Comment 4 Chris Goldthorpe CLA 2009-05-21 12:21:05 EDT
Nothing has change in UI forms between 3.5M7 and now except for the busy indicator. It's conceivable that a change in another component could have triggered this although it still seems that the problem is most likely in UI forms. There used to be a problem of miscalcualating the width required for the header of a form but that has long been fixed. Do you have a test case or a way that I can reproduce the problem on my own machine.
Comment 5 Steffen Pingel CLA 2009-05-21 16:13:10 EDT
Strange, I consistently see thi in my self-hosted environment on Ubuntu 8.04 with Gtk 2.12.9 but not if I run an installed EPP package. I'll let you know if I find steps to reproduce the problem.
Comment 6 Chris Goldthorpe CLA 2009-05-21 17:18:18 EDT
I was able to reproduce this on Linux using I20090518-2000 and downloading Mylin from the Galileo update site. I'll see if I can see anything obviously wrong although it would still be easier with a smaller test case.
Comment 7 Chris Goldthorpe CLA 2009-05-21 18:27:04 EDT
I just checked out org.eclipse.ui.forms, set the sources to version v20090429-1800, the same as was in 3.5M7 and launched a new run time workbench. The truncation problem is still there, so this is not due to any recent change in ui.forms.
Comment 8 Steffen Pingel CLA 2009-05-21 22:48:52 EDT
Created attachment 136753 [details]
scrollbar
Comment 9 Steffen Pingel CLA 2009-05-21 22:50:58 EDT
I have noticed another oddity in Mylyn that may be related: You can see in the screenshot that the hyperlink in the Task List header pushes the scrollbar of the screen whereas in on other Eclipse versions the hyperlink would be cut off and not affect the width of the Task List
Comment 10 Steffen Pingel CLA 2009-05-22 01:04:01 EDT
Please ignore comment 8 and 9, these problems are caused by entirley unrelated changes in the Task List code.
Comment 11 Chris Goldthorpe CLA 2009-05-22 15:59:39 EDT
Steve, can you think of anything that has changed in platform UI  between M7 and RC1 that could affect how a editor lays out its components, or when layout is called?

I have checked out of CVS org.eclipse.mylyn.tasks.ui to debug the problem but I don't see too many clues as to what is causing the problem. The title is stored in a Label widget and the Mylin code is setting the title on the next line after the constructor for the section is called. I don't see this problem in any other code that uses sections, such as the help view or org.eclipse.ui.forms.examples. I'll continue to debug this to see if I can come up with any insights.

Comment 12 Steve Northover CLA 2009-05-22 16:12:14 EDT
> in platform UI  

Paul can answer this.
Comment 13 Chris Goldthorpe CLA 2009-05-22 17:35:26 EDT
I have some more information from debugging this and putting breakpoints in some of the functions in org.eclipse.swt.widgets.Label. When the editor is initially laid out and computeSize() is called for the label "Attributes" it comes back with a width of 63, which is too short. When I maximize the editor and the size is recomputed for that label the width comes back as 74, which is correct.

My first guess was that the font size had changed however I did not see any calls to Label.setFontDescription() on that label between the first and second time the size was computed. Something is happening between the first and second time that computeSize() is called which is affecting the result but I don't know what it is. Is the Mylin task editor doing anything unusual with fonts?
 
Comment 14 Steffen Pingel CLA 2009-05-22 18:11:09 EDT
We use the standard fonts for the section headers. The only thing that may be different about the task editor is that is disabled redraw on the form in createFormContent() but that shouldn't affect the calls to layout.

Chris, you might want to take a look at the changes made for to this platform bug. It may affect the computSize() of the label:

236808: Errors/Warnings preference page wraps label on linux when it should not
https://bugs.eclipse.org/bugs/show_bug.cgi?id=236808
Comment 15 Chris Goldthorpe CLA 2009-05-22 19:50:34 EDT
I just tried importing the 3.5M7 version of the org.eclipse.sdk plug-in into my workspace but it did not make the problem go away. It seems that when the size is computed incorrectly it is the same incorrect value for each of the labels that gets truncated. "Atrributes","Description" and "Personal Planning" all get truncated to the same length. How sure are you that this is a regression since 3.5M7?
Comment 16 Steffen Pingel CLA 2009-05-22 20:33:11 EDT
I consumed some of the 3.5 SDK milestones by updating through P2 therefore I can't be a 100% sure that it properly updated all plug-ins and features along the way. When I ran RC1 from a freshly installed SDK I noticed the problem for the first time.
Comment 17 Chris Goldthorpe CLA 2009-05-26 00:10:18 EDT
I'm not sure what to do next, there is very little time left in Eclipse 3.5 and we still don't know which component the problem is in, let alone have a fix. I would like to understand why this has recently started failing and see if there is a workaround. If you can create a smaller test case that would help a lot.
Comment 18 Steffen Pingel CLA 2009-05-26 04:02:44 EDT
I can reproduce the problem with this snippet:

public class FormLabel {

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());

		Form form = new Form(shell, SWT.NONE);
		form.getBody().setLayout(new GridLayout());
		
		FormToolkit toolkit = new FormToolkit(display);
		Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TWISTIE);
		section.setText("Attributes");
		
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}

}
Comment 19 Steffen Pingel CLA 2009-05-26 04:27:03 EDT
If I run the snippet on 3.5M7 the layout is okay. If I run it on Eclipse 3.5RC1 the label is cut off. The version of org.eclipse.ui.forms does not make a difference.

If I revert changes made for bug 236808 in SWT the problem goes away. I'll reopen that bug.
Comment 20 Chris Goldthorpe CLA 2009-05-26 13:39:13 EDT
Reassigning to SWT since this regression was introduced by a change in SWT. I have confirmed that the problem occurs with an RC1 or later version of org.eclipse.sdk.gtk.linux.x86, the M7 version works fine. I will join Steffen in requesting that SWT back out the fix for bug 236808 (assuming that this was the bug that caused the regression).

I have also raised the priority because this is a regression which causes existing UI to not display correctly and will likely affect more users.
Comment 21 Steve Northover CLA 2009-05-26 13:50:22 EDT
Bogdan, did you ever track this down?
Comment 22 Bogdan Gheorghe CLA 2009-05-26 14:41:06 EDT
Yes - the new code in Label.computeSize is OK, but we need to call forceResize to get GTK to update to the current label size before attempting to measure the text length. I'll attach a patch here.
Comment 23 Bogdan Gheorghe CLA 2009-05-26 15:16:29 EDT
Created attachment 137211 [details]
Label patch
Comment 24 Bogdan Gheorghe CLA 2009-05-26 16:07:09 EDT
Created attachment 137218 [details]
Updated patch
Comment 25 Bogdan Gheorghe CLA 2009-05-26 16:12:36 EDT
Fixed in HEAD > 20090526
Comment 26 Ian Bull CLA 2009-05-27 00:43:54 EDT
This appears to work with: I20090526-2000
Comment 27 Chris Goldthorpe CLA 2009-05-27 13:28:32 EDT
Verified in I20090526-2000. I was able to bring up the task editor and it displayed correctly. This was on the same machine where I had reproduced the bug using I20090518-2000.
Comment 28 Chris Goldthorpe CLA 2009-05-27 13:36:45 EDT
*** Bug 276402 has been marked as a duplicate of this bug. ***
Comment 29 Chris Goldthorpe CLA 2009-05-27 13:39:19 EDT
*** Bug 276613 has been marked as a duplicate of this bug. ***
Comment 30 Steffen Pingel CLA 2009-06-03 13:15:15 EDT
*** Bug 277575 has been marked as a duplicate of this bug. ***