Index: trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Composite.java
===================================================================
--- trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Composite.java	(revision 187)
+++ trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Composite.java	(revision 188)
@@ -505,5 +505,5 @@
 int widgetStyle () {
 	/* Temporary code to force SWT.CLIP_SIBLINGS */
-	return super.widgetStyle ();// | OS.WS_CLIPCHILDREN;
+	return super.widgetStyle (); // | OS.WS_CLIPCHILDREN;
 }
 
@@ -523,5 +523,10 @@
 //  And may be better to move this code to Decorations class...
 MRESULT WM_ERASEBACKGROUND (int mp1, int mp2) {
+//    System.out.println("Composite::WM_ERASEBACKGROUND -> HANDLE = " + Integer.toHexString(handle));
     if ((state & CANVAS) != 0) {
+        //@@TODO(lpino): This invalidation forces a whole window repaint to prevent clipping errors when window is partially obscure
+        //it has a negative impact on performance. As my understanding improves maybe this problem can be solved 
+        OS.WinInvalidateRect(handle, null, true);
+//        OS.WinUpdateWindow(handle);
         return super.WM_ERASEBACKGROUND (mp1, mp2);
     }
@@ -529,5 +534,5 @@
     OS.objcpy (rcl, mp2);
     drawBackground (mp1, rcl);
-    return MRESULT.FALSE;
+    return MRESULT.TRUE;
 }
 
@@ -556,16 +561,16 @@
 //	return new LRESULT (font);
 //}
-//
-//LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
-//	LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);
-//
-//	/* Set focus for a canvas with no children */
-//	if ((state & CANVAS) != 0) {
-//		if ((style & SWT.NO_FOCUS) != 0) return result;
-//		if (OS.GetWindow (handle, OS.GW_CHILD) == 0) setFocus ();
-//	}
-//	return result;
-//}
-//
+
+MRESULT WM_BUTTON1DOWN (int mp1, int mp2) {
+	MRESULT result = super.WM_BUTTON1DOWN (mp1, mp2);
+
+	/* Set focus for a canvas with no children */
+	if ((state & CANVAS) != 0) {
+		if ((style & SWT.NO_FOCUS) != 0) return result;
+		if (OS.WinQueryWindow (handle, OS.QW_TOP) == 0) setFocus ();
+	}
+	return result;
+}
+
 //LRESULT WM_NOTIFY (int wParam, int lParam) {
 //	if (!OS.IsWinCE) {
@@ -627,6 +632,5 @@
     if ((state & CANVAS) == 0) {
 		return super.WM_PAINT (mp1, mp2);
-	}
-
+    }
     /*
 	* This code is intentionally commented.  Don't exit
@@ -639,5 +643,6 @@
 //	if (!hooks (SWT.Paint)) return null;
     /* lazily obtain a long-term cached micro presentation space */
-	GCData data = new GCData ();
+//    System.out.println("Composite::WM_PAINT -> HANDLE  =  " + Integer.toHexString(handle));
+    GCData data = new GCData ();
     if (hps == 0) {
         hps = internal_new_GC (data);
@@ -645,33 +650,32 @@
         data.doInit = true;
     }
-
-	/* Get the damage */
-    int [] rgnRects = null;
+//	/* Get the damage */
+        int [] rgnRects = null;
 	boolean isComplex = false;
 	boolean exposeRegion = false;
 	if ((style & SWT.NO_MERGE_PAINTS) != 0) {
-        int hrgn = OS.GpiCreateRegion (hps, 0, null);
-        isComplex = OS.WinQueryUpdateRegion (handle, hrgn) == OS.RGN_COMPLEX;
-        if (isComplex) {
-            RGNRECT rgnctl = new RGNRECT();
-            rgnctl.ircStart = 1;
-            rgnctl.ulDirection = OS.RECTDIR_LFRT_TOPBOT;
-            exposeRegion = OS.GpiQueryRegionRects (hps, hrgn, null, rgnctl, null);
-            if (exposeRegion) {
-                rgnRects = new int [rgnctl.crcReturned * 4];
-                rgnctl.crc = rgnctl.crcReturned;
-                exposeRegion = OS.GpiQueryRegionRects (hps, hrgn, null, rgnctl, rgnRects);
+            int hrgn = OS.GpiCreateRegion (hps, 0, null);
+            isComplex = OS.WinQueryUpdateRegion (handle, hrgn) == OS.RGN_COMPLEX;
+            if (isComplex) {
+                RGNRECT rgnctl = new RGNRECT();
+                rgnctl.ircStart = 1;
+                rgnctl.ulDirection = OS.RECTDIR_LFRT_TOPBOT;
+                exposeRegion = OS.GpiQueryRegionRects (hps, hrgn, null, rgnctl, null);
+                if (exposeRegion) {
+                    rgnRects = new int [rgnctl.crcReturned * 4];
+                    rgnctl.crc = rgnctl.crcReturned;
+                    exposeRegion = OS.GpiQueryRegionRects (hps, hrgn, null, rgnctl, rgnRects);
+                }
             }
+            OS.GpiDestroyRegion (hps, hrgn);
         }
-        OS.GpiDestroyRegion (hps, hrgn);
-    }
-
-	/* Set the clipping bits */
-	int oldBits = 0;
+
+//	/* Set the clipping bits */
+    int oldBits = 0;
     oldBits = OS.WinQueryWindowULong (handle, OS.QWL_STYLE);
     int newBits = oldBits | OS.WS_CLIPSIBLINGS | OS.WS_CLIPCHILDREN;	
     OS.WinSetWindowULong (handle, OS.QWL_STYLE, newBits);
 
-	/* Create the paint GC */
+//	/* Create the paint GC */
     data.rcl = new RECTL ();
     data.hps = hps;
@@ -681,5 +685,4 @@
 //    int ahps = gc.handle;
     int height = getHeight ();
-	
     /*
      *  Feature in OS/2. When resizing a window that doesn't have the
@@ -688,8 +691,5 @@
      *  situation and don't send an SWT.Paint event.
      */
-    if ((style & SWT.NO_REDRAW_RESIZE) == 0 ||
-        (data.rcl.xRight != data.rcl.xLeft) ||
-        (data.rcl.yTop != data.rcl.yBottom))
-    {
+    if ((style & SWT.NO_REDRAW_RESIZE) == 0 || (data.rcl.xRight != data.rcl.xLeft) || (data.rcl.yTop != data.rcl.yBottom)) {
         /* Send the paint event */
         Event event = new Event ();
@@ -711,10 +711,14 @@
                 rcl.xRight = rgnRects [(i << 2) + 2];
                 rcl.yTop = rgnRects [(i << 2) + 3];
-                drawBackground (0, rcl);
+//     System.out.println("Control::drawBackground -> xLeft = " + rcl.xLeft);
+//     System.out.println("Control::drawBackground -> xRight = " + rcl.xRight);
+//     System.out.println("Control::drawBackground -> yBottom = " + rcl.yBottom);
+//     System.out.println("Control::drawBackground -> yTop = " + rcl.yTop);
+               drawBackground (0, rcl);
                 event.x = rcl.xLeft;
                 event.y = height - rcl.yTop;
                 event.width = rcl.xRight - rcl.xLeft;
                 event.height = rcl.yTop - rcl.yBottom;
-    			event.count = nCount - 1 - i;
+    		  event.count = nCount - 1 - i;
                 /*
                  *  Restore the clip region if was set by the last paint listener.
@@ -765,5 +769,5 @@
         OS.WinSetWindowULong (handle, OS.QWL_STYLE, oldBits);
     }
-	return MRESULT.ZERO;
+    return MRESULT.ZERO;
 }
 
