Bug 572968 - setBackgroundMode + background-image + Text-Widget results in broken UI
Summary: setBackgroundMode + background-image + Text-Widget results in broken UI
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.19   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-19 07:30 EDT by Thomas Schindl CLA
Modified: 2021-04-20 16:46 EDT (History)
1 user (show)

See Also:


Attachments
Broken UI (664.49 KB, image/png)
2021-04-19 07:30 EDT, Thomas Schindl CLA
no flags Details
Splash (132.42 KB, image/bmp)
2021-04-19 07:31 EDT, Thomas Schindl CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2021-04-19 07:30:35 EDT
Created attachment 286163 [details]
Broken UI

Running the following SWT sample results in a a broken UI (as seen in the attachment).

---
package t;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class Reproducer {
	
	public static void main(String[] args) {
		Display d = new Display();
		
		Shell splash = new Shell(d);
		splash.setBackgroundImage(new Image(d, Reproducer.class.getResourceAsStream("splash.bmp")));
		splash.setSize(455, 295);
		
		splash.setLayout(new FillLayout());
		splash.setBackgroundMode(SWT.INHERIT_DEFAULT);
		
		Composite fCompositeLogin = new Composite(splash, SWT.BORDER);
		fCompositeLogin.setLayout(new GridLayout(1, false));
		
		Composite spanner = new Composite(fCompositeLogin, SWT.NONE);
		GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
		spanner.setLayoutData(data);

		Label label = new Label(fCompositeLogin, SWT.NONE);
		label.setText("Hello World:");
		data = new GridData();
		label.setLayoutData(data);		
		
		Text text = new Text(fCompositeLogin, SWT.BORDER); // Comment to see it working 
		Button b = new Button(fCompositeLogin, SWT.PUSH); 

		splash.layout(true);
		splash.open();
		
		while( ! splash.isDisposed() ) {
			if( ! d.readAndDispatch() ) {
				d.sleep();
			}
		}
		
	}
}
---

It looks like this is somehow caused by the Text-Widget if you comment that code you'll see all looks good. This is on BigSur I didn't yet test it on pre BigSur-Releases.

BTW: This is trimmed down version from "Interactive Splash"-Template.
Comment 1 Thomas Schindl CLA 2021-04-19 07:31:20 EDT
Created attachment 286164 [details]
Splash
Comment 2 Thomas Schindl CLA 2021-04-19 07:54:08 EDT
Looks like this is NOT a BigSur issue because I could reproduce it on Catalina as well with 4.19.
Comment 3 Lakshmi P Shanmugam CLA 2021-04-20 16:46:48 EDT
The problem is not seen when running the snippet with Java8, but happens with Java11 and later.
So, looks like it's caused by some change in Cocoa API behavior. Needs further investigation.