Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339663 - [JFace] Image of ControlDecoration is visible outside composite when the scrolling a composite
Summary: [JFace] Image of ControlDecoration is visible outside composite when the scro...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6.1   Edit
Hardware: PC Windows XP
: P3 major with 1 vote (vote)
Target Milestone: 4.5 M6   Edit
Assignee: Brian de Alwis CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 342149 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-11 05:26 EST by Bijoy Thomas CLA
Modified: 2018-04-30 02:02 EDT (History)
9 users (show)

See Also:


Attachments
ControlDecorator initialy (707.28 KB, image/bmp)
2011-03-11 05:29 EST, Bijoy Thomas CLA
no flags Details
ControlDecorator when scrolled (774.51 KB, image/bmp)
2011-03-11 05:30 EST, Bijoy Thomas CLA
no flags Details
ControlDecorator after minimize and maximize the application (623.14 KB, image/bmp)
2011-03-11 05:32 EST, Bijoy Thomas CLA
no flags Details
Sample source code (11.15 KB, application/x-zip-compressed)
2011-05-09 02:01 EDT, Bijoy Thomas CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bijoy Thomas CLA 2011-03-11 05:26:59 EST
Build Identifier: M20100909-0800

When a compsite with control is scrolling, the control decorater's images are displayed outside the composite

Reproducible: Always

Steps to Reproduce:
1.Add a control with decorator image to a scrollable composite.
2.Scroll the composite till control is not visible
3.When the control is not visible minimize the application.
4.Again when you maximize the appliation decorator image for the control will be visible outside the composite.
Comment 1 Bijoy Thomas CLA 2011-03-11 05:29:25 EST
Created attachment 190965 [details]
ControlDecorator initialy
Comment 2 Bijoy Thomas CLA 2011-03-11 05:30:58 EST
Created attachment 190966 [details]
ControlDecorator when scrolled
Comment 3 Bijoy Thomas CLA 2011-03-11 05:32:08 EST
Created attachment 190967 [details]
ControlDecorator after minimize and maximize the application
Comment 4 Bijoy Thomas CLA 2011-04-19 06:23:12 EDT
Any Update on this bug
Comment 5 Felipe Heidrich CLA 2011-04-19 11:11:52 EDT
Can you add a code snippet to this problem ? Thank you.
Comment 6 Bijoy Thomas CLA 2011-05-09 02:01:39 EDT
Created attachment 195035 [details]
Sample source code

Please find the attached project which contains a view similar to the screen shot attached, to reproduce the bug please follow the same steps.
Comment 7 Felipe Heidrich CLA 2011-05-10 10:13:20 EDT
I suspect the problem in is ControlDecoration which is drawing the image when it should not. Please send the problem back if I'm wrong.
Comment 8 Bijoy Thomas CLA 2011-05-19 21:21:52 EDT
you are correct the the control decorator draw the image when its not required.

I debugged this issues and found that when the control are there in scroll composite even if it is at invisible area there is no change in state. so when control decorator draws the image it is not able to find that control is visible or not.
Comment 9 Bijoy Thomas CLA 2011-09-26 04:42:06 EDT
any update on this bug
Comment 10 Florian Klein CLA 2015-01-19 10:00:57 EST
In one of our RCP applications (Eclipse Kepler 4.3) we are facing this problem too. Is there any update on this issue?
Comment 11 Dani Megert CLA 2015-01-27 08:50:07 EST
(In reply to Florian Klein from comment #10)
> In one of our RCP applications (Eclipse Kepler 4.3) we are facing this
> problem too. Is there any update on this issue?

No one is working on this. A good quality patch would be appreciated.
Comment 12 Brian de Alwis CLA 2015-01-27 12:54:44 EST
I've seen this issue too and had a few minutes to fiddle.  The quick workaround is to use the 3-argument ControlDecoration constructor to explicitly specify the top-most composite where the decoration should be drawn.  In the example app specified here, you'd change SampleView.java line 130 from:

	ControlDecoration controlDecoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP);

to

	ControlDecoration controlDecoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP, scrolledComposite);

ControlDecoration installs paint listeners on each of the ancestors of the decorated-control.  This is done in case the control's parent does not have enough space for the decoration to be drawn.  The 2-arg variant causes these listeners to be installed on all ancestors up to the Shell; the 3-argument constructor limits itself to the specified composite.  These paint listeners check that the control is visible and if so computes the location within the hosting composite and draws the decoration.  The decoration could be drawn multiple times, but that may be necessary if there isn't enough space in one of the sub composites.

Going up to the Shell is normally fine, except when encountering a ScrolledComposite as the decorated control may have been scrolled out of view.  We can't easily determine whether widget within a ScrollableComposite is currently visible (that is, isVisible()/getVisible() return true).  And so the paint listeners on the parents of the ScrolledComposite compute a location and draw the decoration in a position that is  outside of the viewable area.

I think the solution here is to consider ScrolledComposites to be a limiting parent, just like a Shell.

https://git.eclipse.org/r/40483
Comment 13 Florian Klein CLA 2015-01-29 08:01:11 EST
Thanks a lot. This solved our problem.
Comment 15 Brian de Alwis CLA 2015-03-16 16:56:54 EDT
I'm marking this as verified in I20150316-0800: it seemed to be the cause of flickering decorators seen when opening a pom.xml in m2e, which I no longer see (phew).
Comment 16 Brian de Alwis CLA 2017-08-25 12:18:54 EDT
*** Bug 342149 has been marked as a duplicate of this bug. ***