Bug 242144 - [Progress] Progress view does not shrink
: [Progress] Progress view does not shrink
Status: REOPENED
Product: Platform
Classification: Eclipse
Component: UI
: 3.4
: PC Linux
: P3 minor with 2 votes (vote)
: ---
Assigned To: Platform-UI-Inbox
:
:
:
:
:
:
  Show dependency tree
 
Reported: 2008-07-26 06:55 EDT by Hasan Ceylan
Modified: 2012-04-01 08:58 EDT (History)
9 users (show)

See Also:


Attachments
screenshot (67.18 KB, image/png)
2008-07-30 14:01 EDT, Hasan Ceylan
no flags Details
Screenshot of broken progress view (19.00 KB, image/png)
2008-09-05 05:18 EDT, Andrey Loskutov
no flags Details
Vertical scroll bar is not always available in all platforms(windows/linux/solaris) (15.18 KB, image/jpeg)
2009-07-06 08:37 EDT, Srimathi
no flags Details
A Sample project to recreate the bug (7.95 KB, application/zip)
2010-02-18 03:40 EST, Hasan Ceylan
no flags Details
Patch to resolve the issue (731 bytes, text/plain)
2010-06-13 19:15 EDT, Hasan Ceylan
no flags Details
Combined patch for both FormLayout and Link (1.58 KB, patch)
2011-11-06 17:48 EST, Andrey Loskutov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hasan Ceylan 2008-07-26 06:55:04 EDT
Build ID: I20080617-2000

Steps To Reproduce:
Progress view doesn't shrink when there is just a few or no jobs running. 

I think it would be a good idea to shrink the viewport to fit.


More information:
Comment 1 Remy Suen 2008-07-26 07:59:39 EDT
Can you elaborate on what exactly you mean by "shrink"? Did you mean close or
resize? Or something else? Can you take a screenshot?
Comment 2 Eric Moffatt 2008-07-30 13:52:52 EDT
I'm presuming you mean the progress -dialog-, view's sizes are completely
determined by the stack that they're in.

AFAIK, the dialog currently doesn't 'auto-size' at all (but gets a scroll bar
when needed). UI's should avoid changing element's sizes 'on the fly' generally
as it induces visual flicker...
Comment 3 Hasan Ceylan 2008-07-30 14:01:27 EDT
Created attachment 108767 [details]
screenshot

Progress item sizes and the view port of the view is absurdly large
Comment 4 Hasan Ceylan 2008-08-15 04:36:56 EDT
The package manager has the same problem.  Horizontal scrollbar is visible
while everything fits in the screen 
Could this be indeed in or related to SWT?

Comment 5 Andrey Loskutov 2008-09-05 05:18:04 EDT
Created attachment 111787 [details]
Screenshot of broken progress view

Currently on Linux progress view is very hard to use. In my eyes it is just
broken. 

There are always some jobs which for some strange reasons are rendered with the
too huge hight, so that it is impossible to see other jobs without resizing the
view or scrolling it. But scrolling doesn't help too because if there are many
different jobs working, their order changes and you still can't see what's
going on...

So the main use case of the progress view (show what's going on) is broken on
Linux.

Please consider to raise severity of this issue.
Comment 6 Tod Creasey 2008-09-05 08:38:57 EDT
Are you using ubuntu?
Comment 7 Andrey Loskutov 2008-09-05 09:05:44 EDT
I'm using RHEL 5.1, uname -a:

Linux socbl422 2.6.18-53.1.4.el5 #1 SMP Wed Nov 14 10:37:27 EST 2007 x86_64
x86_64 x86_64 GNU/Linux
Comment 8 Hasan Ceylan 2008-09-05 10:33:31 EDT
In my case it is Fedora 9 and Fedora 10 Alpha...
Comment 9 Srimathi 2009-07-06 08:37:33 EDT
Created attachment 140860 [details]
Vertical scroll bar is not always available in all
platforms(windows/linux/solaris)
Comment 10 Srimathi 2009-07-06 08:42:22 EDT
Only those job entries without progress bar endup in the layout issue. (shown
in first two screenshots)
That is the job entry without progress bar takes more real estate that the
entry with progress bar. This issue happens in linux and solaris machines.

Adding to this there is no vertcal sroll bar added to the view, which makes it
difficult to view all the jobs currently running. (shown in third screenshot)
This scrolling issue is there in windows/linux/solaris machines.
Comment 11 Susan McCourt 2009-07-09 19:39:15 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 12 Hasan Ceylan 2010-01-30 23:32:59 EST
This seems to be resolved in eclipse 3.6M5...
Comment 13 Prakash G.R. 2010-02-01 02:21:10 EST
(In reply to comment #12)
> This seems to be resolved in eclipse 3.6M5...

There were some changes in the layout of ProgressView few months back. That
might have fixed this one.
Comment 14 Hasan Ceylan 2010-02-12 18:18:40 EST
Hello Prakash,

I was actually wrong. The way it exposes it self is as follows
1) A Job is started
2) Before Job declared the beginTask, DetailedProgressViewer created the item
and went through the layout()
3) Job either called beginTask or kept running without that or slept on
something

But actually the guilty part was the org.eclipse.swt.Link which during
computeSize (int wHint, int hHint, boolean changed), sets the width to 1px if
wHint == 0.

Changing layout.setWidth (1) to layout.setWidth (Integer.MAX_VALUE) fixes the
issue...

Regards,
Hasan Ceylan
Comment 15 Hasan Ceylan 2010-02-18 03:40:54 EST
Created attachment 159400 [details]
A Sample project to recreate the bug
Comment 16 Hasan Ceylan 2010-06-02 14:49:11 EDT
Why no action is being taken when there's the fix for the bug?
Comment 17 Prakash G.R. 2010-06-03 00:43:56 EDT
(In reply to comment #16)
> Why no action is being taken when there's the fix for the bug?

   Because there are other bugs with high priority that needs to be attended.
Feel free to attach a patch, I'll try to push this into 3.7
Comment 18 Hasan Ceylan 2010-06-13 19:15:02 EDT
Created attachment 171809 [details]
Patch to resolve the issue

This is the patch that resolves the issue.

Sorry for taking some time to submit this.
Hope this makes into 3.6 and the two year annoyance (Yes, I am obsessive :) )
is gone...
Comment 19 Prakash G.R. 2010-06-14 00:27:11 EDT
3.6 is at the door. We can't push any changes. Will try for 3.6.1
Comment 20 Hasan Ceylan 2010-06-14 05:38:30 EDT
(In reply to comment #19)
> 3.6 is at the door. We can't push any changes. Will try for 3.6.1

Thanks Prakash...
Comment 21 Prakash G.R. 2010-08-03 02:20:39 EDT
This isn't a serious bug that has to be pushed to the maintenance stream. I'd
like to target to HEAD rather.
Comment 22 Prakash G.R. 2010-11-09 04:38:13 EST
Assigning to SWT for comments. Is the width calculation of the Link widget
correct?
Comment 23 Andrey Loskutov 2011-02-08 08:18:02 EST
Can we please get a review of the patch and a fix in 3.7?
Comment 24 Felipe Heidrich 2011-02-08 10:19:04 EST
(In reply to comment #23)
> Can we please get a review of the patch and a fix in 3.7?

It is wrong, the application is calling computeSize with 0,SWT.DEFAULT right ?
The current code causes the link to wrap with width zero. With the fix the link
will no wrap (not respecting the wHint what was set).
Comment 25 Andrey Loskutov 2011-02-08 12:44:26 EST
(In reply to comment #24)
> (In reply to comment #23)
> > Can we please get a review of the patch and a fix in 3.7?
> 
> It is wrong, the application is calling computeSize with 0,SWT.DEFAULT right ?
> The current code causes the link to wrap with width zero. With the fix the link
> will no wrap (not respecting the wHint what was set).

Sorry, I'm missing the point - is the patch ok or not?
Comment 26 Felipe Heidrich 2011-02-08 13:14:32 EST
(In reply to comment #25)
> Sorry, I'm missing the point - is the patch ok or not?

the patch is wrong.
Comment 27 Andrey Loskutov 2011-11-06 17:00:04 EST
(In reply to comment #24)
> (In reply to comment #23)
> > Can we please get a review of the patch and a fix in 3.7?
> 
> It is wrong, the application is calling computeSize with 0,SWT.DEFAULT right ?
> The current code causes the link to wrap with width zero. With the fix the link
> will no wrap (not respecting the wHint what was set).

I finally got some time to play with it. Felipe, I really can not understand
your comment above. The only thing the patch does is to call now

layout.setWidth (Integer.MAX_VALUE);

instead of calling 

layout.setWidth (1);

The later one (current HEAD in Git, since ) caused the return value to contain
HUGE height values for Link objects with the "0" width.

This happens in case application provided either value smaller -1 or 0 as  a
width hint. The last one is exactly the case in the concrete implementation of
the FormLayout->layout()->FormData->computeSize() which is used in the progress
view.

So for me the bug would be fixed with the proposed patch, and it will NOT break
any wrapping code.

BTW, looking to the origin of the code in question, the layout.setWidth (1);
line was added to fix bug 85236 (do not call layout with the "0" width, commit
id 5b3ec303ac0d2af543a2733646c7864facee0355), and this bug is a side effect of
this fix.


Looking on the code in FormLayout used for the progress view, another solution
would be to fix the caller code in the FormLayout.layout:319 to

int currentWidth = Math.max (SWT.DEFAULT, x2 - x1 - trim);

instead of 

int currentWidth = Math.max (0, x2 - x1 - trim);

which has exact the same effect on the progress bar.

So either of patches above solves the progress view issue for me. As I'm not
the code owner, I can hardly decide which one (if any) is better.

So what I would ask here: please, can you review both patches again and apply
the fix for 3.7.2 and 3.8.

Thanks!

BTW my configuration is:

Ubuntu 11.04 64 bit 
dpkg -s libgtk2.0-0|grep '^Version'
Version: 2.24.4-0ubuntu2
Comment 28 Andrey Loskutov 2011-11-06 17:48:54 EST
Created attachment 206502 [details]
Combined patch for both FormLayout and Link

The Link change is from Hasan Ceylan's patch.
Comment 29 Andrey Loskutov 2011-12-03 17:22:42 EST
(In reply to comment #28)
> Created attachment 206502 [details]
> Combined patch for both FormLayout and Link

Since committing the patch I'm running the patched Eclipse 3.7.1 8 hours 5 days
in a week with no problems so far (RHEL 5.3 64 bit). The issue is solved for me
and I didn't noticed ANY regression. Sure I didn't run all UI tests, but
looking at the patch there shouldn't be any problems.

Could please somebody from SWT team re-evaluate the patch and apply it to the
3.8 stream?
Thanks!
Andrey
Comment 30 Felipe Heidrich 2011-12-05 16:02:51 EST
I reviewed the patch, I believe both solutions are wrong. I will explain:

First read the documentation for computeSize().
Note that wHint and hHint should be >= 0 or SWT.DEFAULT (-1)
and that SWT.DEFAULT (-1)  is special constant, means return the preferred
size.

Also from the doc: 
" The width hint and height hint arguments
 * allow the caller to ask a control questions such as "Given a particular
 * width, how high does the control need to be to show all of the contents?"

For the Link widget, if hHint is zero (or one) it causes the link to wrap every
characters to new line (thus the large value for height that you see). if hHint
is SWT.DEFAULT (-1) then computeSize() returns the size of the control without
any wrapping. This is correct behaviour.

The current code in FormLayout also seems correct to me:
int currentWidth = Math.max (0, x2 - x1 - trim);
It is just max with zero to avoid negative number.

changing that to SWT.DEFAULT (-1) is wrong, as I said, SWT.DEFAULT is special
case complete different than 0 or positive values.

Moving back to UI.
Comment 31 Andrey Loskutov 2011-12-05 18:10:14 EST
(In reply to comment #30)
> I reviewed the patch, I believe both solutions are wrong. I will explain:
>[...]

> The current code in FormLayout also seems correct to me:
> int currentWidth = Math.max (0, x2 - x1 - trim);
> It is just max with zero to avoid negative number.
> 
> changing that to SWT.DEFAULT (-1) is wrong, as I said, SWT.DEFAULT is special
> case complete different than 0 or positive values.

At least here I can't fully agree. I think calling computeSize with -1/-1 from
FormLayout.layout could be a possible fix (at least on GTK).

Just debugging Progress view on Linux (put conditional breakpoint currentWidth
== 0 at line 320 in FormLayout) - one can see that Link.computeSize() returns
(0,300) if called with wHint == 0, hHint == -1, and would return proper width
and hight (e.g. 150, 15) if called with wHint == -1, hHint == -1 as proposed in
the patch. And one also can see that there are LOT of calls where wHint == 0...

As you pointed, the "0" was probably chosen as the default "safe" value, but it
leads to the logically wrong assumption in the Link code that FormLayout want
wrap the Link as if there were no space anymore. What one can see from the
debugger, is that there are four children of FormLayout in the ProgressInfoItem
(Label, Label, ToolBar, Link), and that the Link is the last (right) one. If it
has no attachment on the right, its width should be calculated to the default
value, as defined in the FormLayout class doc:

 * If a side is not given an attachment, it is defined as not being attached
 * to anything, causing the child to remain at its preferred size

But by using "0" we just trying to "wrap" the Link over "0 pixel width" instead
of calculating it's default size. We see that at least on GTK this leads to
really huge progress entries (width = 0, hight = 300), and that on other
platforms everything seems to be ok. 

So for me it sounds like a GTK specific bug which need to be addressed either
in FormLayout as proposed by the patch (might be with the restriction to the
GTK platform only) or at ProgressInfoItem which creates and manages those
"Link" instances.

> Moving back to UI

Might be it would help if two (or more :) SWT + UI developers talk *together*
about this annoying bug?

Could one please consider to increase the severity of this issue? The whole
Eclipse story with Progress view is broken on Linux just because of this
"minor" problem of Link size calculations.
Comment 32 Felipe Heidrich 2011-12-06 12:32:28 EST
does the problem only happen on Linux ?
Link#computeSize() should work the same way on all platforms.

Can you post a simple testcase (SWT only) showing the problem you described
with FormLayout ? Thanks.
Comment 33 Hasan Ceylan 2011-12-07 03:02:09 EST
I had provided a test case in the attachment "A Sample project to recreate the
bug".
Comment 34 Hasan Ceylan 2012-01-01 13:21:52 EST
Sorry to be rude, but test case has been asked and it has been provided.
Please can we fix that after 3.5 years?

Regards,
Hasan Ceylan
Comment 35 Paul Webster 2012-01-03 13:34:30 EST
(In reply to comment #34)
> Sorry to be rude, but test case has been asked and it has been provided.
> Please can we fix that after 3.5 years?

No one is looking at the progress view at the moment.

Is there something we can set in the DetailedProgressViewer/ProgressInfoItem to
avoid hitting this in FormLayout?  Maybe we should be using SWT.DEFAULT in one
of our calls if the Job doesn't specify progress?

PW
Comment 36 Hasan Ceylan 2012-03-28 05:53:54 EDT
Come on guys,

it is almost 4 years. 

Patchs are provided, what is the big deal?
Comment 37 Paul Webster 2012-03-28 06:53:35 EDT
(In reply to comment #36)
> Patchs are provided, what is the big deal?

They were not appropriate, as stated in the comments?

OK, let's get a fresh set of eyes on them and see if we can make progress.

PW
Comment 38 Hasan Ceylan 2012-04-01 07:21:28 EDT
Dear Paul,

1) Both patches actually fix the issue, so I do not agree that they were not
appropriate. If it is wrong, the current code is already wrong, so please
correct it, then we can provide the correct patch if the issue still persists.
The patches do not break things here, they fix what is already broken.

2) If when the width is zero and if that means every character should be laid
on a new line, how come it has a huge height with null or "" link value? 

3) I inspected the win32 code and saw that the code base is completely
different so breaking the other platforms cannot be an issue.

4) "Link#computeSize() should work the same way on all platforms" I agree,
well, guess what it does not if you count GTK as a platform.

5) Since I submitted the fix till I get tired of it, I was patching my own
eclipse with the fix and did not notice anything wrong. Also Andrey stated that
he uses patched Eclipse extensively and he is fine too. 

Comments "like provide a test case", "Is it on Linux" clearly suggests that the
responsibles for the bug report do not even take time to read the bug. It was
stated repeatedly that this is a GTK specific bug and the test case was
submitted 15 months before it was asked for.

Both Andrey and I took time off from our work and made every effort to correct
this *little* annoying bug bug we get almost no attention in return.

I highly doubt that none of Eclipse Engineers who ever replied to this bug uses
Linux as their choice of platform. 

So please someone take a little time and fix the issue.

Regards,
Hasan Ceylan
Comment 39 Andrey Loskutov 2012-04-01 07:38:14 EDT
@Paul:
Please consider to look at it for 3.8 release. 

As Hasan said, it's GTK only and you have to debug it once to see that the
patches just work. Linux progress view is really broken due this bug and since
*so many* releases/years, we MUST fix this crap finally.
Comment 40 Paul Webster 2012-04-01 07:40:14 EDT
(In reply to comment #38)
> Dear Paul,
> 
> 1) Both patches actually fix the issue, so I do not agree that they were not
> appropriate. If it is wrong, the current code is already wrong, so please
> correct it, then we can provide the correct patch if the issue still persists.
> The patches do not break things here, they fix what is already broken.

This was a request to a new SWT committer to re-examine the bug, so we could
move this bug forward and so we could get the correct fix ... you don't apply
another wrong fix to a wrong initial state, you fix it if possible.

When I get consensus, then we can move forward.

PW
Comment 41 Hasan Ceylan 2012-04-01 08:00:23 EDT
(In reply to comment #40)
> (In reply to comment #38)
> > Dear Paul,
> > 
> > 1) Both patches actually fix the issue, so I do not agree that they were not
> > appropriate. If it is wrong, the current code is already wrong, so please
> > correct it, then we can provide the correct patch if the issue still persists.
> > The patches do not break things here, they fix what is already broken.
> 
> This was a request to a new SWT committer to re-examine the bug, so we could
> move this bug forward and so we could get the correct fix ... you don't apply
> another wrong fix to a wrong initial state, you fix it if possible.
> 

Yes, I would agree if it was fixed in a few months. But, as Andrey said, after
"*so many* releases/years", you simply start to seek what just works...

> When I get consensus, then we can move forward.
> 
> PW
Comment 42 Paul Webster 2012-04-01 08:50:24 EDT
(In reply to comment #38)
> I highly doubt that none of Eclipse Engineers who ever replied to this bug uses
> Linux as their choice of platform. 
> 

And this is where I draw the line.  Disagree with the fix or lack of it,
disagree with the prioritization of the bug.  That's acceptable.

Attacking people is never acceptable.  See the slides for
http://www.eclipsecon.org/2012/sessions/assholes-are-killing-your-project

PW
Comment 43 Hasan Ceylan 2012-04-01 08:58:33 EDT
(In reply to comment #42)
> (In reply to comment #38)
> > I highly doubt that none of Eclipse Engineers who ever replied to this bug uses
> > Linux as their choice of platform. 
> > 
> 
> And this is where I draw the line.  Disagree with the fix or lack of it,
> disagree with the prioritization of the bug.  That's acceptable.
> 
> Attacking people is never acceptable.  See the slides for
> http://www.eclipsecon.org/2012/sessions/assholes-are-killing-your-project
> 
> PW

Paul,

My comment was an observation, and I think I stand corrected, if any of the
engineers involved in this bug report were using eclipse on Linux, they would
be as disturbed as we are. And I get to be called "Asshole".

And last but not the least, I am going to take this to whatever eclipse
formation that can deal with that.

At first not treating community, I can see that happening in a lot of open
source projects. With 15 years of open source / eclipse interaction, this is
the time I am called an asshole. That's a first.