Bug 31080 - DBCS: Buttons truncated in Project Properties "Java Build Path" panel [dialogs]
Summary: DBCS: Buttons truncated in Project Properties "Java Build Path" panel [dialogs]
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.1   Edit
Hardware: PC Linux-GTK
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 30804 31278
Blocks:
  Show dependency tree
 
Reported: 2003-02-06 07:19 EST by SC Development 01 CLA
Modified: 2003-04-15 09:13 EDT (History)
5 users (show)

See Also:


Attachments
Buttons truncated on SCH RedHat8.0 with GTK+2.2 (47.28 KB, image/jpeg)
2003-02-06 07:20 EST, SC Development 01 CLA
no flags Details
Buttons truncated on TCH RedHat8.0 with GTK+2.2 (44.60 KB, image/jpeg)
2003-02-06 07:21 EST, SC Development 01 CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description SC Development 01 CLA 2003-02-06 07:19:37 EST
Reporter: Karen

Language: Tranditional Chinese, Simplied Chinese
        
Build driver: eclipse-SDK-I20030129-gtk
    
Severity: Normal

OS: RedHat8.0 with GTK+2.2

JDK Ver.: IBM JDK1.3.1 + SR3
               
Test case #: 
 
Summary: DBCS: Buttons truncated in Project Properties "Java Build Path" panel

Description:

Steps to recreate problem:
1-Launch Eclipse on RedHat8.0 using GTK2.2 library
2-Right click on Project name, select "Properties" and keep the default window 
size
3-Select "Java Build Path"
3-Check "Source", "Projects", "Libraries" and "Order and Export" views

<<Error>>
The buttons in these views are truncated. Please refer to sch_gtk22.jpg and 
tch_gtk22.jpg.

<<Expected Result>>
The whole buttons should be displayed successfully.

<<Note>>
On English and Korean RedHat8.0 with GTK+2.2 platforms, there's no this bug.
There is no this bug on RedHat8.0 with GTK2.0.6, either.
Comment 1 SC Development 01 CLA 2003-02-06 07:20:47 EST
Created attachment 3315 [details]
Buttons truncated on SCH RedHat8.0 with GTK+2.2
Comment 2 SC Development 01 CLA 2003-02-06 07:21:19 EST
Created attachment 3316 [details]
Buttons truncated on TCH RedHat8.0 with GTK+2.2
Comment 3 Andrew Irvine CLA 2003-02-06 10:21:15 EST
What is your system font? You can check by seeing what your default dialog font 
is.
Comment 4 Tod Creasey CLA 2003-02-06 13:06:37 EST
This is a JDT issue. They should be using the button sizing API provided in 
DialogPage.setButtonLayoutData(Button button) or Dialog.setButtonLayoutData
(Button button).

Be aware that this calculation also uses the dialog font so be sure that the 
dialog font is also in use by the buttons.
Comment 5 Dirk Baeumer CLA 2003-02-06 13:44:11 EST
Tod, why do you think that this has anything to do with using 
DialogPage.setButtonLayoutData(Button button). This method simply sets a grid 
data object. The method sets the width to

data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, 
SWT.DEFAULT, true).x);

Can you please comment on this and move it back to JDT/UI.
Comment 6 Tod Creasey CLA 2003-02-06 13:47:36 EST
This calculation is used to give a reasonable GridData to buttons thoroughtout 
Eclipse - otherwise yoiu have to rely on the default spacing.

The problem here is likely two fold however
1) Buttons are cut off because the list beside them is set to be too large and 
they are truncated

2) The buttons are generally too small and should be sized consistent with the 
rest of Eclipse
Comment 7 Dirk Baeumer CLA 2003-02-06 13:53:41 EST
A question to the reporters. Does the width of the dialog cover the whole width 
of the screen in this case ?
Comment 8 Dirk Baeumer CLA 2003-02-06 14:25:52 EST
And another question. Which font did you use to produce the problem
Comment 9 SC Development 01 CLA 2003-02-06 21:43:33 EST
Yes, the width of the dialog(the default size) cover the whole width of the 
screen and the default dialog font is the System Font: Sans-regular-10 on both 
SCH and TCH platforms.
Comment 10 Dirk Baeumer CLA 2003-02-09 17:28:38 EST
As Tod pointed out the buttons are truncated due to the fact that the list is sized to 
big. There are two SWT PRs which discuss the problems regarding sizing under 
different platforms (bug 30804 and bug 31278). 
 
Strange is the fact that I can't reproduce the bug using build 200302061700 with 
GTK 2.2. Using font Sans-regular-10 produces much smaller buttons on my machine. 
 
Removed DBCS from title since this bug has nothing to do with DBCS  
Comment 11 SC Development 01 CLA 2003-02-12 20:52:33 EST
But, we verified this bug again with M5 and I20030211 build, there're still 
truncated buttons in Java Build Path dialog on SCH and TCH RedHat8.0 GTK+2.2 
platforms.

NOTE: There's no this bug on English RedHat8.0 GTK+2.2 platform.
Comment 12 Dirk Baeumer CLA 2003-02-20 09:11:17 EST
Bug is also related to bug 26900. 
Comment 13 Dirk Baeumer CLA 2003-02-25 13:52:17 EST
The strange thing is that the width of all buttons on this dialog (even OK, CANCEL, 
...) is big.  
 
Asking SWT for an explanation how this can happen. I am not able to produce such 
big buttons under Linux-GTK using a Sans-regular-10 font. Could it be that a SCH 
and TCH installation doesn't have such a font and are using some font mapping 
which produces such big buttons.  
Comment 14 Dirk Baeumer CLA 2003-02-25 13:53:18 EST
Please move back to JDT/UI if an action is required on our side. 
Comment 15 Masayuki Fuse CLA 2003-02-27 22:53:32 EST
I've seen this on Japanese locale as well. This is very important bug to 
support GTK 2.2.
Comment 16 Steve Northover CLA 2003-03-03 15:00:54 EST
FH to investigate and consult with SSQ.  This is a P2.  Don't fix this for 2.1 
unless the fix is trivial.
Comment 17 Steve Northover CLA 2003-03-03 15:06:46 EST
Sorry, I typed the comment into the wrong bug.  We still need to investigate 
but the problem is a DBCS thing because it happens only on a J platform.  

Could it be the dreaded "average character width" is huge on a J platform, 
causing everything to be big?
Comment 18 Masayuki Fuse CLA 2003-03-06 02:28:21 EST
It's not Japanese unique, we've seen on all of DBCS locales.
I've just tried on gtk2.2.1 with ja_JP.eucjp locale, but I got same result. It 
did not occurre on gtk2.0.6.

In gtk2.2.x, Confirm Exit dialog and save workspace progress indicator dialog 
which pop up at exiting eclipse, the width is rendered as long as the screen 
horizontal size, even if no DBCS text in the dialog at all.
Comment 19 Felipe Heidrich CLA 2003-03-06 11:25:32 EST
If you resize the dialog does the buttons layout out correctly ?

I have test this and I can get the situation on Gtk en_US, Motif, and Windows.
It's just a matter of resizing the dialog to a bad size.

Maybe the situation here is that the dialog is open with a wrong size what's bug!
I do believe this is UI bug though.

Please, play resizing the dialog on GTK and Windows and let me know what you
think. For me the problem is that the initial size of the Dialog is bad on GTK.
Comment 20 Masayuki Fuse CLA 2003-03-07 01:27:52 EST
>>>If you resize the dialog does the buttons layout out correctly ?
As for the confirm exit dialog, the buttons layout is not changed on gtk and 
motif. On Windows the dialog is not re-sizable.

It seems that all of decorations are always shown on gtk, I think this is 
another issue. It's odd for me why gtk2.2.x displays enlarged windows size on 
DCBS country locales. I played gtk-demo of gtk2.2, it did not have such a 
problem.
Comment 21 Veronika Irvine CLA 2003-03-07 17:53:43 EST
>It seems that all of decorations are always shown on gtk

This is a result of the window manager interpreting our hints incorrectly and 
there is nothing we can do to change it.  As a result, all shells with a title 
bar are resizable.
Comment 22 Veronika Irvine CLA 2003-03-07 18:00:56 EST
Felipe,
Please talk to Tod about the way that button widths are determined in the UI 
code.

Code is in DialogPage:
/**
* Button width in dialog units (value 61).
*/
public int BUTTON_WIDTH = 61; 

protected GridData setButtonLayoutData(Button button) {
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	data.heightHint = convertVerticalDLUsToPixels
(IDialogConstants.BUTTON_HEIGHT);
	int widthHint = convertHorizontalDLUsToPixels
(IDialogConstants.BUTTON_WIDTH);
	data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, 
SWT.DEFAULT, true).x);
	button.setLayoutData(data);
	return data;
}

Dialog:

	public static int convertHorizontalDLUsToPixels(
		FontMetrics fontMetrics,
		int dlus) {
		// round to the nearest pixel
		return (
			fontMetrics.getAverageCharWidth() * dlus
				+ HORIZONTAL_DIALOG_UNIT_PER_CHAR / 2)
			/ HORIZONTAL_DIALOG_UNIT_PER_CHAR;
	}
Comment 23 Masayuki Fuse CLA 2003-03-28 02:40:19 EST
I've tried to run RC3a on RedHat 9 golden with sun jvm 1.4.1_02, and confirmed
it did not have this error.
Comment 24 Felipe Heidrich CLA 2003-04-14 10:26:06 EDT
Fuse-san, since this problem doesn't happen in RedHat 9.0 can I close this bug ?
Comment 25 Masayuki Fuse CLA 2003-04-14 20:03:28 EDT
Felipe, please go ahead.
Comment 26 Felipe Heidrich CLA 2003-04-15 09:13:10 EDT
fixed in redhat 9.0
(no swt code was released to fix this problem)