Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 368543

Summary: Odd Display of WindowBuilder in Eclipse 3.8/4.2 on Linux
Product: [Eclipse Project] Platform Reporter: Lars Vogel <Lars.Vogel>
Component: SWTAssignee: Bogdan Gheorghe <gheorghe>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: Alexander.Mitin, atx, ccmiersma, eclipse, gheorghe, jlangley, kai.mechel, Konstantin.Scheglov, Lars.Vogel, marc.menghin, mario.curcija, peter, pwebster, remy.suen, roman-vl, Silenio_Quarti
Version: 3.8Flags: Silenio_Quarti: review+
Target Milestone: 4.2.1   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Bug Depends on: 354978    
Bug Blocks: 370370    
Attachments:
Description Flags
Screenshot
none
Patch for Composite
none
Screenshot
none
Bug on uses of WindowBuilder with eclipse Juno chchokri: review?

Description Lars Vogel CLA 2012-01-13 08:24:35 EST
Created attachment 209450 [details]
Screenshot

I installed WindowBuilder in the latest integration build of Eclipse 4.2.

As I tried to open a SWT application in SWT Designer, Eclipse prompted me something about Compiz and if it can render it into a separate Window. Unfortunately I did not note done the exact text. 

The palette of WindowBuilder is rendered strangely, see attached screenshot.

I currently don't know if the issue is created by the Compiz Window manager, Eclipse 4.2 or Ubuntu 11.10.

WindowBuilder runs fine in Eclipse 3.7 but here I also didn't get the Compiz popup. 

Let me know if need more information.
Comment 1 Remy Suen CLA 2012-01-13 08:42:49 EST
(In reply to comment #0)
> WindowBuilder runs fine in Eclipse 3.7 but here I also didn't get the Compiz
> popup.

Lars, could you try it with 3.8? It may be one of the new changes in SWT which is causing the popup to appear.
Comment 2 Paul Webster CLA 2012-01-13 09:08:46 EST
Eric, possibly a reparent issue?

PW
Comment 3 Lars Vogel CLA 2012-01-13 09:34:14 EST
@Remy: Same incorrect behavior in Eclipse 3.8. Shall I change the component to SWT?
Comment 4 Remy Suen CLA 2012-01-13 09:38:16 EST
(In reply to comment #3)
> @Remy: Same incorrect behavior in Eclipse 3.8. Shall I change the component to
> SWT?

Yes, let's send it over there.

Thank you for checking, Lars, much appreciated.
Comment 5 Bogdan Gheorghe CLA 2012-01-13 22:53:24 EST
I investigated this today and it is directly related to our use of advanced graphics (Cairo) on GTK in 4.2. If you add the following line to the end of the eclipse.ini file before launching 4.2, things will draw properly:

 -Dorg.eclipse.swt.internal.gtk.useCairo=false

The real fix will happen when we finish rewriting our graphics to use Cairo (bug 354978).

Marking this as dependent on that.
Comment 6 Lars Vogel CLA 2012-01-14 15:17:44 EST
Thanks Bogdan. Workaround works fine.
Comment 7 Lars Vogel CLA 2012-04-20 11:10:01 EDT
Happen again in Build id: I20120411-2034, this time the 

-Dorg.eclipse.swt.internal.gtk.useCairo=false

parameter does not seem to help.
Comment 8 Mario Curcija CLA 2012-05-23 17:57:49 EDT
(In reply to comment #7)
> Happen again in Build id: I20120411-2034, this time the 
> 
> -Dorg.eclipse.swt.internal.gtk.useCairo=false
> 
> parameter does not seem to help.

Confirming that launching with 

-Dorg.eclipse.swt.internal.gtk.useCairo=false

does not work: 

Eclipse SDK	4.2.0.I20120518-2145
SWT Designer	1.5.0.r42x201205152207
Comment 9 Alexander Mitin CLA 2012-05-24 05:19:27 EDT
Add additionally org.eclipse.swt.internal.gtk.cairoGraphics=false
IOW, use
-Dorg.eclipse.swt.internal.gtk.cairoGraphics=false -Dorg.eclipse.swt.internal.gtk.useCairo=false
Comment 10 Alexander Mitin CLA 2012-05-24 10:26:24 EDT
Palette renderer is a Canvas widget with NO_BACKGROUND and NO_REDRAW_RESIZE styles.
It uses SWT.Paint event to render palette contents. 
It works fine while Cairo is disabled. With Cairo, it seems that Canvas's GC draws the contents considering the coordinates provided as root window coordinates. IOW, if I try to draw something on 0,0 position of my composite, it draws contents in 0,0 position of root window.
If I remove NO_BACKGROUND style, it draws correctly. So, this could be a bug in SWT.
Comment 11 Bogdan Gheorghe CLA 2012-06-08 11:40:04 EDT
We tried the latest 4.2 RC4 build with the WindowBuilder available in the Juno repository on Ubuntu 12.04. Everything draws properly there and you don't have to set any flags. (Ubuntu 12.04 ships with GTK 2.24. If you are on another distro with GTK 2.24, you should not set any flags to false - just run as is).


If you have an older distro - try "export GDK_NATIVE_WINDOWS=1" before launching eclipse.
Comment 12 Bogdan Gheorghe CLA 2012-06-08 12:54:45 EDT
Created attachment 217087 [details]
Patch for Composite

This patch disables SWT.NO_BACKGROUND for GTK > 2.18.
Comment 13 Bogdan Gheorghe CLA 2012-06-08 12:55:15 EDT
This should go into 4.2.1
Comment 14 Lars Vogel CLA 2012-07-04 04:55:28 EDT
Created attachment 218251 [details]
Screenshot

Even with -Dorg.eclipse.swt.internal.gtk.cairoGraphics=false
-Dorg.eclipse.swt.internal.gtk.useCairo=false I get a incorrect display in the left upper corner. Screenshot attached.
Comment 15 Roman V.Leon CLA 2012-07-08 12:58:00 EDT
(In reply to comment #11)
> We tried the latest 4.2 RC4 build with the WindowBuilder available in the Juno
> repository on Ubuntu 12.04. Everything draws properly there and you don't have
> to set any flags. (Ubuntu 12.04 ships with GTK 2.24. If you are on another
> distro with GTK 2.24, you should not set any flags to false - just run as is).
> 
> 
> If you have an older distro - try "export GDK_NATIVE_WINDOWS=1" before
> launching eclipse.

Thank you for this tip. The option has helped me. Just in case - I use Debian Testing x64.
Comment 16 Eric Clayberg CLA 2012-07-14 21:29:15 EDT
*** Bug 385103 has been marked as a duplicate of this bug. ***
Comment 17 Lars Vogel CLA 2012-07-18 01:15:02 EDT
export GDK_NATIVE_WINDOWS=1
eclipse -Dorg.eclipse.swt.internal.gtk.cairoGraphics=false
-Dorg.eclipse.swt.internal.gtk.useCairo=false

works for me. Unfortunately this seems to kill the scrollbars in Ubuntu 12.04.
Comment 18 Bogdan Gheorghe CLA 2012-08-01 17:48:25 EDT
Patch released to 3.8 maintenance, 4.2 maintenance and master.
Comment 19 chokri chaouch CLA 2012-09-09 09:37:11 EDT
Created attachment 220872 [details]
Bug on uses of WindowBuilder with eclipse Juno

Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
	at javax.swing.JPanel.updateUI(Unknown Source)
	at javax.swing.JPanel.<init>(Unknown Source)
	at javax.swing.JPanel.<init>(Unknown Source)
	at javax.swing.JPanel.<init>(Unknown Source)
	at javax.swing.JRootPane.createGlassPane(Unknown Source)
	at javax.swing.JRootPane.<init>(Unknown Source)
	at javax.swing.JFrame.createRootPane(Unknown Source)
	at javax.swing.JFrame.frameInit(Unknown Source)
	at javax.swing.JFrame.<init>(Unknown Source)
	at HelloVE.<init>(HelloVE.java:32)
	at HelloVE$1.run(HelloVE.java:20)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: 0 incompatible with Text-specific LCD contrast key
	at java.awt.RenderingHints.put(Unknown Source)
	at sun.awt.windows.WDesktopProperties.getDesktopAAHints(Unknown Source)
	at sun.awt.windows.WToolkit.getDesktopAAHints(Unknown Source)
	at sun.awt.SunToolkit.getDesktopFontHints(Unknown Source)
	at sun.awt.windows.WDesktopProperties.setDesktopAAHints(Unknown Source)
	at sun.awt.windows.WToolkit.initializeDesktopProperties(Unknown Source)
	at java.awt.Toolkit.getDesktopProperty(Unknown Source)
	at javax.swing.UIManager.<clinit>(Unknown Source)
	... 19 more