29994 - Image background Composite / Transparent widget backgrounds
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Button.java
index 5113a34..ce80cd3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Button.java
@@ -224,6 +224,7 @@
 }
 
 void createHandle () {
+	if ((style & SWT.PUSH) == 0) state |= THEME_BACKGROUND;
 	int [] outControl = new int [1];
 	int window = OS.GetControlOwner (parent.handle);
 				
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java
index c26aeab..3345548 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java
@@ -43,7 +43,7 @@
 	Layout layout;
 	Control[] tabList;
 	int scrolledVisibleRgn, siblingsVisibleRgn;
-	int layoutCount = 0;
+	int layoutCount, backgroundMode;
 
 Composite () {
 	/* Do nothing */
@@ -247,7 +247,9 @@
 
 void createHandle () {
 	state |= CANVAS | GRAB;
-	if ((style & (SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
+	boolean scrolled = (style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0;
+	if (!scrolled)  state |= THEME_BACKGROUND;
+	if (scrolled || (style & SWT.BORDER) != 0) {
 		createScrolledHandle (parent.handle);
 	} else {
 		createHandle (parent.handle);
@@ -335,6 +337,11 @@
 	tabList = newList;
 }
 
+public int getBackgroundMode () {
+	checkWidget ();
+	return backgroundMode;
+}
+
 /**
  * Returns a (possibly empty) array containing the receiver's children.
  * Children are returned in the order that they are drawn.
@@ -815,6 +822,11 @@
 	super.resetVisibleRegion (control);
 }
 
+public void setBackgroundMode (int mode) {
+	checkWidget ();
+	backgroundMode = mode;
+}
+
 int setBounds (int x, int y, int width, int height, boolean move, boolean resize, boolean events) {
 	int result = super.setBounds (x, y, width, height, move, resize, events);
 	if (layout != null && (result & RESIZED) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
index 53a3ad3..c0c4124 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
@@ -488,6 +488,7 @@
 	super.createWidget ();
 	checkBuffered ();
 	setDefaultFont ();
+	setBackground ();
 	setZOrder ();
 }
 
@@ -2288,6 +2289,28 @@
 	return false;
 }
 
+void setBackground () {
+	Shell shell = getShell ();
+	if (this == shell) return;
+	Composite composite = parent;
+	do {
+		int mode = composite.backgroundMode;
+		if (mode != 0) {
+			if (mode == SWT.INHERIT_DEFAULT) {
+				Control control = this;
+				do {
+					if ((control.state & THEME_BACKGROUND) == 0) return;
+					control = control.parent;
+				} while (control != composite);
+			}
+			state |= PARENT_BACKGROUND;					
+			return;
+		}
+		if (composite == shell) break;
+		composite = composite.parent;
+	} while (true);
+}
+
 /**
  * Sets the receiver's background color to the color specified
  * by the argument, or to the default system color for the control
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Group.java
index ea3036de..d595319 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Group.java
@@ -141,6 +141,7 @@
 }
 
 void createHandle () {
+	state |= THEME_BACKGROUND;
 	int [] outControl = new int [1];
 	int window = OS.GetControlOwner (parent.handle);
 	OS.CreateGroupBoxControl (window, null, 0, true, outControl);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Label.java
index 84066a6..3217650 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Label.java
@@ -150,7 +150,7 @@
 }
 
 void createHandle () {
-	state |= GRAB;
+	state |= GRAB | THEME_BACKGROUND;
 	int [] outControl = new int [1];
 	int window = OS.GetControlOwner (parent.handle);
 	if ((style & SWT.SEPARATOR) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Link.java
index 01816be..6bf0408 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Link.java
@@ -143,6 +143,7 @@
 }
 
 void createHandle () {
+	state |= THEME_BACKGROUND;
 	int features = OS.kControlSupportsFocus | OS.kControlGetsFocusOnClick;
 	int [] outControl = new int [1];
 	int window = OS.GetControlOwner (parent.handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Sash.java
index 4783dd9..2ec6079 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Sash.java
@@ -136,6 +136,7 @@
 }
 
 void createHandle () {
+	state |= THEME_BACKGROUND;
 	int features = OS.kControlSupportsFocus;
 	int [] outControl = new int [1];
 	int window = OS.GetControlOwner (parent.handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Scale.java
index c379b43..56237c2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Scale.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Scale.java
@@ -132,6 +132,7 @@
 }
 
 void createHandle () {
+	state |= THEME_BACKGROUND;
 	int actionProc = display.actionProc;
 	int [] outControl = new int [1];
 	int window = OS.GetControlOwner (parent.handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java
index 059fb29..a922d19 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java
@@ -123,7 +123,7 @@
 }
 
 void createHandle () {
-	state |= GRAB;
+	state |= GRAB | THEME_BACKGROUND;
 	super.createHandle (parent.handle);
 }
 
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
index da19fe5..3237fb4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
@@ -67,19 +67,20 @@
 	static final int EXPANDING        = 1 << 8;
 	static final int IGNORE_WHEEL     = 1 << 9;
 	static final int PARENT_BACKGROUND = 1 << 10;
+	static final int THEME_BACKGROUND = 1 << 11;
 	
 	/* A layout was requested on this widget */
-	static final int LAYOUT_NEEDED	= 1<<11;
+	static final int LAYOUT_NEEDED	= 1<<12;
 	
 	/* The preferred size of a child has changed */
-	static final int LAYOUT_CHANGED = 1<<12;
+	static final int LAYOUT_CHANGED = 1<<13;
 	
 	/* A layout was requested in this widget hierachy */
-	static final int LAYOUT_CHILD = 1<<13;
+	static final int LAYOUT_CHILD = 1<<14;
 
 	/* More global state flags */
-	static final int RELEASED = 1<<14;
-	static final int DISPOSE_SENT = 1<<15;
+	static final int RELEASED = 1<<15;
+	static final int DISPOSE_SENT = 1<<16;
 	
 	/* Default size for widgets */
 	static final int DEFAULT_WIDTH	= 64;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
index 4a27f2d..16935ec 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -176,6 +176,7 @@
 
 void createHandle (int index) {
 	state |= HANDLE;
+	if ((style & SWT.PUSH) == 0) state |= THEME_BACKGROUND;
 	int bits = SWT.ARROW | SWT.TOGGLE | SWT.CHECK | SWT.RADIO | SWT.PUSH;
 	fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0);
 	if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index a89f54c..7a441b6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -43,7 +43,7 @@
 	int /*long*/ imHandle, socketHandle;
 	Layout layout;
 	Control[] tabList;
-	int layoutCount = 0;
+	int layoutCount, backgroundMode;
 
 	static final String NO_INPUT_METHOD = "org.eclipse.swt.internal.gtk.noInputMethod"; //$NON-NLS-1$
 
@@ -229,8 +229,9 @@
 
 void createHandle (int index) {
 	state |= HANDLE | CANVAS;
-	boolean scrolled = (style & (SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER)) != 0;
-	createHandle (index, true, scrolled);
+	boolean scrolled = (style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0;
+	if (!scrolled) state |= THEME_BACKGROUND;
+	createHandle (index, true, scrolled || (style & SWT.BORDER) != 0);
 }
 
 void createHandle (int index, boolean fixed, boolean scrolled) {
@@ -419,6 +420,11 @@
 	return result;
 }
 
+public int getBackgroundMode () {
+	checkWidget ();
+	return backgroundMode;
+}
+
 /**
  * Returns a (possibly empty) array containing the receiver's children.
  * Children are returned in the order that they are drawn.
@@ -1016,6 +1022,11 @@
 	if (socketHandle != 0) OS.gtk_widget_set_size_request (socketHandle, width, height);
 }
 
+public void setBackgroundMode (int mode) {
+	checkWidget ();
+	backgroundMode = mode;
+}
+
 int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
 	int result = super.setBounds (x, y, width, height, move, resize);
 	if ((result & RESIZED) != 0 && layout != null) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index acdc841..e347e15 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -2591,6 +2591,28 @@
 	return event.doit;
 }
 
+void setBackground () {
+	Shell shell = getShell ();
+	if (this == shell) return;
+	Composite composite = parent;
+	do {
+		int mode = composite.backgroundMode;
+		if (mode != 0) {
+			if (mode == SWT.INHERIT_DEFAULT) {
+				Control control = this;
+				do {
+					if ((control.state & THEME_BACKGROUND) == 0) return;
+					control = control.parent;
+				} while (control != composite);
+			}
+			state |= PARENT_BACKGROUND;
+			return;
+		}
+		if (composite == shell) break;
+		composite = composite.parent;
+	} while (true);
+}
+
 /**
  * Sets the receiver's background color to the color specified
  * by the argument, or to the default system color for the control
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
index 5e3138a..61cfe71 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
@@ -115,7 +115,7 @@
 }
 
 void createHandle(int index) {
-	state |= HANDLE;
+	state |= HANDLE | THEME_BACKGROUND;
 	fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0);
 	if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
 	OS.gtk_fixed_set_has_window (fixedHandle, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index eb74840..a97af29 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -139,7 +139,7 @@
 }
 
 void createHandle (int index) {
-	state |= HANDLE;
+	state |= HANDLE | THEME_BACKGROUND;
 	fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0);
 	if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
 	OS.gtk_fixed_set_has_window (fixedHandle, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
index f9e57f6..da0e74b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
@@ -137,7 +137,7 @@
 }
 
 void createHandle(int index) {
-	state |= HANDLE;
+	state |= HANDLE | THEME_BACKGROUND;
 	handle = OS.g_object_new (display.gtk_fixed_get_type (), 0);
 	if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
 	OS.gtk_fixed_set_has_window (handle, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
index 5d5d680..f33f6d8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
@@ -128,7 +128,7 @@
 }
 
 void createHandle (int index) {
-	state |= HANDLE;
+	state |= HANDLE | THEME_BACKGROUND;
 	handle = OS.g_object_new (display.gtk_fixed_get_type (), 0);
 	if (handle == 0) error (SWT.ERROR_NO_HANDLES);
 	OS.gtk_fixed_set_has_window (handle, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
index 66e7802..4f9f0b3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
@@ -114,7 +114,7 @@
 }
 
 void createHandle (int index) {
-	state |= HANDLE;
+	state |= HANDLE | THEME_BACKGROUND;
 	fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0);
 	if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
 	OS.gtk_fixed_set_has_window (fixedHandle, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
index e1745cd..10ddc94 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
@@ -118,7 +118,7 @@
 }
 
 void createHandle (int index) {
-	state |= HANDLE;
+	state |= HANDLE | THEME_BACKGROUND;
 	fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0);
 	if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
 	OS.gtk_fixed_set_has_window (fixedHandle, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index c3170b5..ffd170b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -74,21 +74,22 @@
 	static final int HIDDEN = 1<<11;
 	static final int FOREGROUND = 1<<12;
 	static final int BACKGROUND = 1<<13;
-	static final int PARENT_BACKGROUND = 1<<14;
-	static final int FONT = 1<<15;
+	static final int FONT = 1<<14;
+	static final int PARENT_BACKGROUND = 1<<15;
+	static final int THEME_BACKGROUND = 1<<16;
 	
 	/* A layout was requested on this widget */
-	static final int LAYOUT_NEEDED	= 1<<16;
+	static final int LAYOUT_NEEDED	= 1<<17;
 	
 	/* The preferred size of a child has changed */
-	static final int LAYOUT_CHANGED = 1<<17;
+	static final int LAYOUT_CHANGED = 1<<18;
 	
 	/* A layout was requested in this widget hierachy */
-	static final int LAYOUT_CHILD = 1<<18;
+	static final int LAYOUT_CHILD = 1<<19;
 
 	/* More global state flags */
-	static final int RELEASED = 1<<19;
-	static final int DISPOSE_SENT = 1<<20;
+	static final int RELEASED = 1<<20;
+	static final int DISPOSE_SENT = 1<<21;
 	
 	/* Default size for widgets */
 	static final int DEFAULT_WIDTH	= 64;
@@ -372,6 +373,7 @@
 void createWidget (int index) {
 	createHandle (index);
 	setOrientation ();
+	setBackground ();
 	hookEvents ();
 	register ();
 }
@@ -1313,6 +1315,9 @@
 	return setInputState (event, keyEvent.state);
 }
 
+void setBackground () {
+}
+
 void setOrientation () {
 }
 
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java
index 3b24054..a77e525 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java
@@ -265,6 +265,7 @@
 	return new Point (width, height);
 }
 void createHandle (int index) {
+	if ((style & SWT.PUSH) == 0) state |= THEME_BACKGROUND;
 	int borderWidth = (style & SWT.BORDER) != 0 ? 1 : 0;
 	int parentHandle = parent.handle;
 	
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java
index d49a1f2..ddf52a9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java
@@ -44,7 +44,7 @@
 	public int embeddedHandle;
 	int focusHandle, damagedRegion, clientWindow;
 	Control [] tabList;
-	int layoutCount = 0;
+	int layoutCount, backgroundMode;
 	
 	static byte [] _XEMBED_INFO = Converter.wcsToMbcs (null, "_XEMBED_INFO", true);
 	static byte[] _XEMBED = Converter.wcsToMbcs (null, "_XEMBED", true);
@@ -223,6 +223,7 @@
 void createHandle (int index) {
 	state |= CANVAS;
 	boolean scroll = (style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0;
+	if (!scroll) state |= THEME_BACKGROUND;
 	createHandle (index, parent.handle, scroll);
 }
 void createHandle (int index, int parentHandle, boolean scrolled) {
@@ -378,6 +379,10 @@
 	display.setWarnings (warnings);
 	return true;
 }
+public int getBackgroundMode () {
+	checkWidget ();
+	return backgroundMode;
+}
 /**
  * Returns a (possibly empty) array containing the receiver's children.
  * Children are returned in the order that they are drawn.
@@ -924,6 +929,10 @@
 	OS.XtFree (event);
 	display.setWarnings (warnings);
 }
+public void setBackgroundMode (int mode) {
+	checkWidget ();
+	backgroundMode = mode;
+}
 void setBackgroundPixel (int pixel) {
 	super.setBackgroundPixel (pixel);
 	if ((state & CANVAS) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java
index 25818bf..29b3e1d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java
@@ -1836,6 +1836,27 @@
 	int x = xEvent.x_root - x_root [0], y = xEvent.y_root - y_root [0];
 	return sendMouseEvent (type, 0, 0, 0, false, xEvent.time, x, y, xEvent.state);
 }
+void setBackground () {
+	Shell shell = getShell ();
+	if (this == shell) return;
+	Composite composite = parent;
+	do {
+		int mode = composite.backgroundMode;
+		if (mode != 0) {
+			if (mode == SWT.INHERIT_DEFAULT) {
+				Control control = this;
+				do {
+					if ((control.state & THEME_BACKGROUND) == 0) return;
+					control = control.parent;
+				} while (control != composite);
+			}
+			state |= PARENT_BACKGROUND;
+			return;
+		}
+		if (composite == shell) break;
+		composite = composite.parent;
+	} while (true);
+}
 /**
  * Sets the receiver's background color to the color specified
  * by the argument, or to the default system color for the control
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java
index 73cdb23..148a0a1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java
@@ -135,7 +135,8 @@
 	}
 	return new Rectangle (trimX, trimY, trimWidth, trimHeight);
 }
-void createHandle (int index) {	
+void createHandle (int index) {
+	state |= THEME_BACKGROUND;
 	/*
 	* Feature in Motif.  When a widget is managed or unmanaged,
 	* it may request and be granted, a new size in the OS.  This
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java
index 70e7d5a..5ee3cce 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java
@@ -227,6 +227,7 @@
 	return new Point (width, height);
 }
 void createHandle (int index) {
+	state |= THEME_BACKGROUND;
 	int parentHandle = parent.handle;
 	int borderWidth = (style & SWT.BORDER) != 0 ? 1 : 0;
 	if ((style & SWT.SEPARATOR) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Link.java
index 5b0be41..27c7c97 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Link.java
@@ -133,6 +133,7 @@
 	return new Point (width, height);
 }
 void createHandle (int index) {
+	state |= THEME_BACKGROUND;
 	int [] argList = {
 		OS.XmNancestorSensitive, 1,
 		OS.XmNborderWidth, (style & SWT.BORDER) != 0 ? 1 : 0,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java
index 8763622..5eddc77 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java
@@ -122,6 +122,7 @@
 	return new Point (width, height);
 }
 void createHandle (int index) {
+	state |= THEME_BACKGROUND;
 	int border = (style & SWT.BORDER) != 0 ? 1 : 0;
 	int [] argList = {
 		OS.XmNborderWidth, border,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java
index c725ba0..a44d819 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java
@@ -118,6 +118,7 @@
 	return new Point (width, height);
 }
 void createHandle (int index) {
+	state |= THEME_BACKGROUND;
 	int [] argList = {
 		OS.XmNtitleString, 0,
 		OS.XmNborderWidth, (style & SWT.BORDER) != 0 ? 1 : 0,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java
index 54db1ae..0169c3d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java
@@ -61,19 +61,20 @@
 	static final int BACKGROUND = 1<<4;
 	static final int FOREGROUND = 1<<5;
 	static final int PARENT_BACKGROUND = 1<<6;
+	static final int THEME_BACKGROUND = 1<<7;
 	
 	/* A layout was requested on this widget */
-	static final int LAYOUT_NEEDED	= 1<<7;
+	static final int LAYOUT_NEEDED	= 1<<8;
 	
 	/* The preferred size of a child has changed */
-	static final int LAYOUT_CHANGED = 1<<8;
+	static final int LAYOUT_CHANGED = 1<<9;
 	
 	/* A layout was requested in this widget hierachy */
-	static final int LAYOUT_CHILD = 1<<9;
+	static final int LAYOUT_CHILD = 1<<10;
 
 	/* More global state flags */
-	static final int RELEASED = 1<<10;
-	static final int DISPOSE_SENT = 1<<11;
+	static final int RELEASED = 1<<11;
+	static final int DISPOSE_SENT = 1<<12;
 	
 	/* Default size for widgets */
 	static final int DEFAULT_WIDTH	= 64;
@@ -298,6 +299,7 @@
 }
 void createWidget (int index) {
 	createHandle (index);
+	setBackground ();
 	hookEvents ();
 	register ();
 	manageChildren ();
@@ -897,6 +899,9 @@
 	}
 	return event.doit;
 }
+void setBackground () {
+	/* Do nothing */
+}
 /**
  * Sets the application defined widget data associated
  * with the receiver to be the argument. The <em>widget
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
index 884dfaf..1ad3c17 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
@@ -440,7 +440,7 @@
 	return widget_tile;
 }
 
-/*public*/ int getBackgroundMode () {
+public int getBackgroundMode () {
 	checkWidget ();
 	return backgroundMode;
 }
@@ -924,10 +924,9 @@
 	}
 }
 
-/*public*/ void setBackgroundMode (int mode) {
+public void setBackgroundMode (int mode) {
 	checkWidget ();
 	backgroundMode = mode;
-	//NOT IMPLEMENTED
 }
 
 int setBounds (int x, int y, int width, int height, boolean move, boolean resize, boolean events) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
index e54e886..64e6dc8 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
@@ -2155,7 +2155,6 @@
 	}
 	if (backgroundImage == image) return;
 	backgroundImage = image;
-	//NOT IMPLEMENTED
 }
 
 void setBackgroundPixel (int pixel) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
index cb6fa63..a3a3744 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
@@ -295,7 +295,7 @@
  * 
  * @since 3.2
  */
-/*public*/ int getBackgroundMode () {
+public int getBackgroundMode () {
 	checkWidget ();
 	return backgroundMode;
 }
@@ -717,13 +717,9 @@
  * 
  * @since 3.2
  */
-/*public*/ void setBackgroundMode (int mode) {
+public void setBackgroundMode (int mode) {
 	checkWidget ();
 	backgroundMode = mode;
-	Control [] children = _getChildren ();
-	for (int i=0; i<children.length; i++) {
-		children [i].updateBackgroundMode (mode);
-	}
 }
 
 boolean setFixedFocus () {
@@ -913,15 +909,6 @@
 	}
 }
 
-void updateBackgroundMode (int mode) {
-	if (backgroundMode != SWT.INHERIT_NONE) return;
-	super.updateBackgroundMode (mode);
-	Control [] children = _getChildren ();
-	for (int i=0; i<children.length; i++) {
-		children [i].updateBackgroundMode (mode);
-	}
-}
-
 void updateFont (Font oldFont, Font newFont) {
 	super.updateFont (oldFont, newFont);
 	Control [] children = _getChildren ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index 01c480b..d544f14 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
@@ -343,20 +343,6 @@
 	return handle;
 }
 
-void checkBackground () {
-	Shell shell = getShell ();
-	Composite control = parent;
-	do {
-		int mode = control.backgroundMode;
-		if (mode != 0) {
-			updateBackgroundMode (mode);
-			return;
-		}
-		if (control == shell) break;
-		control = control.parent;
-	} while (control != null);
-}
-
 void checkBorder () {
 	if (getBorderWidth () == 0) style &= ~SWT.BORDER;
 }
@@ -514,9 +500,9 @@
 	register ();
 	subclass ();
 	setDefaultFont ();
+	setBackground ();
 	checkMirrored ();
 	checkBorder ();
-	checkBackground ();
 }
 
 int defaultBackground () {
@@ -1976,6 +1962,36 @@
 	return true;
 }
 
+void setBackground () {
+	Shell shell = getShell ();
+	if (this == shell) return;
+	Composite composite = parent;
+	do {
+		int mode = composite.backgroundMode;
+		if (mode != 0) {
+			if (mode == SWT.INHERIT_DEFAULT) {
+				Control control = this;
+				do {
+					if ((control.state & THEME_BACKGROUND) == 0) return;
+					control = control.parent;
+				} while (control != composite);
+			}
+			state |= PARENT_BACKGROUND;
+			Control control = findBackgroundControl ();
+			if (control == null) return;
+			if (control.backgroundImage != null) {
+				shell.releaseBrushes ();
+				updateBackgroundImage ();		
+			} else {
+				updateBackgroundColor ();
+			}
+			return;
+		}
+		if (composite == shell) break;
+		composite = composite.parent;
+	} while (true);
+}
+
 /**
  * Sets the receiver's background color to the color specified
  * by the argument, or to the default system color for the control
@@ -3082,33 +3098,6 @@
 	setBackgroundImage (image != null ? image.handle : 0);
 }
 
-void updateBackgroundMode (int mode) {
-	Control control = null;
-	switch (mode) {
-		case SWT.INHERIT_NONE:
-			if ((state & PARENT_BACKGROUND) == 0) return;
-			control = findBackgroundControl ();
-			state &= ~PARENT_BACKGROUND;
-			break;
-		case SWT.INHERIT_DEFAULT:
-			if ((state & THEME_BACKGROUND) == 0) break;
-			//FALL THROUGH
-		case SWT.INHERIT_FORCE:
-			if ((state & PARENT_BACKGROUND) != 0) return;
-			state |= PARENT_BACKGROUND;
-			control = findBackgroundControl ();
-			break;
-	}
-	if (control == null) return;
-	if (control.backgroundImage != null) {
-		Shell shell = getShell ();
-		shell.releaseBrushes ();
-		updateBackgroundImage ();		
-	} else {
-		updateBackgroundColor ();
-	}
-}
-
 void updateFont (Font oldFont, Font newFont) {
 	if (getFont ().equals (oldFont)) setFont (newFont);
 }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
index 35a7504..611d92a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
@@ -433,10 +433,6 @@
 	return OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
-void checkBackground () {
-	/* Do nothing */
-}
-
 /**
  * Requests that the window manager close the receiver in
  * the same way it would be closed when the user clicks on