Bug 295014 - Finish implementation of SWT.TRANSPARENT
Summary: Finish implementation of SWT.TRANSPARENT
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Windows XP
: P3 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-12 16:03 EST by Izzet Safer CLA
Modified: 2013-05-02 02:22 EDT (History)
4 users (show)

See Also:


Attachments
The screenshot of the snippet. (1.97 KB, image/x-png)
2009-11-12 16:06 EST, Izzet Safer CLA
no flags Details
Snippet (860 bytes, text/plain)
2009-11-13 17:10 EST, Izzet Safer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Izzet Safer CLA 2009-11-12 16:03:03 EST
When using the SWT.TRANSPARENT style on composites and controls, the right to left orientation has serious problems. Please run the snippet to see how incorrectly the text is mirrored. Also the buttons on the shell doesn't function properly -- they get painted correctly according to RTL, however they still function in a way they were laid out LTR.

This issue had very severe repercussions on our product based on 3.4.2, please address this issue promptly.

Izzet
Comment 1 Izzet Safer CLA 2009-11-12 16:06:50 EST
Created attachment 152108 [details]
The screenshot of the snippet.
Comment 2 Izzet Safer CLA 2009-11-12 16:08:25 EST
Sorry -- I had a wrong statement above about the shell buttons. They are positioned wrongly according to RTL, however function correctly as the buttons were laid out according to RTL.
Comment 3 Felipe Heidrich CLA 2009-11-13 17:01:15 EST
Where is the snippet ?

Please check the java doc for SWT.TRANSPARENT, it says:
WARNING: THIS API IS UNDER CONSTRUCTION AND SHOULD NOT BE USED
Comment 4 Izzet Safer CLA 2009-11-13 17:10:59 EST
Created attachment 152215 [details]
Snippet

Interesting.. I thought I uploaded the snippet :)
Comment 5 Izzet Safer CLA 2009-11-13 17:19:59 EST
I'm aware of the javadoc warning. However using this style was the only solution for our particular case. I'm setting the background of a composite using a paint listener and GC.drawImage (this is a requirement on our side), and not using setBackgroundImage. The only way to make the controls in this composite transparent is then use SWT.TRANSPARENT. I cannot use setBackgroundImage and the regular transparency via Composite.setBackgroundMode(SWT.INHERIT_FORCE).

I cannot complain much because of the javadoc warning, but I also wanted to open this bug to ask you finalize the design of this useful SWT.TRANSPARENT, and help you see a bug when using in RTL orientation.

I also want to note that, the problem expressed on the first comment doesn't happen in my Ubuntu setup. It only happens in Windows (tried XP.)
Comment 6 Felipe Heidrich CLA 2009-11-16 12:19:52 EST
Closing as WONT FIX, I'll talk to SSQ to decide what to do about SWT.TRANSPARENT (as far as I know it should work for Shell only). We should fix (at least) the java doc.

In your case, the only workaround I can suggest is to use setBackgroundImage() and setBackgroundMode(). To make sure the bottom-right corner of the image is always at the bottom-right corner of the composite you need:
-handle SWT.Resize events for the composite
--create a new image the size of the client area
--draw the background image to the new image with right offset
--set the new image in the composite (setBackgroundImage)
--dispose the old image (if any)
Comment 7 Izzet Safer CLA 2009-11-16 13:32:24 EST
I'm reopening this defect as an enhancement request to finish implementing the correct behaviour of SWT.TRANSPARENT. As this is a useful style bit, please complete its implementation.
Comment 8 Xiang Qinxian CLA 2011-09-03 12:02:46 EDT
I test in windows7, the TRANSPARENT cannot combine the SWT.Paint event listener.
the painter will flicker.
just modify the snippet, 

composite.setLayout(new GridLayout());
composite.addListener(SWT.Paint, new Listener() {
			@Override
			public void handleEvent(Event event) {
				event.gc.drawImage( new Image(...));
			}
		});
the flicker will BOM!
If remove the TRANSPARENT bit, the painter works fine.
Comment 9 Felipe Heidrich CLA 2011-09-06 10:12:20 EDT
Silenio, what should we do about SWT.TRANSPARENT  ?

Changed it work for Shell only ? Or remove/depreacte it ?
Comment 10 Richa Jain CLA 2013-05-02 02:22:37 EDT
I am using Eclipse Indigo Release 2 version.I used SWT.TRANSPARENT for giving tranparent effect to Shell.

But the output was different.It hides the Titlebar.

Is there any development going on in this direction or should i assign it as a Bug???