Bug 110310 - javaw.exe.manifest causes irregularities in SWT rendering on Windows XP
Summary: javaw.exe.manifest causes irregularities in SWT rendering on Windows XP
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Veronika Irvine CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-22 08:54 EDT by Daniel M. Schumacher CLA
Modified: 2006-04-03 13:54 EDT (History)
3 users (show)

See Also:


Attachments
Plugin with view that exposes this problem. (7.70 KB, application/octet-stream)
2005-09-22 08:56 EDT, Daniel M. Schumacher CLA
no flags Details
View shown when no Windows XP manifest is present (26.44 KB, image/jpeg)
2005-09-22 08:57 EDT, Daniel M. Schumacher CLA
no flags Details
View shown when javaw.exe.manifest is used (16.99 KB, image/jpeg)
2005-09-22 08:57 EDT, Daniel M. Schumacher CLA
no flags Details
View shown when java.exe.manifest is used (15.48 KB, image/jpeg)
2005-09-22 08:57 EDT, Daniel M. Schumacher CLA
no flags Details
View shown when both javaw.exe.manifest and java.exe.manifest are used (26.93 KB, image/jpeg)
2005-09-22 08:58 EDT, Daniel M. Schumacher CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel M. Schumacher CLA 2005-09-22 08:54:28 EDT
Making use of the javaw.exe.manifest file to apply the Windows XP look-and-
feel to SWT controls is causing some weird rendering behavior in some SWT 
controls in the attached plugin.  Some effects are seen when 
javaw.exe.manifest is copied to the JRE (1.4.2) bin directory, and others are 
seen if javaw.exe.manifest is copied and renamed to java.exe.manifest.  Having 
both files present (java.exe.manifest and javaw.exe.manifest) causes both 
types of problems to appear at once.  

Attached plugin makes use of a TabFolder and also a ScrolledForm 
(org.eclipse.ui.forms.widgets) containing Label and Text controls.  

No manifest file used:  
All controls rendered properly.  No problems here, except that Windows XP look-
and-feel is not used.

javaw.exe.manifest file used: 
Windows XP look-and-feel doesn't seem to be applied used, but the Text 
controls in the ScrolledForm have become varying heights, resulting in the 
text within to be cut off.  Tabs on TabFolder are unaffected.

java.exe.manifest file used: 
Windows XP look-and-feel is applied, but the tabs on the TabFolder are 
rendered upside down.  Text controls in the ScrolledForm are unaffected.

Both manifest files used: 
Windows XP look-and-feel is applied, but now both problems exist.

See attached screenshots for more detail (affected areas highlighted).  

Plugin (including source) is also attached.

This error was originally found on an Eclipse 3.0.2-based product, but was 
checked against 3.1 and found there as well.  If any fix is proposed, would 
like to have a version for 3.0.2 as well.
Comment 1 Daniel M. Schumacher CLA 2005-09-22 08:56:26 EDT
Created attachment 27387 [details]
Plugin with view that exposes this problem.

Open view with Window > Show View > Other... > Test Views > View 1.

Source is included in the plugin.
Comment 2 Daniel M. Schumacher CLA 2005-09-22 08:57:11 EDT
Created attachment 27388 [details]
View shown when no Windows XP manifest is present
Comment 3 Daniel M. Schumacher CLA 2005-09-22 08:57:30 EDT
Created attachment 27389 [details]
View shown when javaw.exe.manifest is used
Comment 4 Daniel M. Schumacher CLA 2005-09-22 08:57:53 EDT
Created attachment 27390 [details]
View shown when java.exe.manifest is used
Comment 5 Daniel M. Schumacher CLA 2005-09-22 08:58:13 EDT
Created attachment 27391 [details]
View shown when both javaw.exe.manifest and java.exe.manifest are used
Comment 6 Veronika Irvine CLA 2005-09-22 11:58:38 EDT
The appearance of the tabs with the java.exe.manifest is a duplicate of bug
87540.  You should add yourself to this bug report.

As far as the problem you are seeing when javaw.exe.manifest is present, this
seems to be a bug a UI Forms.  UI Forms is using the file "javaw.exe.manifest"
as an indicator that the Windows Theme is in effect  This is incorrect. The
manifest file must match the executable used to launch the application.  In your
case you are launching with java (not javaw) and therefore the UI forms should
be looking for java.exe.manifest.  Alternatively, you could try launching your
application with javaw instead of java.

However, I think you are going to have trouble even with javaw.  The reason is
that your FormAttatchments are using fixed heights for the labels and text
widgets.  This is bad use of the FormLayout.  If the user has specified a
different default font (which happens with different WIndows themes) or is
running on a different operating system, these fixed heights will be wrong and
most likely text will be clipped.  I have modified your form attatchments below
to use the default height of the widgets

	final Label addressLabel_1 = toolkit.createLabel(composite_3, "Name", SWT.NONE);
	addressLabel_1.setText("Name");
	final FormData formData_11_1 = new FormData();
	formData_11_1.left = new FormAttachment(0, 10);
	formData_11_1.top = new FormAttachment(0, 5);
	addressLabel_1.setLayoutData(formData_11_1);
	
	name = toolkit.createText(composite_3, null, SWT.NONE);
	final FormData formData_12_6 = new FormData();
	formData_12_6.left = new FormAttachment(0, 75);
	formData_12_6.right = new FormAttachment(0, 155); // ? 155
	formData_12_6.top = new FormAttachment(addressLabel_1, 0, SWT.CENTER);
	name.setLayoutData(formData_12_6);
	name.setText("AAAAA");
	
	final Label addressLabel = toolkit.createLabel(composite_3, "Address", SWT.NONE);
	addressLabel.setText("Address");
	final FormData formData_11 = new FormData();
	formData_11.left = new FormAttachment(0, 10);
	formData_11.top = new FormAttachment(addressLabel_1, 5);
	addressLabel.setLayoutData(formData_11);
	
	address_1 = toolkit.createText(composite_3, null, SWT.NONE);
	final FormData formData_12 = new FormData();
	formData_12.left = new FormAttachment(0, 75);
	formData_12.right = new FormAttachment(0, 235); // ?235
	formData_12.top = new FormAttachment(addressLabel, 0, SWT.CENTER);
	address_1.setLayoutData(formData_12);
	address_1.setText("AAAAA");
	
	final Label addressLabel_2 = toolkit.createLabel(composite_3, "Country", SWT.NONE);
	addressLabel_2.setText("Country");
	final FormData formData_11_2 = new FormData();
	formData_11_2.left = new FormAttachment(0, 10);
	formData_11_2.top = new FormAttachment(addressLabel, 5);
	addressLabel_2.setLayoutData(formData_11_2);
	
	country = toolkit.createText(composite_3, null, SWT.NONE);
	final FormData formData_12_1 = new FormData();
	formData_12_1.left = new FormAttachment(0, 75);
	formData_12_1.right = new FormAttachment(address_1, 0, SWT.RIGHT); 
	formData_12_1.top = new FormAttachment(addressLabel_2, 0, SWT.CENTER);
	country.setLayoutData(formData_12_1);
	country.setText("AAAAA");
	
	final Label addressLabel_3 = toolkit.createLabel(composite_3, "Telephone",
SWT.NONE);
	addressLabel_3.setText("Telephone");
	final FormData formData_11_3 = new FormData();
	formData_11_3.left = new FormAttachment(0, 10);
	formData_11_3.top = new FormAttachment(addressLabel_2, 5);
	addressLabel_3.setLayoutData(formData_11_3);
	
	telephone = toolkit.createText(composite_3, null, SWT.NONE);
	final FormData formData_12_2 = new FormData();
	formData_12_2.left = new FormAttachment(0, 75);
	formData_12_2.right = new FormAttachment(0, 200); // 200?
	formData_12_2.top = new FormAttachment(addressLabel_3, 0, SWT.CENTER);
	telephone.setLayoutData(formData_12_2);
	telephone.setText("AAAAA");
	
	final Label addressLabel_3_1 = toolkit.createLabel(composite_3, "Contact",
SWT.NONE);
	addressLabel_3_1.setText("Contact");
	final FormData formData_11_3_1 = new FormData();
	formData_11_3_1.left = new FormAttachment(0, 10);
	formData_11_3_1.top = new FormAttachment(addressLabel_3, 5);
	addressLabel_3_1.setLayoutData(formData_11_3_1);		
	
	contact = toolkit.createText(composite_3, null, SWT.NONE);
	final FormData formData_12_3 = new FormData();
	formData_12_3.left = new FormAttachment(0, 75);
	formData_12_3.right = new FormAttachment(telephone, 0, SWT.RIGHT);
	formData_12_3.top = new FormAttachment(addressLabel_3_1, 0, SWT.CENTER);
	contact.setLayoutData(formData_12_3);
	contact.setText("AAAAA");
	
	final Label addressLabel_3_2 = toolkit.createLabel(composite_3, "Title", SWT.NONE);
	addressLabel_3_2.setText("Title");
	final FormData formData_11_3_2 = new FormData();
	formData_11_3_2.left = new FormAttachment(0, 10);
	formData_11_3_2.top = new FormAttachment(addressLabel_3_1, 5);
	addressLabel_3_2.setLayoutData(formData_11_3_2);
	
	title = toolkit.createText(composite_3, null, SWT.NONE);
	final FormData formData_12_4 = new FormData();
	formData_12_4.left = new FormAttachment(0, 75);
	formData_12_4.right = new FormAttachment(address_1, 0, SWT.RIGHT);
	formData_12_4.top = new FormAttachment(addressLabel_3_2, 0, SWT.CENTER);
	title.setLayoutData(formData_12_4);
	title.setText("AAAAA")
Comment 7 Daniel M. Schumacher CLA 2005-09-22 12:38:47 EDT
While I agree that a best practice here would not be setting the heights of 
the text and label widgets, the code that this was based on was originally 
generated by a visual SWT editor (Instantiations SWT Designer), which seems to 
have automatically put the heights on the controls.  In the screenshots 
provided, the font has not changed, but the heights certainly seem to have 
changed.  

So are you stating that the height "squishing" (for lack of a better term) is 
not a bug, but a design issue?

If that's the case, then the bugs here are the tab issue (dup of bug 87540, 
like you mentioned) and the UI forms issue where it assumes javaw.exe.manifest 
is always the theme indicator (instead of checking for the actual java 
executable used during launch).  Is this correct?  
Comment 8 Veronika Irvine CLA 2005-09-29 12:35:35 EDT
The height of the widget is determined not only by the font size. It is up to 
the theme how much padding it wishes to put around the text, sometimes space 
is left for a groovy effect when the widget is "hot" (mouse enters the bounds 
of the widget) etc.

For you, on one hand borders were drawn by the OS and on the other hand they 
were drawn by UI Forms. If the code was generated with UIForms drawing the 
border then the widget was probably sized to not have borders (created with 
style SWT.NONE) and UIForms would draw the border on the parent.  Now you run 
the code with the manifest and the borders are included in the widget (created 
with style SWT.BORDER).  The space needed by the widget for the borders is 
subtracted from the total height making the internal text area squished.

In general, hard coding sizes is an extremely non-portable way of writing a 
GUI.  Are you sure Instantiations SWT Designer always hard codes these values?
Comment 9 Daniel M. Schumacher CLA 2005-09-29 12:47:57 EDT
Not sure about SWT Designer.  The code originated from a customer using that 
tool.
Comment 10 Billy Biggs CLA 2005-12-08 18:19:03 EST
Veronika, was a bug ever filed about the UI forms issue in comment #6?  I noticed that bug 105056 describes the same issue, and I bet there are more.
Comment 11 Veronika Irvine CLA 2006-04-03 12:15:50 EDT
Bug 125779 addresses the issue over java.exe.manifest versus javaw.exe.manifest
Comment 12 Veronika Irvine CLA 2006-04-03 13:54:21 EDT
I am going to close this bug report.  I think the issues are addressed by bug 87540 and bug 125779.  Please reopen if you disagree.