Bug 67885 - [Eclipse Forms] Label on a coloured parent has repaint problems
Summary: [Eclipse Forms] Label on a coloured parent has repaint problems
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux-GTK
: P1 major (vote)
Target Milestone: 3.0 RC4   Edit
Assignee: Dejan Glozic CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 63409 67160 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-06-18 15:31 EDT by Dejan Glozic CLA
Modified: 2004-06-22 11:17 EDT (History)
4 users (show)

See Also:


Attachments
The fix to use 'getSize' instead of 'computeSize' (1.07 KB, patch)
2004-06-21 14:36 EDT, Dejan Glozic CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dejan Glozic CLA 2004-06-18 15:31:33 EDT
When a Label widget is in a parent that has its background explicitly set,
scrolling the parent in a ScrolledComposite can cause the label to only
partially repaint (sometimes it goes away completely).

To reproduce:

1) Check out org.eclipse.ui.forms and org.eclipse.ui.forms.examples from HEAD
2) Launch second Eclipse instance
3) Customize perspective so that 'Form Editors' menu shows up on the menu bar
4) Launch the Simple Form Editor and switch to Flow page
5) Scroll the page vertically. Observe how some labels in sections flicker and
partially go away while scrolling.

I tried to figure out the reason and so far found out that it has to do wih the
background painting of the parent. To confirm, open 'Section.java' in
org.eclipse.ui.forms.widgets package and comment out the method 'onPaint' (this
method paints the blue section behind the section label). You will notice that
the problem stops.

Similar problem has been noticed with cheat sheets. They too use the same base
class (expandable composite) and set the background to explicit color object. As
cheat sheet sections expand, collapse and otherwise layout, some portions of the
text go away.

There is no rhyme or reason to this - it is completely random.

This is a serious problem becuase it affects all the sections in all the PDE
multi-page editors on GTK. In addition, it affects cheat sheets.
Comment 1 Dejan Glozic CLA 2004-06-18 17:01:05 EDT
*** Bug 63409 has been marked as a duplicate of this bug. ***
Comment 2 Dejan Glozic CLA 2004-06-18 17:05:38 EDT
*** Bug 67160 has been marked as a duplicate of this bug. ***
Comment 3 Veronika Irvine CLA 2004-06-18 17:30:22 EDT
The problem is because of Label.computeSize() called in the paint event.  Any 
comments Steve?
Comment 4 Veronika Irvine CLA 2004-06-21 14:05:23 EDT
There is a problem on GTK when a resize occurs within a paint.  In 
Label.computeSize, in order to get the size right with wrapping, the size of 
the Label is temporarily changed to the size of the wHint and hHint and then 
changed back.

Any change to Label.computeSize will have a major effect on Eclipse and this is 
too risky at this point in the schedule.

However, looking at the code in Section.onPaint, it is not clear why 
textLabel.computeSize is being called.  In ExpandableLayout of 
ExpandableComposite, the size of the textLabel has already been calculated and 
setBounds has been called.  Since the resize event will happen before the paint 
event, why doesn't Section.onPaint just call textLabel.getSize() rather than 
textLabel.computeSize? Calling getSize() rather than computeSize() will get rid 
of this problem and will also be more accurate since the sizing calculation 
code will not be duplicated.
Comment 5 Dejan Glozic CLA 2004-06-21 14:18:29 EDT
The relative order of calls was something I didn't know about and therefore 
could not count on. We will try the workaround and see if it works for us.
Comment 6 Felipe Heidrich CLA 2004-06-21 14:19:49 EDT
VI, do you have a simple testcase for this problem ?

Do we know exactly what goes wrong when calling computeSize from a paint 
callback ? During my tests I could verify the always computeSize returns the 
right value.
Comment 7 Dejan Glozic CLA 2004-06-21 14:31:52 EDT
Moving to Eclipse Forms to address in RC4 time frame.
Comment 8 Steve Northover CLA 2004-06-21 14:33:14 EDT
Their still seems to be a bug on SWT somewhere.  You shouldn't get the cheese 
(or at least you should get the same cheese on every platform).
Comment 9 Dejan Glozic CLA 2004-06-21 14:35:26 EDT
Once we verify that using 'getSize' works for us, I will re-route the bug back 
to SWT to address post 3.0.
Comment 10 Dejan Glozic CLA 2004-06-21 14:36:04 EDT
Created attachment 12590 [details]
The fix to use 'getSize' instead of 'computeSize'
Comment 11 Dejan Glozic CLA 2004-06-21 16:59:29 EDT
We confirmed that the patch addresses the vanishing on our Linux machine.
Comment 12 Dejan Glozic CLA 2004-06-22 11:17:20 EDT
Patch applied and released.