changeset 25:fc2b263b8a3f

Merged back the System.arraycopy and use a System class
author Frank Benoit <benoit@tionex.de>
date Tue, 08 Jan 2008 01:23:25 +0100
parents bc06000c0816
children 09f5459a5014
files dwt/SWT.d dwt/dwthelper/System.d dwt/dwthelper/utils.d dwt/graphics/Device.d dwt/graphics/GC.d dwt/graphics/Image.d dwt/graphics/ImageData.d dwt/graphics/Path.d dwt/graphics/TextLayout.d dwt/internal/image/GIFFileFormat.d dwt/internal/image/JPEGDecoder.d dwt/internal/image/JPEGFileFormat.d dwt/internal/image/JPEGFrameHeader.d dwt/internal/image/JPEGHuffmanTable.d dwt/internal/image/JPEGQuantizationTable.d dwt/internal/image/JPEGScanHeader.d dwt/internal/image/LEDataInputStream.d dwt/internal/image/LZWCodec.d dwt/internal/image/OS2BMPFileFormat.d dwt/internal/image/PNGFileFormat.d dwt/internal/image/PngChunk.d dwt/internal/image/PngIdatChunk.d dwt/internal/image/PngInputStream.d dwt/internal/image/TIFFDirectory.d dwt/internal/image/TIFFRandomFileAccess.d dwt/internal/image/WinBMPFileFormat.d dwt/internal/image/WinICOFileFormat.d dwt/widgets/Caret.d dwt/widgets/Control.d dwt/widgets/Display.d dwt/widgets/EventTable.d dwt/widgets/Listener.d dwt/widgets/Menu.d dwt/widgets/Monitor.d dwt/widgets/Shell.d dwt/widgets/Synchronizer.d dwt/widgets/Tray.d dwt/widgets/Widget.d todo.txt
diffstat 39 files changed, 10458 insertions(+), 627 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/SWT.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/SWT.d	Tue Jan 08 01:23:25 2008 +0100
@@ -17,6 +17,8 @@
 import dwt.SWTError;
 import dwt.SWTException;
 
+public import dwt.dwthelper.utils;
+
 import tango.core.Exception;
 
 /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/dwthelper/System.d	Tue Jan 08 01:23:25 2008 +0100
@@ -0,0 +1,118 @@
+module dwt.dwthelper.System;
+
+import tango.core.Exception;
+
+template SimpleType(T) {
+    debug{
+        static void validCheck(uint SrcLen, uint DestLen, uint copyLen){
+            if(SrcLen < copyLen || DestLen < copyLen|| SrcLen < 0 || DestLen < 0){
+                Util.trace("Error : SimpleType.arraycopy(), out of bounds.");
+                assert(0);
+            }
+        }
+    }
+
+    static void remove(inout T[] items, int index) {
+        if(items.length == 0)
+            return;
+
+        if(index < 0 || index >= items.length){
+            throw new ArrayBoundsException(__FILE__, __LINE__);
+        }
+
+        T element = items[index];
+
+        int length = items.length;
+        if(length == 1){
+            items.length = 0;
+            return;// element;
+        }
+
+        if(index == 0)
+            items = items[1 .. $];
+        else if(index == length - 1)
+            items = items[0 .. index];
+        else
+            items = items[0 .. index] ~ items[index + 1 .. $];
+    }
+
+    static void insert(inout T[] items, T item, int index = -1) {
+        if(index == -1)
+            index = items.length;
+
+        if(index < 0 || index > items.length ){
+            throw new ArrayBoundsException(__FILE__, __LINE__);
+        }
+
+        if(index == items.length){
+            items ~= item;
+        }else if(index == 0){
+            T[] newVect;
+            newVect ~= item;
+            items = newVect ~ items;
+        }else if(index < items.length ){
+            T[] arr1 = items[0 .. index];
+            T[] arr2 = items[index .. $];
+
+            // Important : if you write like the following commented,
+            // you get wrong data
+            // code:  T[] arr1 = items[0..index];
+            //        T[] arr2 = items[index..$];
+            //        items = arr1 ~ item;      // error, !!!
+            //        items ~= arr2;            // item replace the arrr2[0] here
+            items = arr1 ~ item ~ arr2;
+        }
+    }
+
+    static void arraycopy(T[] src, uint srcPos, T[] dest, uint destPos, uint len)
+    {
+        if(len == 0) return;
+
+        assert(src);
+        assert(dest);
+        debug{validCheck(src.length - srcPos, dest.length - destPos, len);}
+
+        if(src is dest){
+            for(int i=0; i<len; ++i){
+                dest[destPos+i] = src[srcPos+i];
+            }
+        }else{
+            dest[destPos..(len+destPos)] = src[srcPos..(len+srcPos)];
+        }
+    }
+}
+
+
+class System {
+
+    alias SimpleType!(int).arraycopy arraycopy;
+    alias SimpleType!(byte).arraycopy arraycopy;
+    alias SimpleType!(double).arraycopy arraycopy;
+    alias SimpleType!(float).arraycopy arraycopy;
+    alias SimpleType!(short).arraycopy arraycopy;
+    alias SimpleType!(long).arraycopy arraycopy;
+    alias SimpleType!(uint).arraycopy arraycopy;
+    alias SimpleType!(ushort).arraycopy arraycopy;
+    alias SimpleType!(ubyte).arraycopy arraycopy;
+    alias SimpleType!(ulong).arraycopy arraycopy;
+    alias SimpleType!(char).arraycopy arraycopy;
+    alias SimpleType!(wchar).arraycopy arraycopy;
+    alias SimpleType!(Object).arraycopy arraycopy;
+    alias SimpleType!(void*).arraycopy arraycopy;
+
+    alias SimpleType!(int[]).arraycopy arraycopy;
+    alias SimpleType!(byte[]).arraycopy arraycopy;
+    alias SimpleType!(double[]).arraycopy arraycopy;
+    alias SimpleType!(float[]).arraycopy arraycopy;
+    alias SimpleType!(short[]).arraycopy arraycopy;
+    alias SimpleType!(long[]).arraycopy arraycopy;
+    alias SimpleType!(uint[]).arraycopy arraycopy;
+    alias SimpleType!(ushort[]).arraycopy arraycopy;
+    alias SimpleType!(ubyte[]).arraycopy arraycopy;
+    alias SimpleType!(ulong[]).arraycopy arraycopy;
+    alias SimpleType!(char[]).arraycopy arraycopy;
+    alias SimpleType!(wchar[]).arraycopy arraycopy;
+    alias SimpleType!(Object[]).arraycopy arraycopy;
+    alias SimpleType!(void*[]).arraycopy arraycopy;
+}
+
--- a/dwt/dwthelper/utils.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/dwthelper/utils.d	Tue Jan 08 01:23:25 2008 +0100
@@ -3,6 +3,8 @@
  */
 module dwt.dwthelper.utils;
 
+public import dwt.dwthelper.System;
+
 import tango.io.Stdout;
 import tango.stdc.stdlib : exit;
 
--- a/dwt/graphics/Device.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/graphics/Device.d	Tue Jan 08 01:23:25 2008 +0100
@@ -461,7 +461,9 @@
 		        Font font = Font.gtk_new(this, fontDesc);
 		        FontData data = font.getFontData()[0];
 				if (nFds == fds.length) {
-					fds.length = fds.length + n_families;
+                    FontData[] newFds = new FontData[fds.length + n_families];
+                    System.arraycopy(fds, 0, newFds, 0, nFds);
+                    fds = newFds;
 				}
 				fds[nFds++] = data;
 				OS.pango_font_description_free(fontDesc);
@@ -473,7 +475,9 @@
 	OS.g_free(families);
 	OS.g_object_unref(context);
 	if (nFds == fds.length) return fds;
-	return fds[ 0 .. nFds ].dup;
+    FontData[] result = new FontData[nFds];
+    System.arraycopy(fds, 0, result, 0, nFds);
+    return result;
 }
 
 /**
@@ -723,13 +727,14 @@
 			return;
 		}
 	}
-    int oldLen = objects.length;
-    objects.length = objects.length + 128;
-    objects[ oldLen ] = object;
-
-    oldLen = errors.length;
-    errors.length = errors.length + 128;
-    errors[ oldLen ] = new TracedException ("");
+    Object [] newObjects = new Object [objects.length + 128];
+    System.arraycopy (objects, 0, newObjects, 0, objects.length);
+    newObjects [objects.length] = object;
+    objects = newObjects;
+    TracedException [] newErrors = new TracedException [errors.length + 128];
+    System.arraycopy (errors, 0, newErrors, 0, errors.length);
+    newErrors [errors.length] = new TracedException ("");
+    errors = newErrors;
 }
 
 static synchronized void register (Device device) {
@@ -739,9 +744,10 @@
 			return;
 		}
 	}
-    int oldLen = Devices.length;
-    Devices.length = Devices.length + 128;
-    Devices[ oldLen ] = device;
+    Device [] newDevices = new Device [Devices.length + 4];
+    System.arraycopy (Devices, 0, newDevices, 0, Devices.length);
+    newDevices [Devices.length] = device;
+    Devices = newDevices;
 }
 
 /**
--- a/dwt/graphics/GC.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/graphics/GC.d	Tue Jan 08 01:23:25 2008 +0100
@@ -2562,7 +2562,8 @@
 	if (handle is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
 	float[] dashes = null;
 	if (data.lineDashes !is null) {
-		dashes = data.lineDashes.dup;
+        dashes = new float[data.lineDashes.length];
+        System.arraycopy(data.lineDashes, 0, dashes, 0, dashes.length);
 	}
 	return new LineAttributes(data.lineWidth, data.lineCap, data.lineJoin, data.lineStyle, dashes, data.lineDashesOffset, data.lineMiterLimit);
 }
@@ -3515,7 +3516,9 @@
 			if (!changed && lineDashes[i] !is dash) changed = true;
 		}
 		if (changed) {
-			dashes = dashes.dup;
+            float[] newDashes = new float[dashes.length];
+            System.arraycopy(dashes, 0, newDashes, 0, dashes.length);
+            dashes = newDashes;
 			mask |= LINE_STYLE;
 		} else {
 			dashes = lineDashes;
@@ -3721,15 +3724,14 @@
 	char[] text = str.dup;
 	if ((flags & SWT.DRAW_MNEMONIC) !is 0 && (mnemonic = fixMnemonic(text)) !is -1) {
 		char[] text1 = new char[mnemonic - 1];
-        text1[] = text[0 .. text1.length];
+        System.arraycopy(text, 0, text1, 0, text1.length);
 		char[] buffer1 = text1.dup;
 		char[] text2 = new char[text.length - mnemonic];
-        text2[] = text[0 .. text2.length];
+        System.arraycopy(text, mnemonic - 1, text2, 0, text2.length);
 		char[] buffer2 = text2.dup;
 		buffer = new char[buffer1.length + buffer2.length];
-        buffer[0 .. buffer1.length] = buffer1[];
-        buffer[buffer1.length .. buffer1.length+buffer2.length] =
-            buffer2[];
+        System.arraycopy(buffer1, 0, buffer, 0, buffer1.length);
+        System.arraycopy(buffer2, 0, buffer, buffer1.length, buffer2.length);
 		auto attr_list = OS.pango_attr_list_new();
 		auto attr = OS.pango_attr_underline_new(cast(PangoUnderline)OS.PANGO_UNDERLINE_LOW);
 		attr.start_index = buffer1.length;
--- a/dwt/graphics/Image.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/graphics/Image.d	Tue Jan 08 01:23:25 2008 +0100
@@ -278,7 +278,8 @@
 	if (flag != SWT.IMAGE_DISABLE) transparentPixel = srcImage.transparentPixel;
 	alpha = srcImage.alpha;
 	if (srcImage.alphaData != null) {
-		alphaData = srcImage.alphaData.dup;
+        alphaData = new byte[srcImage.alphaData.length];
+        System.arraycopy(srcImage.alphaData, 0, alphaData, 0, alphaData.length);
 	}
 	createAlphaMask(width, height);
 
@@ -620,7 +621,7 @@
 			} else {
 				byte[] line = new byte[gdkImage.bpl];
 				for (int y = 0; y < height; y++) {
-                    line[ 0 .. width ] = alphaData[ width * y .. width * y + width ];
+                    System.arraycopy(alphaData, width * y, line, 0, width);
 					memmove(gdkImage.mem + (gdkImage.bpl * y), line.ptr, gdkImage.bpl);
 				}
 			}
@@ -925,7 +926,8 @@
 	data.transparentPixel = transparentPixel;
 	data.alpha = alpha;
 	if (alpha == -1 && alphaData != null) {
-		data.alphaData = alphaData.dup;
+        data.alphaData = new byte[alphaData.length];
+        System.arraycopy(alphaData, 0, data.alphaData, 0, alphaData.length);
 	}
 	return data;
 }
@@ -1074,7 +1076,8 @@
 		this.mask = null;
 		this.alpha = image.alpha;
 		if (image.alpha == -1 && image.alphaData != null) {
-			this.alphaData = image.alphaData.dup;
+            this.alphaData = new byte[image.alphaData.length];
+            System.arraycopy(image.alphaData, 0, this.alphaData, 0, alphaData.length);
 		}
 		createAlphaMask(width, height);
 	}
--- a/dwt/graphics/ImageData.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/graphics/ImageData.d	Tue Jan 08 01:23:25 2008 +0100
@@ -546,14 +546,17 @@
  * @return a copy of the receiver.
  */
 public Object clone() {
-	byte[] cloneData = data.dup;
+	byte[] cloneData = new byte[data.length];
+    System.arraycopy(data, 0, cloneData, 0, data.length);
 	byte[] cloneMaskData = null;
 	if (maskData != null) {
-		cloneMaskData = maskData.dup;
+        cloneMaskData = new byte[maskData.length];
+        System.arraycopy(maskData, 0, cloneMaskData, 0, maskData.length);
 	}
 	byte[] cloneAlphaData = null;
 	if (alphaData != null) {
-		cloneAlphaData = alphaData.dup;
+        cloneAlphaData = new byte[alphaData.length];
+        System.arraycopy(alphaData, 0, cloneAlphaData, 0, alphaData.length);
 	}
 	return new ImageData(
 		width,
@@ -624,8 +627,7 @@
 		return;
 	}
 	// may throw an IndexOutOfBoundsException
-    int from = y * width + x;
-    alphas[ startIndex .. startIndex + getWidth ] = alphaData[ from .. from + getWidth ];
+    System.arraycopy(alphaData, y * width + x, alphas, startIndex, getWidth);
 }
 
 /**
@@ -1191,8 +1193,7 @@
 
 	if (alphaData == null) alphaData = new byte[width * height];
 	// may throw an IndexOutOfBoundsException
-    int from = y * width + x;
-    alphaData[ from .. from + putWidth ] = alphas[ startIndex .. startIndex+putWidth ];
+    System.arraycopy(alphas, startIndex, alphaData, y * width + x, putWidth);
 }
 
 /**
@@ -1655,7 +1656,7 @@
 	byte[] newData = new byte[height * newBpl];
 	int srcIndex = 0, destIndex = 0;
 	for (int y = 0; y < height; y++) {
-        newData[ destIndex .. destIndex + stride ] = data[ srcIndex .. srcIndex + stride ];
+        System.arraycopy(data, srcIndex, newData, destIndex, stride);
 		srcIndex += bpl;
 		destIndex += newBpl;
 	}
--- a/dwt/graphics/Path.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/graphics/Path.d	Tue Jan 08 01:23:25 2008 +0100
@@ -453,10 +453,14 @@
 		}
 	}
 	if (typeIndex != types.length) {
-		types.length = typeIndex;
+        byte[] newTypes = new byte[typeIndex];
+        System.arraycopy(types, 0, newTypes, 0, typeIndex);
+        types = newTypes;
 	}
 	if (ptsIndex != pts.length) {
-        pts.length = ptsIndex;
+        float[] newPts = new float[ptsIndex];
+        System.arraycopy(pts, 0, newPts, 0, ptsIndex);
+        pts = newPts;
 	}
 	Cairo.cairo_path_destroy(copy);
 	PathData result = new PathData();
--- a/dwt/graphics/TextLayout.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/graphics/TextLayout.d	Tue Jan 08 01:23:25 2008 +0100
@@ -1141,7 +1141,9 @@
 		}
 	}
 	if (count != result.length) {
-		result.length = count;
+        int[] newResult = new int[count];
+        System.arraycopy(result, 0, newResult, 0, count);
+        result = newResult;
 	}
 	return result;
 }
@@ -1219,10 +1221,10 @@
 	int length = text.length;
 	if (!(0 <= offset && offset < length)) SWT.error(SWT.ERROR_INVALID_RANGE);
 	for (int i=1; i<styles.length; i++) {
-		StyleItem item = styles[i];
-		if (item.start > offset) {
-			return styles[i - 1].style;
-		}
+        StyleItem item = styles[i];
+        if (item.start > offset) {
+            return styles[i - 1].style;
+        }
 	}
 	return null;
 }
@@ -1250,7 +1252,9 @@
 		}
 	}
 	if (count != result.length) {
-        result.length = count;
+        TextStyle[] newResult = new TextStyle[count];
+        System.arraycopy(result, 0, newResult, 0, count);
+        result = newResult;
 	}
 	return result;
 }
@@ -1606,7 +1610,7 @@
 		}
 		if (styleStart !is start && styleEnd !is end) {
 			StyleItem[] newStyles = new StyleItem[styles.length + 2];
-            newStyles[ 0 .. modifyStart + 1] = styles[ 0 .. modifyStart + 1 ];
+            System.arraycopy(styles, 0, newStyles, 0, modifyStart + 1);
 			StyleItem item = new StyleItem();
 			item.start = start;
 			item.style = style;
@@ -1615,8 +1619,7 @@
 			item.start = end + 1;
 			item.style = styles[modifyStart].style;
 			newStyles[modifyStart + 2] = item;
-            newStyles[ modifyStart + 3 .. modifyStart + 3 + styles.length - modifyEnd - 1] =
-                styles[ modifyStart + 1 .. modifyStart + 1 + styles.length - modifyEnd - 1 ];
+            System.arraycopy(styles, modifyEnd + 1, newStyles, modifyEnd + 3, styles.length - modifyEnd - 1);
 			styles = newStyles;
 			return;
 		}
@@ -1625,14 +1628,13 @@
 	if (end is styles[modifyEnd + 1].start - 1) modifyEnd++;
 	int newLength = styles.length + 1 - (modifyEnd - modifyStart - 1);
 	StyleItem[] newStyles = new StyleItem[newLength];
-    newStyles[ 0 .. modifyStart + 1 ] = styles[ 0 .. modifyStart + 1 ];
+    System.arraycopy(styles, 0, newStyles, 0, modifyStart + 1);
 	StyleItem item = new StyleItem();
 	item.start = start;
 	item.style = style;
 	newStyles[modifyStart + 1] = item;
 	styles[modifyEnd].start = end + 1;
-    newStyles[ modifyStart + 2 .. modifyStart + 2 + styles.length - modifyEnd ] =
-        styles[ modifyEnd .. modifyEnd + styles.length - modifyEnd ];
+    System.arraycopy(styles, modifyEnd, newStyles, modifyStart + 2, styles.length - modifyEnd);
 	styles = newStyles;
 }
 
--- a/dwt/internal/image/GIFFileFormat.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/GIFFileFormat.d	Tue Jan 08 01:23:25 2008 +0100
@@ -117,7 +117,11 @@
 			if (loader.hasListeners()) {
 				loader.notifyListeners(new ImageLoaderEvent(loader, image, 3, true));
 			}
-            images ~= image;
+            ImageData[] oldImages = images;
+            images = new ImageData[oldImages.length + 1];
+            System.arraycopy(oldImages, 0, images, 0, oldImages.length);
+            images[images.length - 1] = image;
+            //images ~= image;
 			try {
 				/* Read the 0-byte terminator at the end of the image. */
 				id = inputStream.read();
@@ -219,7 +223,11 @@
 			byte[] block = new byte[255];
 			int size = inputStream.read();
 			while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
-                comment ~= block[ 0 .. size ];
+                byte[] oldComment = comment;
+                comment = new byte[oldComment.length + size];
+                System.arraycopy(oldComment, 0, comment, 0, oldComment.length);
+                System.arraycopy(block, 0, comment, oldComment.length, size);
+                //comment ~= block[ 0 .. size ];
 				size = inputStream.read();
 			}
 			return comment;
@@ -246,7 +254,11 @@
 			byte[] block = new byte[255];
 			int size = inputStream.read();
 			while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
-                text ~= block[ 0 .. size ];
+                byte[] oldText = text;
+                text = new byte[oldText.length + size];
+                System.arraycopy(oldText, 0, text, 0, oldText.length);
+                System.arraycopy(block, 0, text, oldText.length, size);
+                //text ~= block[ 0 .. size ];
 				size = inputStream.read();
 			}
 			return text;
@@ -312,7 +324,11 @@
 			byte[] block = new byte[255];
 			int size = inputStream.read();
 			while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
-                data ~= block[ 0 .. size ];
+                byte[] oldData = data;
+                data = new byte[oldData.length + size];
+                System.arraycopy(oldData, 0, data, 0, oldData.length);
+                System.arraycopy(block, 0, data, oldData.length, size);
+                //data ~= block[ 0 .. size ];
 				size = inputStream.read();
 			}
 			// Look for the NETSCAPE 'repeat count' field for an animated GIF.
--- a/dwt/internal/image/JPEGDecoder.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/JPEGDecoder.d	Tue Jan 08 01:23:25 2008 +0100
@@ -2555,8 +2555,7 @@
 	for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++)
 		table[i+offset] = cast(byte)MAXJSAMPLE;
 	/* Second half of post-IDCT table */
-    table[offset + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE) .. offset + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE) + CENTERJSAMPLE] =
-        cinfo.sample_range_limit[ cinfo.sample_range_limit_offset .. cinfo.sample_range_limit_offset +CENTERJSAMPLE ];
+    System.arraycopy(cinfo.sample_range_limit, cinfo.sample_range_limit_offset, table, offset + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE), CENTERJSAMPLE);
 }
 
 static void build_ycc_rgb_table (jpeg_decompress_struct cinfo) {
@@ -3430,7 +3429,7 @@
   for (row = num_rows; row > 0; row--) {
     inptr = input_array[input_array_offset++];
     outptr = output_array[output_array_offset++];
-    outptr[ 0 .. count ] = inptr[ 0 .. count ];
+    System.arraycopy(inptr, 0, outptr, 0, count);
   }
 }
 
@@ -3957,7 +3956,7 @@
 			for (block_num = 0; block_num <= last_block_column; block_num++) {
 				/* Fetch current DCT block into workspace so we can modify it. */
 //				jcopy_block_row(buffer_ptr, workspace, 1);
-                workspace[] = buffer_ptr[buffer_ptr_offset][ 0 .. workspace.length ];
+                System.arraycopy(buffer_ptr[buffer_ptr_offset], 0, workspace, 0, workspace.length);
 				/* Update DC values */
 				if (block_num < last_block_column) {
 					DC3 = prev_block_row[1+prev_block_row_offset][0];
@@ -4455,8 +4454,8 @@
 			error();
 //			ERREXIT1(cinfo, JERR_DHT_INDEX, index);
 
-        htblptr.bits[0 .. bits.length ] = bits;
-		htblptr.huffval[ 0 .. huffval.length ] = huffval;
+        System.arraycopy(bits, 0, htblptr.bits, 0, bits.length);
+        System.arraycopy(huffval, 0, htblptr.huffval, 0, huffval.length);
 	}
 
 	if (length != 0)
@@ -5972,7 +5971,7 @@
 //			ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
 		/* OK, save away the quantization table */
 		qtbl = new JQUANT_TBL();
-        qtbl.quantval[] = cinfo.quant_tbl_ptrs[qtblno].quantval[ 0 .. qtbl.quantval.length ];
+        System.arraycopy(cinfo.quant_tbl_ptrs[qtblno].quantval, 0, qtbl.quantval, 0, qtbl.quantval.length);
 		qtbl.sent_table = cinfo.quant_tbl_ptrs[qtblno].sent_table;
 		compptr.quant_table = qtbl;
 	}
@@ -6366,7 +6365,7 @@
 			while (cinfo.output_scanline < cinfo.output_height) {
 				int offset = row_stride * cinfo.output_scanline;
 				jpeg_read_scanlines(cinfo, buffer, 1);
-                data[ offset .. offset+row_stride ] = buffer[0][ 0 .. row_stride ];
+                System.arraycopy(buffer[0], 0, data, offset, row_stride);
 			}
 			jpeg_finish_output(cinfo);
 			loader.notifyListeners(new ImageLoaderEvent(loader, cast(ImageData)imageData.clone(), incrementCount, done = jpeg_input_complete(cinfo)));
@@ -6375,7 +6374,7 @@
 		while (cinfo.output_scanline < cinfo.output_height) {
 			int offset = row_stride * cinfo.output_scanline;
 			jpeg_read_scanlines(cinfo, buffer, 1);
-            data[ offset .. offset+row_stride ] = buffer[0][ 0 .. row_stride ];
+            System.arraycopy(buffer[0], 0, data, offset, row_stride);
 		}
 	}
 	jpeg_finish_decompress(cinfo);
--- a/dwt/internal/image/JPEGFileFormat.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/JPEGFileFormat.d	Tue Jan 08 01:23:25 2008 +0100
@@ -182,7 +182,7 @@
 	for (int yPos = 0; yPos < srcHeight; yPos++) {
 		int srcOfs = yPos * srcWidth;
 		int dstOfs = yPos * frameComponent[CW];
-        imageComponents[ID_Y][ dstOfs .. dstOfs+srcWidth] = dataYComp[ srcOfs .. srcOfs+srcWidth ];
+        System.arraycopy(dataYComp, srcOfs, imageComponents[ID_Y], dstOfs, srcWidth);
 	}
 	frameComponent = frameComponents[componentIds[ID_CB]];
 	for (int yPos = 0; yPos < srcHeight / maxV; yPos++) {
@@ -235,7 +235,7 @@
 			int srcOfs = (compressedHeight - 1) * componentWidth;
 			for (int yPos = compressedHeight; yPos <= componentHeight; yPos++) {
 				int dstOfs = (yPos - 1) * componentWidth;
-                imageComponent[dstOfs .. dstOfs+componentWidth]  = imageComponent[srcOfs .. srcOfs+componentWidth];
+                System.arraycopy(imageComponent, srcOfs, imageComponent, dstOfs, componentWidth);
 			}
 		}
 	}
@@ -708,7 +708,9 @@
 						// Dequantization, IDCT, up-sampling and color conversion
 						// are done on a copy of the coefficient data in order to
 						// display the image incrementally.
-                        dataUnit.length = 64;
+                        int[] temp = dataUnit;
+                        dataUnit = new int[64];
+                        System.arraycopy(temp, 0, dataUnit, 0, 64);
 					}
 				}
 				if (!progressive || (progressive && loader.hasListeners())) {
@@ -1455,7 +1457,7 @@
 		int delta = 512 - bufferCurrentPosition - 1;
 		if (delta > 0) {
 			byte[] unreadBuffer = new byte[delta];
-            unreadBuffer[ 0 .. delta ] = dataBuffer[ bufferCurrentPosition+1 .. bufferCurrentPosition+1+delta ];
+            System.arraycopy(dataBuffer, bufferCurrentPosition + 1, unreadBuffer, 0, delta);
 			try {
 				inputStream.unread(unreadBuffer);
 			} catch (IOException e) {
--- a/dwt/internal/image/JPEGFrameHeader.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/JPEGFrameHeader.d	Tue Jan 08 01:23:25 2008 +0100
@@ -106,7 +106,9 @@
 			compParam[1] = hi;
 			compParam[2] = vi;
 			if (compSpecParams.length <= ci) {
-				compSpecParams.length = ci + 1;
+                int[][] newParams = new int[][](ci + 1);
+                System.arraycopy(compSpecParams, 0, newParams, 0, compSpecParams.length);
+                compSpecParams = newParams;
 			}
 			compSpecParams[ci] = compParam;
 		}
--- a/dwt/internal/image/JPEGHuffmanTable.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/JPEGHuffmanTable.d	Tue Jan 08 01:23:25 2008 +0100
@@ -14,6 +14,7 @@
 import dwt.internal.image.LEDataInputStream;
 import dwt.internal.image.JPEGFileFormat;
 
+import dwt.dwthelper.System;
 /**
  * JPEGHuffmanTable class actually represents two types of object:
  * 1) A DHT (Define Huffman Tables) segment, which may represent
@@ -174,7 +175,7 @@
 			for (int j = 0; j < bits[i]; j++) {
 				if (huffCodeLengthsIndex >= huffCodeLengths.length) {
 					int[] newHuffCodeLengths = new int[huffCodeLengths.length + 50];
-                    newHuffCodeLengths[0 .. huffCodeLengths.length] = huffCodeLengths;
+                    System.arraycopy(huffCodeLengths, 0, newHuffCodeLengths, 0, huffCodeLengths.length);
 					huffCodeLengths = newHuffCodeLengths;
 				}
 				huffCodeLengths[huffCodeLengthsIndex] = i + 1;
@@ -185,7 +186,7 @@
 		/* Truncate huffCodeLengths to the correct size. */
 		if (huffCodeLengthsIndex < huffCodeLengths.length) {
 			int[] newHuffCodeLengths = new int[huffCodeLengthsIndex];
-            newHuffCodeLengths[0 .. huffCodeLengthsIndex] = huffCodeLengths[ 0 .. huffCodeLengthsIndex ];
+            System.arraycopy(huffCodeLengths, 0, newHuffCodeLengths, 0, huffCodeLengthsIndex);
 			huffCodeLengths = newHuffCodeLengths;
 		}
 
@@ -200,7 +201,7 @@
 			while ((p < huffCodeLengthsIndex) && (huffCodeLengths[p] == si)) {
 				if (huffCodesIndex >= huffCodes.length) {
 					int[] newHuffCodes = new int[huffCodes.length + 50];
-                    newHuffCodes[ 0 .. huffCodes.length ] = huffCodes;
+                    System.arraycopy(huffCodes, 0, newHuffCodes, 0, huffCodes.length);
 					huffCodes = newHuffCodes;
 				}
 				huffCodes[huffCodesIndex] = code;
@@ -215,7 +216,7 @@
 		/* Truncate huffCodes to the correct size. */
 		if (huffCodesIndex < huffCodes.length) {
 			int[] newHuffCodes = new int[huffCodesIndex];
-            newHuffCodes[ 0 .. huffCodesIndex ] = huffCodes[ 0 .. huffCodesIndex ];
+            System.arraycopy(huffCodes, 0, newHuffCodes, 0, huffCodesIndex);
 			huffCodes = newHuffCodes;
 		}
 
@@ -258,7 +259,7 @@
 		huffTableCount++;
 	}
 	allTables = new JPEGHuffmanTable[huffTableCount];
-    allTables[ 0 .. huffTableCount ] = huffTables[ 0 .. huffTableCount ];
+    System.arraycopy(huffTables, 0, allTables, 0, huffTableCount);
 }
 
 public int signature() {
--- a/dwt/internal/image/JPEGQuantizationTable.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/JPEGQuantizationTable.d	Tue Jan 08 01:23:25 2008 +0100
@@ -14,6 +14,8 @@
 import dwt.internal.image.JPEGVariableSizeSegment;
 import dwt.internal.image.JPEGFileFormat;
 
+import dwt.dwthelper.System;
+
 final class JPEGQuantizationTable : JPEGVariableSizeSegment {
 	public static byte[] DefaultLuminanceQTable = [
 		cast(byte)255, cast(byte)219, 0, 67, 0,
@@ -47,11 +49,15 @@
 }
 
 public static JPEGQuantizationTable defaultChrominanceTable() {
-	return new JPEGQuantizationTable(DefaultChrominanceQTable.dup);
+    byte[] data = new byte[DefaultChrominanceQTable.length];
+    System.arraycopy(DefaultChrominanceQTable, 0, data, 0, data.length);
+    return new JPEGQuantizationTable(data);
 }
 
 public static JPEGQuantizationTable defaultLuminanceTable() {
-	return new JPEGQuantizationTable(DefaultLuminanceQTable.dup);
+    byte[] data = new byte[DefaultLuminanceQTable.length];
+    System.arraycopy(DefaultLuminanceQTable, 0, data, 0, data.length);
+    return new JPEGQuantizationTable(data);
 }
 
 public int[] getQuantizationTablesKeys() {
@@ -70,12 +76,16 @@
 			totalLength -= 129;
 		}
 		if (keysIndex >= keys.length) {
-			keys.length = keys.length + 4;
+            int[] newKeys = new int[keys.length + 4];
+            System.arraycopy(keys, 0, newKeys, 0, keys.length);
+            keys = newKeys;
 		}
 		keys[keysIndex] = tq;
 		keysIndex++;
 	}
-	return keys[ 0 .. keysIndex ].dup;
+    int[] newKeys = new int[keysIndex];
+    System.arraycopy(keys, 0, newKeys, 0, keysIndex);
+    return newKeys;
 }
 
 public int[][] getQuantizationTablesValues() {
@@ -101,12 +111,16 @@
 			totalLength -= 129;
 		}
 		if (valuesIndex >= values.length) {
-            values.length = values.length + 4;
+            int[][] newValues = new int[][](values.length + 4);
+            System.arraycopy(values, 0, newValues, 0, values.length);
+            values = newValues;
 		}
 		values[valuesIndex] = qk;
 		valuesIndex++;
 	}
-	return values[ 0 .. valuesIndex ].dup;
+    int[][] newValues = new int[][](valuesIndex);
+    System.arraycopy(values, 0, newValues, 0, valuesIndex);
+    return newValues;
 }
 
 public void scaleBy(int qualityFactor) {
--- a/dwt/internal/image/JPEGScanHeader.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/JPEGScanHeader.d	Tue Jan 08 01:23:25 2008 +0100
@@ -58,7 +58,7 @@
 		int ac = reference[ofs + 1] & 0xF;
 		if (componentParameters.length <= cid) {
 			int[][] newParams = new int[][](cid + 1);
-            newParams[0 .. componentParameters.length] = componentParameters;
+            System.arraycopy(componentParameters, 0, newParams, 0, componentParameters.length);
 			componentParameters = newParams;
 		}
 		componentParameters[cid] = [ dc, ac ];
--- a/dwt/internal/image/LEDataInputStream.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/LEDataInputStream.d	Tue Jan 08 01:23:25 2008 +0100
@@ -12,6 +12,7 @@
 
 
 import dwt.dwthelper.InputStream;
+import dwt.dwthelper.System;
 import tango.core.Exception;
 
 final class LEDataInputStream : InputStream{
@@ -131,7 +132,7 @@
 		int available = buf.length - pos;
 		if (available > 0) {
 			cacheCopied = (available >= len) ? len : available;
-            buffer[ newOffset .. newOffset + cacheCopied ] = buf[ pos .. pos + cacheCopied ];
+            System.arraycopy(buf, pos, buffer, newOffset, cacheCopied);
 			newOffset += cacheCopied;
 			pos += cacheCopied;
 		}
@@ -186,6 +187,6 @@
 		if (l > pos) throw new IOException("cannot unread");
 		position -= l;
 		pos -= l;
-        buf[ pos .. pos + l ] = b[];
+        System.arraycopy(b, 0, buf, pos, l);
 	}
 }
--- a/dwt/internal/image/LZWCodec.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/LZWCodec.d	Tue Jan 08 01:23:25 2008 +0100
@@ -334,8 +334,7 @@
  */
 void nextPixels(byte[] buf, int lineWidth) {
 	if (image.depth == 8) {
-        int start = imageY * image.bytesPerLine;
-        buf[ 0 .. lineWidth ] = image.data[ start .. start + lineWidth ];
+        System.arraycopy(image.data, imageY * image.bytesPerLine, buf, 0, lineWidth);
 	} else {
 		image.getPixels(0, imageY, lineWidth, buf, 0);
 	}
--- a/dwt/internal/image/OS2BMPFileFormat.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/OS2BMPFileFormat.d	Tue Jan 08 01:23:25 2008 +0100
@@ -191,7 +191,7 @@
 				int count = tmp < linesPerBuf ? tmp : linesPerBuf;
 				int bufOffset = 0;
 				for (int i = 0; i < count; i++) {
-                    buf[ bufOffset .. bufOffset+bpl ] = data[ dataIndex .. dataIndex+bpl ];
+                    System.arraycopy(data, dataIndex, buf, bufOffset, bpl);
 					bufOffset += bmpBpl;
 					dataIndex -= imageBpl;
 				}
--- a/dwt/internal/image/PNGFileFormat.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/PNGFileFormat.d	Tue Jan 08 01:23:25 2008 +0100
@@ -483,7 +483,7 @@
 			read += inputStream.read(currentRow, read, bytesPerRow - read);
 		}
 		filterRow(currentRow, lastRow, filterType);
-        data[ dataOffset .. dataOffset+bytesPerRow ] = currentRow[ 0 .. bytesPerRow ];
+        System.arraycopy(currentRow, 0, data, dataOffset, bytesPerRow);
 		dataOffset += alignedBytesPerRow;
 		currentRow = (currentRow == row1) ? row2 : row1;
 		lastRow = (lastRow == row1) ? row2 : row1;
--- a/dwt/internal/image/PngChunk.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/PngChunk.d	Tue Jan 08 01:23:25 2008 +0100
@@ -170,7 +170,9 @@
  * Public chunk types are defined by the PNG Development Group.
  */
 byte[] getTypeBytes() {
-	return reference[ TYPE_OFFSET .. TYPE_OFFSET+TYPE_FIELD_LENGTH ].dup;
+    byte[] type = new byte[4];
+    System.arraycopy(reference, TYPE_OFFSET, type, 0, TYPE_FIELD_LENGTH);
+    return type;
 }
 
 /**
@@ -186,7 +188,7 @@
 	if (value.length != TYPE_FIELD_LENGTH) {
 		SWT.error (SWT.ERROR_INVALID_ARGUMENT);
 	}
-    reference[ TYPE_OFFSET .. TYPE_OFFSET+TYPE_FIELD_LENGTH ] = value[ 0 .. TYPE_FIELD_LENGTH ];
+    System.arraycopy(value, 0, reference, TYPE_OFFSET, TYPE_FIELD_LENGTH);
 }
 
 /**
@@ -197,7 +199,9 @@
 	if (reference.length < MIN_LENGTH + dataLength) {
 		SWT.error (SWT.ERROR_INVALID_RANGE);
 	}
-	return reference[ DATA_OFFSET .. DATA_OFFSET+dataLength ].dup;
+    byte[] data = new byte[dataLength];
+    System.arraycopy(reference, DATA_OFFSET, data, 0, dataLength);
+    return data;
 }
 
 /**
@@ -210,7 +214,7 @@
  */
 void setData(byte[] data) {
 	setLength(data.length);
-    reference[ DATA_OFFSET .. DATA_OFFSET+data.length ] = data;
+    System.arraycopy(data, 0, reference, DATA_OFFSET, data.length);
 	setCRC(computeCRC());
 }
 
--- a/dwt/internal/image/PngIdatChunk.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/PngIdatChunk.d	Tue Jan 08 01:23:25 2008 +0100
@@ -29,7 +29,7 @@
 	setType(TYPE_IDAT);
 	reference[HEADER_BYTE1_DATA_OFFSET] = headerByte1;
 	reference[HEADER_BYTE2_DATA_OFFSET] = headerByte2;
-    reference[ DATA_OFFSET .. DATA_OFFSET+data.length ] = data;
+    System.arraycopy(data, 0, reference, DATA_OFFSET, data.length);
 	setInt32(ADLER_DATA_OFFSET, adler);
 	setCRC(computeCRC());
 }
--- a/dwt/internal/image/PngInputStream.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/PngInputStream.d	Tue Jan 08 01:23:25 2008 +0100
@@ -11,6 +11,7 @@
 module dwt.internal.image.PngInputStream;
 
 import dwt.dwthelper.InputStream;
+import dwt.dwthelper.System;
 import dwt.internal.image.PngIdatChunk;
 import dwt.internal.image.PngChunkReader;
 import dwt.internal.image.PngChunk;
@@ -62,7 +63,7 @@
 	if (chunk == null) throw new IOException("");
 	if (offset == length && !checkChunk()) return -1;
 	len = Math.min(len, length - offset);
-    b[ off .. off+len ] = chunk.reference[ DATA_OFFSET + offset .. DATA_OFFSET + offset + len ];
+    System.arraycopy(chunk.reference, DATA_OFFSET + offset, b, off, len);
 	offset += len;
 	return len;
 }
--- a/dwt/internal/image/TIFFDirectory.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/TIFFDirectory.d	Tue Jan 08 01:23:25 2008 +0100
@@ -96,8 +96,7 @@
 		byte n = src[srcIndex];
 		if (0 <= n && n <= 127) {
 			/* Copy next n+1 bytes literally */
-            ++srcIndex;
-            dest[ destIndex .. destIndex + n + 1 ] = src[ srcIndex .. srcIndex + n + 1 ];
+            System.arraycopy(src, ++srcIndex, dest, destIndex, n + 1);
 			srcIndex += n + 1;
 			destIndex += n + 1;
 		} else if (-127 <= n && n <= -1) {
@@ -155,7 +154,7 @@
 		file.seek(stripOffsets[i]);
 		file.read(data);
 		if (compression == COMPRESSION_NONE) {
-            imageData[ destIndex .. destIndex+data.length] = data[];
+            System.arraycopy(data, 0, imageData, destIndex, data.length);
 			destIndex += data.length;
 		} else if (compression == COMPRESSION_PACKBITS) {
 			destIndex += decodePackBits(data, imageData, destIndex);
--- a/dwt/internal/image/TIFFRandomFileAccess.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/TIFFRandomFileAccess.d	Tue Jan 08 01:23:25 2008 +0100
@@ -13,6 +13,7 @@
 import dwt.internal.image.LEDataInputStream;
 import Math = tango.math.Math;
 import tango.core.Exception;
+import dwt.dwthelper.System;
 
 final class TIFFRandomFileAccess {
 
@@ -42,7 +43,7 @@
 			if (index >= buffers.length) {
 				byte[][] oldBuffers = buffers;
 				buffers = new byte[][]( Math.max(index + 1, oldBuffers.length + LIST_SIZE) );
-                buffers[ 0 .. oldBuffers.length ] = oldBuffers[];
+                System.arraycopy(oldBuffers, 0, buffers, 0, oldBuffers.length);
 			}
 			if (buffers[index] == null) buffers[index] = new byte[CHUNK_SIZE];
 			int cnt = inputStream.read(buffers[index], offset, Math.min(n, CHUNK_SIZE - offset));
@@ -65,7 +66,7 @@
 		int offset = current % CHUNK_SIZE;
 		while (nCached > 0) {
 			int cnt = Math.min(nCached, CHUNK_SIZE - offset);
-            b[ destNext .. destNext+cnt ] = buffers[index][ offset .. offset+cnt ];
+            System.arraycopy(buffers[index], offset, b, destNext, cnt);
 			nCached -= cnt;
 			destNext += cnt;
 			index++;
@@ -80,11 +81,11 @@
 			if (index >= buffers.length) {
 				byte[][] oldBuffers = buffers;
 				buffers = new byte[][](Math.max(index, oldBuffers.length + LIST_SIZE));
-                buffers[ 0 .. oldBuffers.length ] = oldBuffers[];
+                System.arraycopy(oldBuffers, 0, buffers, 0, oldBuffers.length);
 			}
 			if (buffers[index] == null) buffers[index] = new byte[CHUNK_SIZE];
 			int cnt = inputStream.read(buffers[index], offset, Math.min(nMissing, CHUNK_SIZE - offset));
-            b[ destNext .. destNext+cnt ] = buffers[index][ offset .. offset+cnt ];
+            System.arraycopy(buffers[index], offset, b, destNext, cnt);
 			nMissing -= cnt;
 			next += cnt;
 			destNext += cnt;
--- a/dwt/internal/image/WinBMPFileFormat.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/WinBMPFileFormat.d	Tue Jan 08 01:23:25 2008 +0100
@@ -532,7 +532,7 @@
 				ostr.write(buf2, 0, buf2Offset);
 				buf2Offset = 0;
 			}
-            buf2[ buf2Offset .. buf2Offset+lineSize ] = buf[ 0 .. lineSize ];
+            System.arraycopy(buf, 0, buf2, buf2Offset, lineSize);
 			buf2Offset += lineSize;
 			totalSize += lineSize;
 			srcOffset -= imageBpl;
@@ -580,7 +580,7 @@
 				int count = tmp < linesPerBuf ? tmp : linesPerBuf;
 				int bufOffset = 0;
 				for (int i = 0; i < count; i++) {
-                    buf[ bufOffset .. bufOffset+bpl ] = data[ dataIndex .. dataIndex+bpl ];
+                    System.arraycopy(data, dataIndex, buf, bufOffset, bpl);
 					bufOffset += bmpBpl;
 					dataIndex -= imageBpl;
 				}
--- a/dwt/internal/image/WinICOFileFormat.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/internal/image/WinICOFileFormat.d	Tue Jan 08 01:23:25 2008 +0100
@@ -35,7 +35,7 @@
 	byte[] newData = new byte[height * newBpl];
 	int srcIndex = 0, destIndex = 0;
 	for (int y = 0; y < height; y++) {
-        newData[ destIndex .. destIndex+newBpl ] = data[ srcIndex .. srcIndex+newBpl ];
+        System.arraycopy(data, srcIndex, newData, destIndex, newBpl);
 		srcIndex += bpl;
 		destIndex += newBpl;
 	}
@@ -294,7 +294,7 @@
 	byte[] data = mask.data;
 	try {
 		for (int i = 0; i < icon.height; i++) {
-            buf[ 0 .. bpl ] = data[ offset .. offset+bpl ];
+            System.arraycopy(data, offset, buf, 0, bpl);
 			bitInvertData(buf, 0, bpl);
 			outputStream.write(buf, 0, destBpl);
 			offset -= srcBpl;
@@ -316,7 +316,7 @@
 	byte[] data = icon.data;
 	try {
 		for (int i = 0; i < icon.height; i++) {
-            buf[ 0 .. bpl ] = data[ offset .. offset+bpl ];
+            System.arraycopy(data, offset, buf, 0, bpl);
 			outputStream.write(buf, 0, destBpl);
 			offset -= srcBpl;
 		}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/Caret.d	Tue Jan 08 01:23:25 2008 +0100
@@ -0,0 +1,500 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.Caret;
+
+class Caret{
+}
+/+++
+
+import dwt.*;
+import dwt.internal.gtk.*;
+import dwt.graphics.*;
+
+/**
+ * Instances of this class provide an i-beam that is typically used
+ * as the insertion point for text.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class Caret extends Widget {
+	Canvas parent;
+	int x, y, width, height;
+	boolean isVisible, isShowing;
+	int blinkRate;
+	Image image;
+	Font font;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * lists the style constants that are applicable to the class.
+ * Style bits are also inherited from superclasses.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Caret (Canvas parent, int style) {
+	super (parent, style);
+	this.parent = parent;
+	createWidget (0);
+}
+
+boolean blinkCaret () {
+	if (!isVisible) return true;
+	if (!isShowing) return showCaret ();
+	if (blinkRate == 0) return true;
+	return hideCaret ();
+}
+
+void createWidget (int index) {
+	super.createWidget (index);
+	blinkRate = display.getCaretBlinkTime ();
+	isVisible = true;
+	if (parent.getCaret () == null) {
+		parent.setCaret (this);
+	}
+}
+
+boolean drawCaret () {
+	if (parent == null) return false;
+	if (parent.isDisposed ()) return false;
+	int /*long*/ window = parent.paintWindow ();
+	int /*long*/ gc = OS.gdk_gc_new (window);
+	GdkColor color = new GdkColor ();
+	color.red = (short) 0xffff;
+	color.green = (short) 0xffff;
+	color.blue = (short) 0xffff;
+	int /*long*/ colormap = OS.gdk_colormap_get_system ();
+	OS.gdk_colormap_alloc_color (colormap, color, true, true);
+	OS.gdk_gc_set_foreground (gc, color);
+	OS.gdk_gc_set_function (gc, OS.GDK_XOR);
+	if (image != null && !image.isDisposed() && image.mask == 0) {
+		int[] width = new int[1]; int[] height = new int[1];
+	 	OS.gdk_drawable_get_size(image.pixmap, width, height);
+		OS.gdk_draw_drawable(window, gc, image.pixmap, 0, 0, x, y, width[0], height[0]);
+	} else {
+		int nWidth = width, nHeight = height;
+		if (nWidth <= 0) nWidth = 1;
+		OS.gdk_draw_rectangle (window, gc, 1, x, y, nWidth, nHeight);
+	}
+	OS.g_object_unref (gc);
+	OS.gdk_colormap_free_colors (colormap, color, 1);
+	return true;
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent (or its display if its parent is null).
+ *
+ * @return the receiver's bounding rectangle
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+	checkWidget();
+	if (image != null) {
+		Rectangle rect = image.getBounds ();
+		return new Rectangle (x, y, rect.width, rect.height);
+	}
+	return new Rectangle (x, y, width, height);
+}
+
+/**
+ * Returns the font that the receiver will use to paint textual information.
+ *
+ * @return the receiver's font
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Font getFont () {
+	checkWidget();
+	if (font != null) return font;
+	return parent.getFont ();
+}
+
+/**
+ * Returns the image that the receiver will use to paint the caret.
+ *
+ * @return the receiver's image
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getImage () {
+	checkWidget();
+	return image;
+}
+
+/**
+ * Returns a point describing the receiver's location relative
+ * to its parent (or its display if its parent is null).
+ *
+ * @return the receiver's location
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getLocation () {
+	checkWidget();
+	return new Point (x, y);
+}
+
+/**
+ * Returns the receiver's parent, which must be a <code>Canvas</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Canvas getParent () {
+	checkWidget();
+	return parent;
+}
+
+/**
+ * Returns a point describing the receiver's size.
+ *
+ * @return the receiver's size
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSize () {
+	checkWidget();
+	if (image != null) {
+		Rectangle rect = image.getBounds ();
+		return new Point (rect.width, rect.height);
+	}
+	return new Point (width, height);
+}
+
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getVisible () {
+	checkWidget();
+	return isVisible;
+}
+
+boolean hideCaret () {
+	if (!isShowing) return true;
+	isShowing = false;
+	return drawCaret ();
+}
+
+/**
+ * Returns <code>true</code> if the receiver is visible and all
+ * of the receiver's ancestors are visible and <code>false</code>
+ * otherwise.
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getVisible
+ */
+public boolean isVisible () {
+	checkWidget();
+	return isVisible && parent.isVisible () && parent.hasFocus ();
+}
+
+boolean isFocusCaret () {
+	return this == display.currentCaret;
+}
+
+void killFocus () {
+	if (display.currentCaret != this) return;
+	display.setCurrentCaret (null);
+	if (isVisible) hideCaret ();
+}
+
+void releaseParent () {
+	super.releaseParent ();
+	if (this == parent.getCaret ()) parent.setCaret (null);
+}
+
+void releaseWidget () {
+	super.releaseWidget ();
+	if (display.currentCaret == this) {
+		hideCaret ();
+		display.setCurrentCaret (null);
+	}
+	parent = null;
+	image = null;
+}
+
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the arguments. The <code>x</code> and
+ * <code>y</code> arguments are relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (int x, int y, int width, int height) {
+	checkWidget();
+	if (this.x == x && this.y == y && this.width == width && this.height == height) return;
+	boolean isFocus = isFocusCaret ();
+	if (isFocus && isVisible) hideCaret ();
+	this.x = x; this.y = y;
+	this.width = width; this.height = height;
+	parent.updateCaret ();
+	if (isFocus && isVisible) showCaret ();
+}
+
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the argument. The <code>x</code> and
+ * <code>y</code> fields of the rectangle are relative to
+ * the receiver's parent (or its display if its parent is null).
+ *
+ * @param rect the new bounds for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (Rectangle rect) {
+	checkWidget();
+	if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
+	setBounds (rect.x, rect.y, rect.width, rect.height);
+}
+
+void setFocus () {
+	if (display.currentCaret == this) return;
+	display.setCurrentCaret (this);
+	if (isVisible) showCaret ();
+}
+
+/**
+ * Sets the font that the receiver will use to paint textual information
+ * to the font specified by the argument, or to the default font for that
+ * kind of control if the argument is null.
+ *
+ * @param font the new font (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setFont (Font font) {
+	checkWidget();
+	if (font != null && font.isDisposed ()) {
+		error (SWT.ERROR_INVALID_ARGUMENT);
+	}
+	this.font = font;
+}
+
+/**
+ * Sets the image that the receiver will use to paint the caret
+ * to the image specified by the argument, or to the default
+ * which is a filled rectangle if the argument is null
+ *
+ * @param image the new image (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (Image image) {
+	checkWidget();
+	if (image != null && image.isDisposed ()) {
+		error (SWT.ERROR_INVALID_ARGUMENT);
+	}
+	boolean isFocus = isFocusCaret ();
+	if (isFocus && isVisible) hideCaret ();
+	this.image = image;
+	if (isFocus && isVisible) showCaret ();
+}
+
+/**
+ * Sets the receiver's location to the point specified by
+ * the arguments which are relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (int x, int y) {
+	checkWidget();
+	setBounds (x, y, width, height);
+}
+
+/**
+ * Sets the receiver's location to the point specified by
+ * the argument which is relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param location the new location for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (Point location) {
+	checkWidget();
+	if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
+	setLocation (location.x, location.y);
+}
+
+/**
+ * Sets the receiver's size to the point specified by the arguments.
+ *
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (int width, int height) {
+	checkWidget();
+	setBounds (x, y, width, height);
+}
+
+/**
+ * Sets the receiver's size to the point specified by the argument.
+ *
+ * @param size the new extent for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (Point size) {
+	checkWidget();
+	if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
+	setSize (size.x, size.y);
+}
+
+/**
+ * Marks the receiver as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setVisible (boolean visible) {
+	checkWidget();
+	if (visible == isVisible) return;
+	isVisible = visible;
+	if (!isFocusCaret ()) return;
+	if (isVisible) {
+		showCaret ();
+	} else {
+		hideCaret ();
+	}
+}
+
+boolean showCaret () {
+	if (isShowing) return true;
+	isShowing = true;
+	return drawCaret ();
+}
+
+}
++++/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/Control.d	Tue Jan 08 01:23:25 2008 +0100
@@ -0,0 +1,4239 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.Control;
+
+class Control {
+}
+/+++
+import dwt.*;
+import dwt.internal.Converter;
+import dwt.internal.accessibility.gtk.ATK;
+import dwt.internal.gtk.*;
+import dwt.graphics.*;
+import dwt.events.*;
+import dwt.accessibility.*;
+
+/**
+ * Control is the abstract superclass of all windowed user interface classes.
+ * <p>
+ * <dl>
+ * <dt><b>Styles:</b>
+ * <dd>BORDER</dd>
+ * <dd>LEFT_TO_RIGHT, RIGHT_TO_LEFT</dd>
+ * <dt><b>Events:</b>
+ * <dd>DragDetect, FocusIn, FocusOut, Help, KeyDown, KeyUp, MenuDetect, MouseDoubleClick, MouseDown, MouseEnter,
+ *     MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize, Traverse</dd>
+ * </dl>
+ * </p><p>
+ * Only one of LEFT_TO_RIGHT or RIGHT_TO_LEFT may be specified.
+ * </p><p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public abstract class Control extends Widget implements Drawable {
+	int /*long*/ fixedHandle;
+	int /*long*/ redrawWindow, enableWindow;
+	int drawCount;
+	Composite parent;
+	Cursor cursor;
+	Menu menu;
+	Image backgroundImage;
+	Font font;
+	String toolTipText;
+	Object layoutData;
+	Accessible accessible;
+
+Control () {
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * lists the style constants that are applicable to the class.
+ * Style bits are also inherited from superclasses.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT#BORDER
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Control (Composite parent, int style) {
+	super (parent, style);
+	this.parent = parent;
+	createWidget (0);
+}
+
+int /*long*/ defaultFont () {
+	return display.getSystemFont ().handle;
+}
+
+void deregister () {
+	super.deregister ();
+	if (fixedHandle != 0) display.removeWidget (fixedHandle);
+	int /*long*/ imHandle = imHandle ();
+	if (imHandle != 0) display.removeWidget (imHandle);
+}
+
+boolean drawGripper (int x, int y, int width, int height, boolean vertical) {
+	int /*long*/ paintHandle = paintHandle ();
+	int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle);
+	if (window == 0) return false;
+	int orientation = vertical ? OS.GTK_ORIENTATION_HORIZONTAL : OS.GTK_ORIENTATION_VERTICAL;
+	OS.gtk_paint_handle (OS.gtk_widget_get_style (paintHandle), window, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_OUT, null, paintHandle, new byte [1], x, y, width, height, orientation);
+	return true;
+}
+
+void enableWidget (boolean enabled) {
+	OS.gtk_widget_set_sensitive (handle, enabled);
+}
+
+int /*long*/ enterExitHandle () {
+	return eventHandle ();
+}
+
+int /*long*/ eventHandle () {
+	return handle;
+}
+
+int /*long*/ eventWindow () {
+	int /*long*/ eventHandle = eventHandle ();
+	OS.gtk_widget_realize (eventHandle);
+	return OS.GTK_WIDGET_WINDOW (eventHandle);
+}
+
+void fixFocus (Control focusControl) {
+	Shell shell = getShell ();
+	Control control = this;
+	while (control != shell && (control = control.parent) != null) {
+		if (control.setFocus ()) return;
+	}
+	shell.setSavedFocus (focusControl);
+	int /*long*/ focusHandle = shell.vboxHandle;
+	OS.GTK_WIDGET_SET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS);
+	OS.gtk_widget_grab_focus (focusHandle);
+	OS.GTK_WIDGET_UNSET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS);
+}
+
+void fixStyle () {
+	if (fixedHandle != 0) fixStyle (fixedHandle);
+}
+
+void fixStyle (int /*long*/ handle) {
+	/*
+	* Feature in GTK.  Some GTK themes apply a different background to
+	* the contents of a GtkNotebook.  However, in an SWT TabFolder, the
+	* children are not parented below the GtkNotebook widget, and usually
+	* have their own GtkFixed.  The fix is to look up the correct style
+	* for a child of a GtkNotebook and apply its background to any GtkFixed
+	* widgets that are direct children of an SWT TabFolder.
+	*
+	* Note that this has to be when the theme settings changes and that it
+	* should not override the application background.
+	*/
+	if ((state & BACKGROUND) != 0) return;
+	int /*long*/ childStyle = parent.childStyle ();
+	if (childStyle != 0) {
+		GdkColor color = new GdkColor();
+		OS.gtk_style_get_bg (childStyle, 0, color);
+		OS.gtk_widget_modify_bg (handle, 0, color);
+	}
+}
+
+int /*long*/ focusHandle () {
+	return handle;
+}
+
+int /*long*/ fontHandle () {
+	return handle;
+}
+
+boolean hasFocus () {
+	return this == display.getFocusControl();
+}
+
+void hookEvents () {
+	/* Connect the keyboard signals */
+	int /*long*/ focusHandle = focusHandle ();
+	int focusMask = OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK | OS.GDK_FOCUS_CHANGE_MASK;
+	OS.gtk_widget_add_events (focusHandle, focusMask);
+	OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [POPUP_MENU], 0, display.closures [POPUP_MENU], false);
+	OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [SHOW_HELP], 0, display.closures [SHOW_HELP], false);
+	OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [KEY_PRESS_EVENT], 0, display.closures [KEY_PRESS_EVENT], false);
+	OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [KEY_RELEASE_EVENT], 0, display.closures [KEY_RELEASE_EVENT], false);
+	OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [FOCUS], 0, display.closures [FOCUS], false);
+	OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [FOCUS_IN_EVENT], 0, display.closures [FOCUS_IN_EVENT], false);
+	OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [FOCUS_OUT_EVENT], 0, display.closures [FOCUS_OUT_EVENT], false);
+
+	/* Connect the mouse signals */
+	int /*long*/ eventHandle = eventHandle ();
+	int eventMask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_PRESS_MASK |
+		OS.GDK_BUTTON_RELEASE_MASK;
+	OS.gtk_widget_add_events (eventHandle, eventMask);
+	OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [BUTTON_PRESS_EVENT], 0, display.closures [BUTTON_PRESS_EVENT], false);
+	OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [BUTTON_RELEASE_EVENT], 0, display.closures [BUTTON_RELEASE_EVENT], false);
+	OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [MOTION_NOTIFY_EVENT], 0, display.closures [MOTION_NOTIFY_EVENT], false);
+	OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [SCROLL_EVENT], 0, display.closures [SCROLL_EVENT], false);
+
+	/* Connect enter/exit signals */
+	int /*long*/ enterExitHandle = enterExitHandle ();
+	int enterExitMask = OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK;
+	OS.gtk_widget_add_events (enterExitHandle, enterExitMask);
+	OS.g_signal_connect_closure_by_id (enterExitHandle, display.signalIds [ENTER_NOTIFY_EVENT], 0, display.closures [ENTER_NOTIFY_EVENT], false);
+	OS.g_signal_connect_closure_by_id (enterExitHandle, display.signalIds [LEAVE_NOTIFY_EVENT], 0, display.closures [LEAVE_NOTIFY_EVENT], false);
+
+	/*
+	* Feature in GTK.  Events such as mouse move are propagate up
+	* the widget hierarchy and are seen by the parent.  This is the
+	* correct GTK behavior but not correct for SWT.  The fix is to
+	* hook a signal after and stop the propagation using a negative
+	* event number to distinguish this case.
+	*
+	* The signal is hooked to the fixedHandle to catch events sent to
+	* lightweight widgets.
+	*/
+	int /*long*/ blockHandle = fixedHandle != 0 ? fixedHandle : eventHandle;
+	OS.g_signal_connect_closure_by_id (blockHandle, display.signalIds [BUTTON_PRESS_EVENT], 0, display.closures [BUTTON_PRESS_EVENT_INVERSE], true);
+	OS.g_signal_connect_closure_by_id (blockHandle, display.signalIds [BUTTON_RELEASE_EVENT], 0, display.closures [BUTTON_RELEASE_EVENT_INVERSE], true);
+	OS.g_signal_connect_closure_by_id (blockHandle, display.signalIds [MOTION_NOTIFY_EVENT], 0, display.closures [MOTION_NOTIFY_EVENT_INVERSE], true);
+
+	/* Connect the event_after signal for both key and mouse */
+	OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [EVENT_AFTER], 0, display.closures [EVENT_AFTER], false);
+	if (focusHandle != eventHandle) {
+		OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [EVENT_AFTER], 0, display.closures [EVENT_AFTER], false);
+	}
+
+	/* Connect the paint signal */
+	int /*long*/ paintHandle = paintHandle ();
+	int paintMask = OS.GDK_EXPOSURE_MASK | OS.GDK_VISIBILITY_NOTIFY_MASK;
+	OS.gtk_widget_add_events (paintHandle, paintMask);
+	OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [EXPOSE_EVENT], 0, display.closures [EXPOSE_EVENT_INVERSE], false);
+	OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [VISIBILITY_NOTIFY_EVENT], 0, display.closures [VISIBILITY_NOTIFY_EVENT], false);
+	OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [EXPOSE_EVENT], 0, display.closures [EXPOSE_EVENT], true);
+
+	/* Connect the Input Method signals */
+	OS.g_signal_connect_closure_by_id (handle, display.signalIds [REALIZE], 0, display.closures [REALIZE], true);
+	OS.g_signal_connect_closure_by_id (handle, display.signalIds [UNREALIZE], 0, display.closures [UNREALIZE], false);
+	int /*long*/ imHandle = imHandle ();
+	if (imHandle != 0) {
+		OS.g_signal_connect_closure (imHandle, OS.commit, display.closures [COMMIT], false);
+		OS.g_signal_connect_closure (imHandle, OS.preedit_changed, display.closures [PREEDIT_CHANGED], false);
+	}
+
+	OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [STYLE_SET], 0, display.closures [STYLE_SET], false);
+
+	int /*long*/ topHandle = topHandle ();
+	OS.g_signal_connect_closure_by_id (topHandle, display.signalIds [MAP], 0, display.closures [MAP], true);
+}
+
+int /*long*/ hoverProc (int /*long*/ widget) {
+	int [] x = new int [1], y = new int [1], mask = new int [1];
+	OS.gdk_window_get_pointer (0, x, y, mask);
+	sendMouseEvent (SWT.MouseHover, 0, /*time*/0, x [0], y [0], false, mask [0]);
+	/* Always return zero in order to cancel the hover timer */
+	return 0;
+}
+
+int /*long*/ topHandle() {
+	if (fixedHandle != 0) return fixedHandle;
+	return super.topHandle ();
+}
+
+int /*long*/ paintHandle () {
+	int /*long*/ topHandle = topHandle ();
+	int /*long*/ paintHandle = handle;
+	while (paintHandle != topHandle) {
+		if ((OS.GTK_WIDGET_FLAGS (paintHandle) & OS.GTK_NO_WINDOW) == 0) break;
+		paintHandle = OS.gtk_widget_get_parent (paintHandle);
+	}
+	return paintHandle;
+}
+
+int /*long*/ paintWindow () {
+	int /*long*/ paintHandle = paintHandle ();
+	OS.gtk_widget_realize (paintHandle);
+	return OS.GTK_WIDGET_WINDOW (paintHandle);
+}
+
+/**
+ * Returns the preferred size of the receiver.
+ * <p>
+ * The <em>preferred size</em> of a control is the size that it would
+ * best be displayed at. The width hint and height hint arguments
+ * allow the caller to ask a control questions such as "Given a particular
+ * width, how high does the control need to be to show all of the contents?"
+ * To indicate that the caller does not wish to constrain a particular
+ * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
+ * </p>
+ *
+ * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
+ * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
+ * @return the preferred size of the control
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Layout
+ * @see #getBorderWidth
+ * @see #getBounds
+ * @see #getSize
+ * @see #pack(boolean)
+ * @see "computeTrim, getClientArea for controls that implement them"
+ */
+public Point computeSize (int wHint, int hHint) {
+	return computeSize (wHint, hHint, true);
+}
+
+Control computeTabGroup () {
+	if (isTabGroup()) return this;
+	return parent.computeTabGroup ();
+}
+
+Control[] computeTabList() {
+	if (isTabGroup()) {
+		if (getVisible() && getEnabled()) {
+			return new Control[] {this};
+		}
+	}
+	return new Control[0];
+}
+
+Control computeTabRoot () {
+	Control[] tabList = parent._getTabList();
+	if (tabList != null) {
+		int index = 0;
+		while (index < tabList.length) {
+			if (tabList [index] == this) break;
+			index++;
+		}
+		if (index == tabList.length) {
+			if (isTabGroup ()) return this;
+		}
+	}
+	return parent.computeTabRoot ();
+}
+
+void checkBuffered () {
+	style |= SWT.DOUBLE_BUFFERED;
+}
+
+void checkBackground () {
+	Shell shell = getShell ();
+	if (this == shell) return;
+	state &= ~PARENT_BACKGROUND;
+	Composite composite = parent;
+	do {
+		int mode = composite.backgroundMode;
+		if (mode != SWT.INHERIT_NONE) {
+			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);
+}
+
+void checkBorder () {
+	if (getBorderWidth () == 0) style &= ~SWT.BORDER;
+}
+
+int /*long*/ childStyle () {
+	return parent.childStyle ();
+}
+
+void createWidget (int index) {
+	state |= DRAG_DETECT;
+	checkOrientation (parent);
+	super.createWidget (index);
+	checkBackground ();
+	if ((state & PARENT_BACKGROUND) != 0) setBackground ();
+	checkBuffered ();
+	showWidget ();
+	setInitialBounds ();
+	setZOrder (null, false, false);
+	setRelations ();
+	checkBorder ();
+}
+
+/**
+ * Returns the preferred size of the receiver.
+ * <p>
+ * The <em>preferred size</em> of a control is the size that it would
+ * best be displayed at. The width hint and height hint arguments
+ * allow the caller to ask a control questions such as "Given a particular
+ * width, how high does the control need to be to show all of the contents?"
+ * To indicate that the caller does not wish to constrain a particular
+ * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
+ * </p><p>
+ * If the changed flag is <code>true</code>, it indicates that the receiver's
+ * <em>contents</em> have changed, therefore any caches that a layout manager
+ * containing the control may have been keeping need to be flushed. When the
+ * control is resized, the changed flag will be <code>false</code>, so layout
+ * manager caches can be retained.
+ * </p>
+ *
+ * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
+ * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
+ * @param changed <code>true</code> if the control's contents have changed, and <code>false</code> otherwise
+ * @return the preferred size of the control.
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Layout
+ * @see #getBorderWidth
+ * @see #getBounds
+ * @see #getSize
+ * @see #pack(boolean)
+ * @see "computeTrim, getClientArea for controls that implement them"
+ */
+public Point computeSize (int wHint, int hHint, boolean changed) {
+	checkWidget();
+	if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0;
+	if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0;
+	return computeNativeSize (handle, wHint, hHint, changed);
+}
+
+Point computeNativeSize (int /*long*/ h, int wHint, int hHint, boolean changed) {
+	int width = wHint, height = hHint;
+	if (wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) {
+		GtkRequisition requisition = new GtkRequisition ();
+		gtk_widget_size_request (h, requisition);
+		width = OS.GTK_WIDGET_REQUISITION_WIDTH (h);
+		height = OS.GTK_WIDGET_REQUISITION_HEIGHT (h);
+	} else if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
+		int [] reqWidth = new int [1], reqHeight = new int [1];
+		OS.gtk_widget_get_size_request (h, reqWidth, reqHeight);
+		OS.gtk_widget_set_size_request (h, wHint, hHint);
+		GtkRequisition requisition = new GtkRequisition ();
+		gtk_widget_size_request (h, requisition);
+		OS.gtk_widget_set_size_request (h, reqWidth [0], reqHeight [0]);
+		width = wHint == SWT.DEFAULT ? requisition.width : wHint;
+		height = hHint == SWT.DEFAULT ? requisition.height : hHint;
+	}
+	return new Point (width, height);
+}
+
+void forceResize () {
+	/*
+	* Force size allocation on all children of this widget's
+	* topHandle.  Note that all calls to gtk_widget_size_allocate()
+	* must be preceded by a call to gtk_widget_size_request().
+	*/
+	int /*long*/ topHandle = topHandle ();
+	GtkRequisition requisition = new GtkRequisition ();
+	gtk_widget_size_request (topHandle, requisition);
+	GtkAllocation allocation = new GtkAllocation ();
+	allocation.x = OS.GTK_WIDGET_X (topHandle);
+	allocation.y = OS.GTK_WIDGET_Y (topHandle);
+	allocation.width = OS.GTK_WIDGET_WIDTH (topHandle);
+	allocation.height = OS.GTK_WIDGET_HEIGHT (topHandle);
+	OS.gtk_widget_size_allocate (topHandle, allocation);
+}
+
+/**
+ * Returns the accessible object for the receiver.
+ * If this is the first time this object is requested,
+ * then the object is created and returned.
+ *
+ * @return the accessible object
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Accessible#addAccessibleListener
+ * @see Accessible#addAccessibleControlListener
+ *
+ * @since 2.0
+ */
+public Accessible getAccessible () {
+	checkWidget ();
+	if (accessible == null) {
+		accessible = Accessible.internal_new_Accessible (this);
+	}
+	return accessible;
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent (or its display if its parent is null),
+ * unless the receiver is a shell. In this case, the location is
+ * relative to the display.
+ *
+ * @return the receiver's bounding rectangle
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+	checkWidget();
+	int /*long*/ topHandle = topHandle ();
+	int x = OS.GTK_WIDGET_X (topHandle);
+	int y = OS.GTK_WIDGET_Y (topHandle);
+	int width = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
+	int height = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
+	return new Rectangle (x, y, width, height);
+}
+
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the argument. The <code>x</code> and
+ * <code>y</code> fields of the rectangle are relative to
+ * the receiver's parent (or its display if its parent is null).
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause that
+ * value to be set to zero instead.
+ * </p>
+ *
+ * @param rect the new bounds for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (Rectangle rect) {
+	checkWidget ();
+	if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
+	setBounds (rect.x, rect.y, Math.max (0, rect.width), Math.max (0, rect.height), true, true);
+}
+
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the arguments. The <code>x</code> and
+ * <code>y</code> arguments are relative to the receiver's
+ * parent (or its display if its parent is null), unless
+ * the receiver is a shell. In this case, the <code>x</code>
+ * and <code>y</code> arguments are relative to the display.
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause that
+ * value to be set to zero instead.
+ * </p>
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (int x, int y, int width, int height) {
+	checkWidget();
+	setBounds (x, y, Math.max (0, width), Math.max (0, height), true, true);
+}
+
+void markLayout (boolean changed, boolean all) {
+	/* Do nothing */
+}
+
+void moveHandle (int x, int y) {
+	int /*long*/ topHandle = topHandle ();
+	int /*long*/ parentHandle = parent.parentingHandle ();
+	/*
+	* Feature in GTK.  Calling gtk_fixed_move() to move a child causes
+	* the whole parent to redraw.  This is a performance problem. The
+	* fix is temporarily make the parent not visible during the move.
+	*
+	* NOTE: Because every widget in SWT has an X window, the new and
+	* old bounds of the child are correctly redrawn.
+	*/
+	int flags = OS.GTK_WIDGET_FLAGS (parentHandle);
+	OS.GTK_WIDGET_UNSET_FLAGS (parentHandle, OS.GTK_VISIBLE);
+	OS.gtk_fixed_move (parentHandle, topHandle, x, y);
+	if ((flags & OS.GTK_VISIBLE) != 0) {
+		OS.GTK_WIDGET_SET_FLAGS (parentHandle, OS.GTK_VISIBLE);
+	}
+}
+
+void resizeHandle (int width, int height) {
+	int /*long*/ topHandle = topHandle ();
+	OS.gtk_widget_set_size_request (topHandle, width, height);
+	if (topHandle != handle) OS.gtk_widget_set_size_request (handle, width, height);
+}
+
+int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
+	int /*long*/ topHandle = topHandle ();
+	boolean sameOrigin = true, sameExtent = true;
+	if (move) {
+		int oldX = OS.GTK_WIDGET_X (topHandle);
+		int oldY = OS.GTK_WIDGET_Y (topHandle);
+		sameOrigin = x == oldX && y == oldY;
+		if (!sameOrigin) {
+			if (enableWindow != 0) {
+				OS.gdk_window_move (enableWindow, x, y);
+			}
+			moveHandle (x, y);
+		}
+	}
+	if (resize) {
+		int oldWidth = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
+		int oldHeight = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
+		sameExtent = width == oldWidth && height == oldHeight;
+		if (!sameExtent && !(width == 0 && height == 0)) {
+			int newWidth = Math.max (1, width);
+			int newHeight = Math.max (1, height);
+			if (redrawWindow != 0) {
+				OS.gdk_window_resize (redrawWindow, newWidth, newHeight);
+			}
+			if (enableWindow != 0) {
+				OS.gdk_window_resize (enableWindow, newWidth, newHeight);
+			}
+			resizeHandle (newWidth, newHeight);
+		}
+	}
+	if (!sameOrigin || !sameExtent) {
+		/*
+		* Cause a size allocation this widget's topHandle.  Note that
+		* all calls to gtk_widget_size_allocate() must be preceded by
+		* a call to gtk_widget_size_request().
+		*/
+		GtkRequisition requisition = new GtkRequisition ();
+		gtk_widget_size_request (topHandle, requisition);
+		GtkAllocation allocation = new GtkAllocation ();
+		if (move) {
+			allocation.x = x;
+			allocation.y = y;
+		} else {
+			allocation.x = OS.GTK_WIDGET_X (topHandle);
+			allocation.y = OS.GTK_WIDGET_Y (topHandle);
+		}
+		if (resize) {
+			allocation.width = width;
+			allocation.height = height;
+		} else {
+			allocation.width = OS.GTK_WIDGET_WIDTH (topHandle);
+			allocation.height = OS.GTK_WIDGET_HEIGHT (topHandle);
+		}
+		OS.gtk_widget_size_allocate (topHandle, allocation);
+	}
+	/*
+	* Bug in GTK.  Widgets cannot be sized smaller than 1x1.
+	* The fix is to hide zero-sized widgets and show them again
+	* when they are resized larger.
+	*/
+	if (!sameExtent) {
+		state = (width == 0) ? state | ZERO_WIDTH : state & ~ZERO_WIDTH;
+		state = (height == 0) ? state | ZERO_HEIGHT : state & ~ZERO_HEIGHT;
+		if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) != 0) {
+			if (enableWindow != 0) {
+				OS.gdk_window_hide (enableWindow);
+			}
+			OS.gtk_widget_hide (topHandle);
+		} else {
+			if ((state & HIDDEN) == 0) {
+				if (enableWindow != 0) {
+					OS.gdk_window_show_unraised (enableWindow);
+				}
+				OS.gtk_widget_show (topHandle);
+			}
+		}
+	}
+	int result = 0;
+	if (move && !sameOrigin) {
+		Control control = findBackgroundControl ();
+		if (control != null && control.backgroundImage != null) {
+			if (isVisible ()) redrawWidget (0, 0, 0, 0, true, true, true);
+		}
+		sendEvent (SWT.Move);
+		result |= MOVED;
+	}
+	if (resize && !sameExtent) {
+		sendEvent (SWT.Resize);
+		result |= RESIZED;
+	}
+	return result;
+}
+
+/**
+ * Returns a point describing the receiver's location relative
+ * to its parent (or its display if its parent is null), unless
+ * the receiver is a shell. In this case, the point is
+ * relative to the display.
+ *
+ * @return the receiver's location
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getLocation () {
+	checkWidget();
+	int /*long*/ topHandle = topHandle ();
+	int x = OS.GTK_WIDGET_X (topHandle);
+	int y = OS.GTK_WIDGET_Y (topHandle);
+	return new Point (x, y);
+}
+
+/**
+ * Sets the receiver's location to the point specified by
+ * the arguments which are relative to the receiver's
+ * parent (or its display if its parent is null), unless
+ * the receiver is a shell. In this case, the point is
+ * relative to the display.
+ *
+ * @param location the new location for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (Point location) {
+	checkWidget ();
+	if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
+	setBounds (location.x, location.y, 0, 0, true, false);
+}
+
+/**
+ * Sets the receiver's location to the point specified by
+ * the arguments which are relative to the receiver's
+ * parent (or its display if its parent is null), unless
+ * the receiver is a shell. In this case, the point is
+ * relative to the display.
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation(int x, int y) {
+	checkWidget();
+	setBounds (x, y, 0, 0, true, false);
+}
+
+/**
+ * Returns a point describing the receiver's size. The
+ * x coordinate of the result is the width of the receiver.
+ * The y coordinate of the result is the height of the
+ * receiver.
+ *
+ * @return the receiver's size
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSize () {
+	checkWidget();
+	int /*long*/ topHandle = topHandle ();
+	int width = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
+	int height = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
+	return new Point (width, height);
+}
+
+/**
+ * Sets the receiver's size to the point specified by the argument.
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause them to be
+ * set to zero instead.
+ * </p>
+ *
+ * @param size the new size for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (Point size) {
+	checkWidget ();
+	if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
+	setBounds (0, 0, Math.max (0, size.x), Math.max (0, size.y), false, true);
+}
+
+void setRelations () {
+	int /*long*/ parentHandle = parent.parentingHandle ();
+	int /*long*/ list = OS.gtk_container_get_children (parentHandle);
+	if (list == 0) return;
+	int count = OS.g_list_length (list);
+	if (count > 1) {
+		/*
+		 * the receiver is the last item in the list, so its predecessor will
+		 * be the second-last item in the list
+		 */
+		int /*long*/ handle = OS.g_list_nth_data (list, count - 2);
+		if (handle != 0) {
+			Widget widget = display.getWidget (handle);
+			if (widget != null && widget != this) {
+				if (widget instanceof Control) {
+					Control sibling = (Control)widget;
+					sibling.addRelation (this);
+				}
+			}
+		}
+	}
+	OS.g_list_free (list);
+}
+
+/**
+ * Sets the receiver's size to the point specified by the arguments.
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause that
+ * value to be set to zero instead.
+ * </p>
+ *
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (int width, int height) {
+	checkWidget();
+	setBounds (0, 0, Math.max (0, width), Math.max (0, height), false, true);
+}
+
+/*
+ * Answers a boolean indicating whether a Label that precedes the receiver in
+ * a layout should be read by screen readers as the recevier's label.
+ */
+boolean isDescribedByLabel () {
+	return true;
+}
+
+/**
+ * Moves the receiver above the specified control in the
+ * drawing order. If the argument is null, then the receiver
+ * is moved to the top of the drawing order. The control at
+ * the top of the drawing order will not be covered by other
+ * controls even if they occupy intersecting areas.
+ *
+ * @param control the sibling control (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Control#moveBelow
+ * @see Composite#getChildren
+ */
+public void moveAbove (Control control) {
+	checkWidget();
+	if (control != null) {
+		if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
+		if (parent != control.parent) return;
+	}
+	setZOrder (control, true, true);
+}
+
+/**
+ * Moves the receiver below the specified control in the
+ * drawing order. If the argument is null, then the receiver
+ * is moved to the bottom of the drawing order. The control at
+ * the bottom of the drawing order will be covered by all other
+ * controls which occupy intersecting areas.
+ *
+ * @param control the sibling control (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Control#moveAbove
+ * @see Composite#getChildren
+ */
+public void moveBelow (Control control) {
+	checkWidget();
+	if (control != null) {
+		if (control.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
+		if (parent != control.parent) return;
+	}
+	setZOrder (control, false, true);
+}
+
+/**
+ * Causes the receiver to be resized to its preferred size.
+ * For a composite, this involves computing the preferred size
+ * from its layout, if there is one.
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #computeSize(int, int, boolean)
+ */
+public void pack () {
+	pack (true);
+}
+
+/**
+ * Causes the receiver to be resized to its preferred size.
+ * For a composite, this involves computing the preferred size
+ * from its layout, if there is one.
+ * <p>
+ * If the changed flag is <code>true</code>, it indicates that the receiver's
+ * <em>contents</em> have changed, therefore any caches that a layout manager
+ * containing the control may have been keeping need to be flushed. When the
+ * control is resized, the changed flag will be <code>false</code>, so layout
+ * manager caches can be retained.
+ * </p>
+ *
+ * @param changed whether or not the receiver's contents have changed
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #computeSize(int, int, boolean)
+ */
+public void pack (boolean changed) {
+	setSize (computeSize (SWT.DEFAULT, SWT.DEFAULT, changed));
+}
+
+/**
+ * Sets the layout data associated with the receiver to the argument.
+ *
+ * @param layoutData the new layout data for the receiver.
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLayoutData (Object layoutData) {
+	checkWidget();
+	this.layoutData = layoutData;
+}
+
+/**
+ * Returns a point which is the result of converting the
+ * argument, which is specified in display relative coordinates,
+ * to coordinates relative to the receiver.
+ * <p>
+ * @param x the x coordinate to be translated
+ * @param y the y coordinate to be translated
+ * @return the translated coordinates
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 2.1
+ */
+public Point toControl (int x, int y) {
+	checkWidget ();
+	int /*long*/ window = eventWindow ();
+	int [] origin_x = new int [1], origin_y = new int [1];
+	OS.gdk_window_get_origin (window, origin_x, origin_y);
+	return new Point (x - origin_x [0], y - origin_y [0]);
+}
+
+/**
+ * Returns a point which is the result of converting the
+ * argument, which is specified in display relative coordinates,
+ * to coordinates relative to the receiver.
+ * <p>
+ * @param point the point to be translated (must not be null)
+ * @return the translated coordinates
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point toControl (Point point) {
+	checkWidget ();
+	if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
+	return toControl (point.x, point.y);
+}
+
+/**
+ * Returns a point which is the result of converting the
+ * argument, which is specified in coordinates relative to
+ * the receiver, to display relative coordinates.
+ * <p>
+ * @param x the x coordinate to be translated
+ * @param y the y coordinate to be translated
+ * @return the translated coordinates
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 2.1
+ */
+public Point toDisplay (int x, int y) {
+	checkWidget();
+	int /*long*/ window = eventWindow ();
+	int [] origin_x = new int [1], origin_y = new int [1];
+	OS.gdk_window_get_origin (window, origin_x, origin_y);
+	return new Point (origin_x [0] + x, origin_y [0] + y);
+}
+
+/**
+ * Returns a point which is the result of converting the
+ * argument, which is specified in coordinates relative to
+ * the receiver, to display relative coordinates.
+ * <p>
+ * @param point the point to be translated (must not be null)
+ * @return the translated coordinates
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point toDisplay (Point point) {
+	checkWidget();
+	if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
+	return toDisplay (point.x, point.y);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is moved or resized, by sending
+ * it one of the messages defined in the <code>ControlListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #removeControlListener
+ */
+public void addControlListener(ControlListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener (SWT.Resize,typedListener);
+	addListener (SWT.Move,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when a drag gesture occurs, by sending it
+ * one of the messages defined in the <code>DragDetectListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see DragDetectListener
+ * @see #removeDragDetectListener
+ *
+ * @since 3.3
+ */
+public void addDragDetectListener (DragDetectListener listener) {
+	checkWidget ();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener (SWT.DragDetect,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control gains or loses focus, by sending
+ * it one of the messages defined in the <code>FocusListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see FocusListener
+ * @see #removeFocusListener
+ */
+public void addFocusListener(FocusListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener(SWT.FocusIn,typedListener);
+	addListener(SWT.FocusOut,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when help events are generated for the control,
+ * by sending it one of the messages defined in the
+ * <code>HelpListener</code> interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #removeHelpListener
+ */
+public void addHelpListener (HelpListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener (SWT.Help, typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when keys are pressed and released on the system keyboard, by sending
+ * it one of the messages defined in the <code>KeyListener</code>
+ * interface.
+ * <p>
+ * When a key listener is added to a control, the control
+ * will take part in widget traversal.  By default, all
+ * traversal keys (such as the tab key and so on) are
+ * delivered to the control.  In order for a control to take
+ * part in traversal, it should listen for traversal events.
+ * Otherwise, the user can traverse into a control but not
+ * out.  Note that native controls such as table and tree
+ * implement key traversal in the operating system.  It is
+ * not necessary to add traversal listeners for these controls,
+ * unless you want to override the default traversal.
+ * </p>
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see KeyListener
+ * @see #removeKeyListener
+ */
+public void addKeyListener(KeyListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener(SWT.KeyUp,typedListener);
+	addListener(SWT.KeyDown,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the platform-specific context menu trigger
+ * has occurred, by sending it one of the messages defined in
+ * the <code>MenuDetectListener</code> interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MenuDetectListener
+ * @see #removeMenuDetectListener
+ *
+ * @since 3.3
+ */
+public void addMenuDetectListener (MenuDetectListener listener) {
+	checkWidget ();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener (SWT.MenuDetect, typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when mouse buttons are pressed and released, by sending
+ * it one of the messages defined in the <code>MouseListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseListener
+ * @see #removeMouseListener
+ */
+public void addMouseListener(MouseListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener(SWT.MouseDown,typedListener);
+	addListener(SWT.MouseUp,typedListener);
+	addListener(SWT.MouseDoubleClick,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the mouse moves, by sending it one of the
+ * messages defined in the <code>MouseMoveListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseMoveListener
+ * @see #removeMouseMoveListener
+ */
+public void addMouseMoveListener(MouseMoveListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener(SWT.MouseMove,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the mouse passes or hovers over controls, by sending
+ * it one of the messages defined in the <code>MouseTrackListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseTrackListener
+ * @see #removeMouseTrackListener
+ */
+public void addMouseTrackListener (MouseTrackListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener (SWT.MouseEnter,typedListener);
+	addListener (SWT.MouseExit,typedListener);
+	addListener (SWT.MouseHover,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the mouse wheel is scrolled, by sending
+ * it one of the messages defined in the
+ * <code>MouseWheelListener</code> interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseWheelListener
+ * @see #removeMouseWheelListener
+ *
+ * @since 3.3
+ */
+public void addMouseWheelListener (MouseWheelListener listener) {
+	checkWidget ();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener (SWT.MouseWheel, typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver needs to be painted, by sending it
+ * one of the messages defined in the <code>PaintListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see PaintListener
+ * @see #removePaintListener
+ */
+public void addPaintListener(PaintListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener(SWT.Paint,typedListener);
+}
+
+void addRelation (Control control) {
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when traversal events occur, by sending it
+ * one of the messages defined in the <code>TraverseListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see TraverseListener
+ * @see #removeTraverseListener
+ */
+public void addTraverseListener (TraverseListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener (SWT.Traverse,typedListener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is moved or resized.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #addControlListener
+ */
+public void removeControlListener (ControlListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.Move, listener);
+	eventTable.unhook (SWT.Resize, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when a drag gesture occurs.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see DragDetectListener
+ * @see #addDragDetectListener
+ *
+ * @since 3.3
+ */
+public void removeDragDetectListener(DragDetectListener listener) {
+	checkWidget ();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.DragDetect, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control gains or loses focus.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see FocusListener
+ * @see #addFocusListener
+ */
+public void removeFocusListener(FocusListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.FocusIn, listener);
+	eventTable.unhook (SWT.FocusOut, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the help events are generated for the control.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #addHelpListener
+ */
+public void removeHelpListener (HelpListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.Help, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when keys are pressed and released on the system keyboard.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see KeyListener
+ * @see #addKeyListener
+ */
+public void removeKeyListener(KeyListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.KeyUp, listener);
+	eventTable.unhook (SWT.KeyDown, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the platform-specific context menu trigger has
+ * occurred.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MenuDetectListener
+ * @see #addMenuDetectListener
+ *
+ * @since 3.3
+ */
+public void removeMenuDetectListener (MenuDetectListener listener) {
+	checkWidget ();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.MenuDetect, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when mouse buttons are pressed and released.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseListener
+ * @see #addMouseListener
+ */
+public void removeMouseListener (MouseListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.MouseDown, listener);
+	eventTable.unhook (SWT.MouseUp, listener);
+	eventTable.unhook (SWT.MouseDoubleClick, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the mouse moves.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseMoveListener
+ * @see #addMouseMoveListener
+ */
+public void removeMouseMoveListener(MouseMoveListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.MouseMove, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the mouse passes or hovers over controls.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseTrackListener
+ * @see #addMouseTrackListener
+ */
+public void removeMouseTrackListener(MouseTrackListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.MouseEnter, listener);
+	eventTable.unhook (SWT.MouseExit, listener);
+	eventTable.unhook (SWT.MouseHover, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the mouse wheel is scrolled.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseWheelListener
+ * @see #addMouseWheelListener
+ *
+ * @since 3.3
+ */
+public void removeMouseWheelListener (MouseWheelListener listener) {
+	checkWidget ();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.MouseWheel, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver needs to be painted.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see PaintListener
+ * @see #addPaintListener
+ */
+public void removePaintListener(PaintListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook(SWT.Paint, listener);
+}
+
+/*
+ * Remove "Labelled by" relations from the receiver.
+ */
+void removeRelation () {
+	if (!isDescribedByLabel ()) return;		/* there will not be any */
+	int /*long*/ accessible = OS.gtk_widget_get_accessible (handle);
+	if (accessible == 0) return;
+	int /*long*/ set = ATK.atk_object_ref_relation_set (accessible);
+	int count = ATK.atk_relation_set_get_n_relations (set);
+	for (int i = 0; i < count; i++) {
+		int /*long*/ relation = ATK.atk_relation_set_get_relation (set, 0);
+		ATK.atk_relation_set_remove (set, relation);
+	}
+	OS.g_object_unref (set);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when traversal events occur.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see TraverseListener
+ * @see #addTraverseListener
+ */
+public void removeTraverseListener(TraverseListener listener) {
+	checkWidget ();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.Traverse, listener);
+}
+
+/**
+ * Detects a drag and drop gesture.  This method is used
+ * to detect a drag gesture when called from within a mouse
+ * down listener.
+ *
+ * <p>By default, a drag is detected when the gesture
+ * occurs anywhere within the client area of a control.
+ * Some controls, such as tables and trees, override this
+ * behavior.  In addition to the operating system specific
+ * drag gesture, they require the mouse to be inside an
+ * item.  Custom widget writers can use <code>setDragDetect</code>
+ * to disable the default detection, listen for mouse down,
+ * and then call <code>dragDetect()</code> from within the
+ * listener to conditionally detect a drag.
+ * </p>
+ *
+ * @param event the mouse down event
+ *
+ * @return <code>true</code> if the gesture occurred, and <code>false</code> otherwise.
+ *
+ * @exception IllegalArgumentException <ul>
+ *   <li>ERROR_NULL_ARGUMENT when the event is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see DragDetectListener
+ * @see #addDragDetectListener
+ *
+ * @see #getDragDetect
+ * @see #setDragDetect
+ *
+ * @since 3.3
+ */
+public boolean dragDetect (Event event) {
+	checkWidget ();
+	if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
+	return dragDetect (event.button, event.count, event.stateMask, event.x, event.y);
+}
+
+/**
+ * Detects a drag and drop gesture.  This method is used
+ * to detect a drag gesture when called from within a mouse
+ * down listener.
+ *
+ * <p>By default, a drag is detected when the gesture
+ * occurs anywhere within the client area of a control.
+ * Some controls, such as tables and trees, override this
+ * behavior.  In addition to the operating system specific
+ * drag gesture, they require the mouse to be inside an
+ * item.  Custom widget writers can use <code>setDragDetect</code>
+ * to disable the default detection, listen for mouse down,
+ * and then call <code>dragDetect()</code> from within the
+ * listener to conditionally detect a drag.
+ * </p>
+ *
+ * @param event the mouse down event
+ *
+ * @return <code>true</code> if the gesture occurred, and <code>false</code> otherwise.
+ *
+ * @exception IllegalArgumentException <ul>
+ *   <li>ERROR_NULL_ARGUMENT when the event is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see DragDetectListener
+ * @see #addDragDetectListener
+ *
+ * @see #getDragDetect
+ * @see #setDragDetect
+ *
+ * @since 3.3
+ */
+public boolean dragDetect (MouseEvent event) {
+	checkWidget ();
+	if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
+	return dragDetect (event.button, event.count, event.stateMask, event.x, event.y);
+}
+
+boolean dragDetect (int button, int count, int stateMask, int x, int y) {
+	if (button != 1 || count != 1) return false;
+	if (!dragDetect (x, y, false, null)) return false;
+	return sendDragEvent (button, stateMask, x, y, true);
+}
+
+boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
+	boolean quit = false, dragging = false;
+	while (!quit) {
+		int /*long*/ eventPtr = 0;
+		while (true) {
+			eventPtr = OS.gdk_event_get ();
+			if (eventPtr != 0) {
+				break;
+			} else {
+				try {Thread.sleep(50);} catch (Exception ex) {}
+			}
+		}
+		switch (OS.GDK_EVENT_TYPE (eventPtr)) {
+			case OS.GDK_MOTION_NOTIFY: {
+				GdkEventMotion gdkMotionEvent = new GdkEventMotion ();
+				OS.memmove (gdkMotionEvent, eventPtr, GdkEventMotion.sizeof);
+				if ((gdkMotionEvent.state & OS.GDK_BUTTON1_MASK) != 0) {
+					if (OS.gtk_drag_check_threshold (handle, x, y, (int) gdkMotionEvent.x, (int) gdkMotionEvent.y)) {
+						dragging = true;
+						quit = true;
+					}
+				} else {
+					quit = true;
+				}
+				int [] newX = new int [1], newY = new int [1];
+				OS.gdk_window_get_pointer (gdkMotionEvent.window, newX, newY, null);
+				break;
+			}
+			case OS.GDK_KEY_PRESS:
+			case OS.GDK_KEY_RELEASE: {
+				GdkEventKey gdkEvent = new GdkEventKey ();
+				OS.memmove (gdkEvent, eventPtr, GdkEventKey.sizeof);
+				if (gdkEvent.keyval == OS.GDK_Escape) quit = true;
+				break;
+			}
+			case OS.GDK_BUTTON_RELEASE:
+			case OS.GDK_BUTTON_PRESS:
+			case OS.GDK_2BUTTON_PRESS:
+			case OS.GDK_3BUTTON_PRESS: {
+				OS.gdk_event_put (eventPtr);
+				quit = true;
+				break;
+			}
+			default:
+				OS.gtk_main_do_event (eventPtr);
+		}
+		OS.gdk_event_free (eventPtr);
+	}
+	return dragging;
+}
+
+boolean filterKey (int keyval, int /*long*/ event) {
+	int /*long*/ imHandle = imHandle ();
+	if (imHandle != 0) {
+		return OS.gtk_im_context_filter_keypress (imHandle, event);
+	}
+	return false;
+}
+
+Control findBackgroundControl () {
+	if ((state & BACKGROUND) != 0 || backgroundImage != null) return this;
+	return (state & PARENT_BACKGROUND) != 0 ? parent.findBackgroundControl () : null;
+}
+
+Menu [] findMenus (Control control) {
+	if (menu != null && this != control) return new Menu [] {menu};
+	return new Menu [0];
+}
+
+void fixChildren (Shell newShell, Shell oldShell, Decorations newDecorations, Decorations oldDecorations, Menu [] menus) {
+	oldShell.fixShell (newShell, this);
+	oldDecorations.fixDecorations (newDecorations, this, menus);
+}
+
+int /*long*/ fixedMapProc (int /*long*/ widget) {
+	OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_MAPPED);
+	int /*long*/ widgetList = OS.gtk_container_get_children (widget);
+	if (widgetList != 0) {
+		int /*long*/ widgets = widgetList;
+		while (widgets != 0) {
+			int /*long*/ child = OS.g_list_data (widgets);
+			if (OS.GTK_WIDGET_VISIBLE (child) && OS.gtk_widget_get_child_visible (child) && !OS.GTK_WIDGET_MAPPED (child)) {
+				OS.gtk_widget_map (child);
+			}
+			widgets = OS.g_list_next (widgets);
+		}
+		OS.g_list_free (widgetList);
+	}
+	if ((OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_NO_WINDOW) == 0) {
+		OS.gdk_window_show_unraised (OS.GTK_WIDGET_WINDOW (widget));
+	}
+	return 0;
+}
+
+/**
+ * Forces the receiver to have the <em>keyboard focus</em>, causing
+ * all keyboard events to be delivered to it.
+ *
+ * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setFocus
+ */
+public boolean forceFocus () {
+	checkWidget();
+	if (display.focusEvent == SWT.FocusOut) return false;
+	Shell shell = getShell ();
+	shell.setSavedFocus (this);
+	if (!isEnabled () || !isVisible ()) return false;
+	shell.bringToTop (false);
+	return forceFocus (focusHandle ());
+}
+
+boolean forceFocus (int /*long*/ focusHandle) {
+	/* When the control is zero sized it must be realized */
+	OS.gtk_widget_realize (focusHandle);
+	OS.gtk_widget_grab_focus (focusHandle);
+	Shell shell = getShell ();
+	int /*long*/ shellHandle = shell.shellHandle;
+	int /*long*/ handle = OS.gtk_window_get_focus (shellHandle);
+	while (handle != 0) {
+		if (handle == focusHandle) return true;
+		Widget widget = display.getWidget (handle);
+		if (widget != null && widget instanceof Control) {
+			return widget == this;
+		}
+		handle = OS.gtk_widget_get_parent (handle);
+	}
+	return false;
+}
+
+/**
+ * Returns the receiver's background color.
+ *
+ * @return the background color
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Color getBackground () {
+	checkWidget();
+	Control control = findBackgroundControl ();
+	if (control == null) control = this;
+	return Color.gtk_new (display, control.getBackgroundColor ());
+}
+
+GdkColor getBackgroundColor () {
+	return getBgColor ();
+}
+
+/**
+ * Returns the receiver's background image.
+ *
+ * @return the background image
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.2
+ */
+public Image getBackgroundImage () {
+	checkWidget ();
+	Control control = findBackgroundControl ();
+	if (control == null) control = this;
+	return control.backgroundImage;
+}
+
+GdkColor getBgColor () {
+	int /*long*/ fontHandle = fontHandle ();
+	OS.gtk_widget_realize (fontHandle);
+	GdkColor color = new GdkColor ();
+	OS.gtk_style_get_bg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
+	return color;
+}
+
+GdkColor getBaseColor () {
+	int /*long*/ fontHandle = fontHandle ();
+	OS.gtk_widget_realize (fontHandle);
+	GdkColor color = new GdkColor ();
+	OS.gtk_style_get_base (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
+	return color;
+}
+
+/**
+ * Returns the receiver's border width.
+ *
+ * @return the border width
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getBorderWidth () {
+	checkWidget();
+	return 0;
+}
+
+/**
+ * Returns the receiver's cursor, or null if it has not been set.
+ * <p>
+ * When the mouse pointer passes over a control its appearance
+ * is changed to match the control's cursor.
+ * </p>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.3
+ */
+public Cursor getCursor () {
+	checkWidget ();
+	return cursor;
+}
+
+/**
+ * Returns <code>true</code> if the receiver is detecting
+ * drag gestures, and  <code>false</code> otherwise.
+ *
+ * @return the receiver's drag detect state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.3
+ */
+public boolean getDragDetect () {
+	checkWidget ();
+	return (state & DRAG_DETECT) != 0;
+}
+
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #isEnabled
+ */
+public boolean getEnabled () {
+	checkWidget ();
+	return (state & DISABLED) == 0;
+}
+
+/**
+ * Returns the font that the receiver will use to paint textual information.
+ *
+ * @return the receiver's font
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Font getFont () {
+	checkWidget();
+	if (font != null) return font;
+	return Font.gtk_new (display, defaultFont ());
+}
+
+int /*long*/ getFontDescription () {
+	int /*long*/ fontHandle = fontHandle ();
+	OS.gtk_widget_realize (fontHandle);
+	return OS.gtk_style_get_font_desc (OS.gtk_widget_get_style (fontHandle));
+}
+
+/**
+ * Returns the foreground color that the receiver will use to draw.
+ *
+ * @return the receiver's foreground color
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Color getForeground () {
+	checkWidget();
+	return Color.gtk_new (display, getForegroundColor ());
+}
+
+GdkColor getForegroundColor () {
+	return getFgColor ();
+}
+
+GdkColor getFgColor () {
+	int /*long*/ fontHandle = fontHandle ();
+	OS.gtk_widget_realize (fontHandle);
+	GdkColor color = new GdkColor ();
+	OS.gtk_style_get_fg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
+	return color;
+}
+
+Point getIMCaretPos () {
+	return new Point (0, 0);
+}
+
+GdkColor getTextColor () {
+	int /*long*/ fontHandle = fontHandle ();
+	OS.gtk_widget_realize (fontHandle);
+	GdkColor color = new GdkColor ();
+	OS.gtk_style_get_text (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
+	return color;
+}
+
+/**
+ * Returns layout data which is associated with the receiver.
+ *
+ * @return the receiver's layout data
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Object getLayoutData () {
+	checkWidget();
+	return layoutData;
+}
+
+/**
+ * Returns the receiver's pop up menu if it has one, or null
+ * if it does not. All controls may optionally have a pop up
+ * menu that is displayed when the user requests one for
+ * the control. The sequence of key strokes, button presses
+ * and/or button releases that are used to request a pop up
+ * menu is platform specific.
+ *
+ * @return the receiver's menu
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getMenu () {
+	checkWidget();
+	return menu;
+}
+
+/**
+ * Returns the receiver's monitor.
+ *
+ * @return the receiver's monitor
+ *
+ * @since 3.0
+ */
+public Monitor getMonitor () {
+	checkWidget();
+	Monitor monitor = null;
+	int /*long*/ screen = OS.gdk_screen_get_default ();
+	if (screen != 0) {
+		int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, paintWindow ());
+		GdkRectangle dest = new GdkRectangle ();
+		OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest);
+		monitor = new Monitor ();
+		monitor.handle = monitorNumber;
+		monitor.x = dest.x;
+		monitor.y = dest.y;
+		monitor.width = dest.width;
+		monitor.height = dest.height;
+		Rectangle workArea = null;
+		if (monitorNumber == 0) workArea = display.getWorkArea ();
+		if (workArea != null) {
+			monitor.clientX = workArea.x;
+			monitor.clientY = workArea.y;
+			monitor.clientWidth = workArea.width;
+			monitor.clientHeight = workArea.height;
+		} else {
+			monitor.clientX = monitor.x;
+			monitor.clientY = monitor.y;
+			monitor.clientWidth = monitor.width;
+			monitor.clientHeight = monitor.height;
+		}
+	} else {
+		monitor = display.getPrimaryMonitor ();
+	}
+	return monitor;
+}
+
+/**
+ * Returns the receiver's parent, which must be a <code>Composite</code>
+ * or null when the receiver is a shell that was created with null or
+ * a display for a parent.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Composite getParent () {
+	checkWidget();
+	return parent;
+}
+
+Control [] getPath () {
+	int count = 0;
+	Shell shell = getShell ();
+	Control control = this;
+	while (control != shell) {
+		count++;
+		control = control.parent;
+	}
+	control = this;
+	Control [] result = new Control [count];
+	while (control != shell) {
+		result [--count] = control;
+		control = control.parent;
+	}
+	return result;
+}
+
+/**
+ * Returns the receiver's shell. For all controls other than
+ * shells, this simply returns the control's nearest ancestor
+ * shell. Shells return themselves, even if they are children
+ * of other shells.
+ *
+ * @return the receiver's shell
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getParent
+ */
+public Shell getShell() {
+	checkWidget();
+	return _getShell();
+}
+
+Shell _getShell() {
+	return parent._getShell();
+}
+
+/**
+ * Returns the receiver's tool tip text, or null if it has
+ * not been set.
+ *
+ * @return the receiver's tool tip text
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getToolTipText () {
+	checkWidget();
+	return toolTipText;
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getVisible () {
+	checkWidget();
+	return (state & HIDDEN) == 0;
+}
+
+int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event) {
+	GdkEventButton gdkEvent = new GdkEventButton ();
+	OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
+	if (gdkEvent.type == OS.GDK_3BUTTON_PRESS) return 0;
+	/*
+	* When a shell is created with SWT.ON_TOP and SWT.NO_FOCUS,
+	* do not activate the shell when the user clicks on the
+	* the client area or on the border or a control within the
+	* shell that does not take focus.
+	*/
+	Shell shell = _getShell ();
+	if (((shell.style & SWT.ON_TOP) != 0) && (((shell.style & SWT.NO_FOCUS) == 0) || ((style & SWT.NO_FOCUS) == 0))) {
+		shell.forceActive();
+	}
+	int /*long*/ result = 0;
+	if (gdkEvent.type == OS.GDK_BUTTON_PRESS) {
+		display.clickCount = 1;
+		int /*long*/ nextEvent = OS.gdk_event_peek ();
+		if (nextEvent != 0) {
+			int eventType = OS.GDK_EVENT_TYPE (nextEvent);
+			if (eventType == OS.GDK_2BUTTON_PRESS) display.clickCount = 2;
+			if (eventType == OS.GDK_3BUTTON_PRESS) display.clickCount = 3;
+			OS.gdk_event_free (nextEvent);
+		}
+		boolean dragging = false;
+		if ((state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect)) {
+			if (gdkEvent.button == 1) {
+				boolean [] consume = new boolean [1];
+				if (dragDetect ((int) gdkEvent.x, (int) gdkEvent.y, true, consume)) {
+					dragging = true;
+					if (consume [0]) result = 1;
+				}
+				if (isDisposed ()) return 1;
+			}
+		}
+		if (!sendMouseEvent (SWT.MouseDown, gdkEvent.button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state)) {
+			result = 1;
+		}
+		if (isDisposed ()) return 1;
+		if (dragging) {
+			sendDragEvent (gdkEvent.button, gdkEvent.state, (int) gdkEvent.x, (int) gdkEvent.y, false);
+			if (isDisposed ()) return 1;
+		}
+		/*
+		* Pop up the context menu in the button press event for widgets
+		* that have default operating system menus in order to stop the
+		* operating system from displaying the menu if necessary.
+		*/
+		if ((state & MENU) != 0) {
+			if (gdkEvent.button == 3) {
+				if (showMenu ((int)gdkEvent.x_root, (int)gdkEvent.y_root)) {
+					result = 1;
+				}
+			}
+		}
+	} else {
+		display.clickCount = 2;
+		result = sendMouseEvent (SWT.MouseDoubleClick, gdkEvent.button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+		if (isDisposed ()) return 1;
+	}
+	if (!shell.isDisposed ()) shell.setActiveControl (this);
+	return result;
+}
+
+int /*long*/ gtk_button_release_event (int /*long*/ widget, int /*long*/ event) {
+	GdkEventButton gdkEvent = new GdkEventButton ();
+	OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
+	/*
+	* Feature in GTK.  When button 4, 5, 6, or 7 is released, GTK
+	* does not deliver a corresponding GTK event.  Button 6 and 7
+	* are mapped to buttons 4 and 5 in SWT.  The fix is to change
+	* the button number of the event to a negative number so that
+	* it gets dispatched by GTK.  SWT has been modified to look
+	* for negative button numbers.
+	*/
+	int button = gdkEvent.button;
+	switch (button) {
+		case -6: button = 4; break;
+		case -7: button = 5; break;
+	}
+	return sendMouseEvent (SWT.MouseUp, button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+}
+
+int /*long*/ gtk_commit (int /*long*/ imcontext, int /*long*/ text) {
+	if (text == 0) return 0;
+	int length = OS.strlen (text);
+	if (length == 0) return 0;
+	byte [] buffer = new byte [length];
+	OS.memmove (buffer, text, length);
+	char [] chars = Converter.mbcsToWcs (null, buffer);
+	sendIMKeyEvent (SWT.KeyDown, null, chars);
+	return 0;
+}
+
+int /*long*/ gtk_enter_notify_event (int /*long*/ widget, int /*long*/ event) {
+	if (display.currentControl == this) return 0;
+	GdkEventCrossing gdkEvent = new GdkEventCrossing ();
+	OS.memmove (gdkEvent, event, GdkEventCrossing.sizeof);
+	if (gdkEvent.mode != OS.GDK_CROSSING_NORMAL && gdkEvent.mode != OS.GDK_CROSSING_UNGRAB) return 0;
+	if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) != 0) return 0;
+	if (display.currentControl != null && !display.currentControl.isDisposed ()) {
+		display.removeMouseHoverTimeout (display.currentControl.handle);
+		display.currentControl.sendMouseEvent (SWT.MouseExit,  0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state);
+	}
+	if (!isDisposed ()) {
+		display.currentControl = this;
+		return sendMouseEvent (SWT.MouseEnter, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+	}
+	return 0;
+}
+
+int /*long*/ gtk_event_after (int /*long*/ widget, int /*long*/ gdkEvent) {
+	GdkEvent event = new GdkEvent ();
+	OS.memmove (event, gdkEvent, GdkEvent.sizeof);
+	switch (event.type) {
+		case OS.GDK_BUTTON_PRESS: {
+			if (widget != eventHandle ()) break;
+			/*
+			* Pop up the context menu in the event_after signal to allow
+			* the widget to process the button press.  This allows widgets
+			* such as GtkTreeView to select items before a menu is shown.
+			*/
+			if ((state & MENU) == 0) {
+				GdkEventButton gdkEventButton = new GdkEventButton ();
+				OS.memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
+				if (gdkEventButton.button == 3) {
+					showMenu ((int) gdkEventButton.x_root, (int) gdkEventButton.y_root);
+				}
+			}
+			break;
+		}
+		case OS.GDK_FOCUS_CHANGE: {
+			if (widget != focusHandle ()) break;
+			GdkEventFocus gdkEventFocus = new GdkEventFocus ();
+			OS.memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof);
+
+			/*
+			 * Feature in GTK. The GTK combo box popup under some window managers
+			 * is implemented as a GTK_MENU.  When it pops up, it causes the combo
+			 * box to lose focus when focus is received for the menu.  The
+			 * fix is to check the current grab handle and see if it is a GTK_MENU
+			 * and ignore the focus event when the menu is both shown and hidden.
+			 */
+			Display display = this.display;
+			if (gdkEventFocus.in != 0) {
+				if (display.ignoreFocus) {
+					display.ignoreFocus = false;
+					break;
+				}
+			} else {
+				display.ignoreFocus = false;
+				int /*long*/ grabHandle = OS.gtk_grab_get_current ();
+				if (grabHandle != 0) {
+					if (OS.G_OBJECT_TYPE (grabHandle) == OS.GTK_TYPE_MENU ()) {
+						display.ignoreFocus = true;
+						break;
+					}
+				}
+			}
+
+			sendFocusEvent (gdkEventFocus.in != 0 ? SWT.FocusIn : SWT.FocusOut);
+			break;
+		}
+	}
+	return 0;
+}
+
+int /*long*/ gtk_expose_event (int /*long*/ widget, int /*long*/ eventPtr) {
+	if ((state & OBSCURED) != 0) return 0;
+	if (!hooks (SWT.Paint) && !filters (SWT.Paint)) return 0;
+	GdkEventExpose gdkEvent = new GdkEventExpose ();
+	OS.memmove(gdkEvent, eventPtr, GdkEventExpose.sizeof);
+	Event event = new Event ();
+	event.count = gdkEvent.count;
+	event.x = gdkEvent.area_x;
+	event.y = gdkEvent.area_y;
+	event.width = gdkEvent.area_width;
+	event.height = gdkEvent.area_height;
+	GCData data = new GCData ();
+	data.damageRgn = gdkEvent.region;
+	GC gc = event.gc = GC.gtk_new (this, data);
+	OS.gdk_gc_set_clip_region (gc.handle, gdkEvent.region);
+	sendEvent (SWT.Paint, event);
+	gc.dispose ();
+	event.gc = null;
+	return 0;
+}
+
+int /*long*/ gtk_focus (int /*long*/ widget, int /*long*/ directionType) {
+	/* Stop GTK traversal for every widget */
+	return 1;
+}
+
+int /*long*/ gtk_focus_in_event (int /*long*/ widget, int /*long*/ event) {
+	// widget could be disposed at this point
+	if (handle != 0) {
+		Control oldControl = display.imControl;
+		if (oldControl != this)  {
+			if (oldControl != null && !oldControl.isDisposed ()) {
+				int /*long*/ oldIMHandle = oldControl.imHandle ();
+				if (oldIMHandle != 0) OS.gtk_im_context_reset (oldIMHandle);
+			}
+		}
+		if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
+			int /*long*/ imHandle = imHandle ();
+			if (imHandle != 0) OS.gtk_im_context_focus_in (imHandle);
+		}
+	}
+	return 0;
+}
+
+int /*long*/ gtk_focus_out_event (int /*long*/ widget, int /*long*/ event) {
+	// widget could be disposed at this point
+	if (handle != 0) {
+		if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
+			int /*long*/ imHandle = imHandle ();
+			if (imHandle != 0) {
+				OS.gtk_im_context_focus_out (imHandle);
+			}
+		}
+	}
+	return 0;
+}
+
+int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) {
+	if (!hasFocus ()) return 0;
+	GdkEventKey gdkEvent = new GdkEventKey ();
+	OS.memmove (gdkEvent, event, GdkEventKey.sizeof);
+
+	if (translateMnemonic (gdkEvent.keyval, gdkEvent)) return 1;
+	// widget could be disposed at this point
+	if (isDisposed ()) return 0;
+
+	if (filterKey (gdkEvent.keyval, event)) return 1;
+	// widget could be disposed at this point
+	if (isDisposed ()) return 0;
+
+	if (translateTraversal (gdkEvent)) return 1;
+	// widget could be disposed at this point
+	if (isDisposed ()) return 0;
+	return super.gtk_key_press_event (widget, event);
+}
+
+int /*long*/ gtk_key_release_event (int /*long*/ widget, int /*long*/ event) {
+	if (!hasFocus ()) return 0;
+	int /*long*/ imHandle = imHandle ();
+	if (imHandle != 0) {
+		if (OS.gtk_im_context_filter_keypress (imHandle, event)) return 1;
+	}
+	return super.gtk_key_release_event (widget, event);
+}
+
+int /*long*/ gtk_leave_notify_event (int /*long*/ widget, int /*long*/ event) {
+	if (display.currentControl != this) return 0;
+	display.removeMouseHoverTimeout (handle);
+	int result = 0;
+	if (sendLeaveNotify () || display.getCursorControl () == null) {
+		GdkEventCrossing gdkEvent = new GdkEventCrossing ();
+		OS.memmove (gdkEvent, event, GdkEventCrossing.sizeof);
+		if (gdkEvent.mode != OS.GDK_CROSSING_NORMAL && gdkEvent.mode != OS.GDK_CROSSING_UNGRAB) return 0;
+		if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) != 0) return 0;
+		result = sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+		display.currentControl = null;
+	}
+	return result;
+}
+
+int /*long*/ gtk_mnemonic_activate (int /*long*/ widget, int /*long*/ arg1) {
+	int result = 0;
+	int /*long*/ eventPtr = OS.gtk_get_current_event ();
+	if (eventPtr != 0) {
+		GdkEventKey keyEvent = new GdkEventKey ();
+		OS.memmove (keyEvent, eventPtr, GdkEventKey.sizeof);
+		if (keyEvent.type == OS.GDK_KEY_PRESS) {
+			Control focusControl = display.getFocusControl ();
+			int /*long*/ focusHandle = focusControl != null ? focusControl.focusHandle () : 0;
+			if (focusHandle != 0) {
+				display.mnemonicControl = this;
+				OS.gtk_widget_event (focusHandle, eventPtr);
+				display.mnemonicControl = null;
+			}
+			result = 1;
+		}
+		OS.gdk_event_free (eventPtr);
+	}
+	return result;
+}
+
+int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) {
+	GdkEventMotion gdkEvent = new GdkEventMotion ();
+	OS.memmove (gdkEvent, event, GdkEventMotion.sizeof);
+	if (this == display.currentControl && (hooks (SWT.MouseHover) || filters (SWT.MouseHover))) {
+		display.addMouseHoverTimeout (handle);
+	}
+	double x = gdkEvent.x_root, y = gdkEvent.y_root;
+	int state = gdkEvent.state;
+	if (gdkEvent.is_hint != 0) {
+		int [] pointer_x = new int [1], pointer_y = new int [1], mask = new int [1];
+		int /*long*/ window = eventWindow ();
+		OS.gdk_window_get_pointer (window, pointer_x, pointer_y, mask);
+		x = pointer_x [0];
+		y = pointer_y [0];
+		state = mask [0];
+	}
+	int result = sendMouseEvent (SWT.MouseMove, 0, gdkEvent.time, x, y, gdkEvent.is_hint != 0, state) ? 0 : 1;
+	return result;
+}
+
+int /*long*/ gtk_popup_menu (int /*long*/ widget) {
+	if (!hasFocus()) return 0;
+	int [] x = new int [1], y = new int [1];
+	OS.gdk_window_get_pointer (0, x, y, null);
+	return showMenu (x [0], y [0]) ? 1 : 0;
+}
+
+int /*long*/ gtk_preedit_changed (int /*long*/ imcontext) {
+	display.showIMWindow (this);
+	return 0;
+}
+
+int /*long*/ gtk_realize (int /*long*/ widget) {
+	int /*long*/ imHandle = imHandle ();
+	if (imHandle != 0) {
+		int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
+		OS.gtk_im_context_set_client_window (imHandle, window);
+	}
+	if (backgroundImage != null) {
+		int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
+		if (window != 0) OS.gdk_window_set_back_pixmap (window, backgroundImage.pixmap, false);
+	}
+	return 0;
+}
+
+int /*long*/ gtk_scroll_event (int /*long*/ widget, int /*long*/ eventPtr) {
+	GdkEventScroll gdkEvent = new GdkEventScroll ();
+	OS.memmove (gdkEvent, eventPtr, GdkEventScroll.sizeof);
+	switch (gdkEvent.direction) {
+		case OS.GDK_SCROLL_UP:
+			return sendMouseEvent (SWT.MouseWheel, 0, 3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+		case OS.GDK_SCROLL_DOWN:
+			return sendMouseEvent (SWT.MouseWheel, 0, -3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+		case OS.GDK_SCROLL_LEFT:
+			return sendMouseEvent (SWT.MouseDown, 4, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+		case OS.GDK_SCROLL_RIGHT:
+			return sendMouseEvent (SWT.MouseDown, 5, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+	}
+	return 0;
+}
+
+int /*long*/ gtk_show_help (int /*long*/ widget, int /*long*/ helpType) {
+	if (!hasFocus ()) return 0;
+	return sendHelpEvent (helpType) ? 1 : 0;
+}
+
+int /*long*/ gtk_style_set (int /*long*/ widget, int /*long*/ previousStyle) {
+	if (backgroundImage != null) {
+		setBackgroundPixmap (backgroundImage.pixmap);
+	}
+	return 0;
+}
+
+int /*long*/ gtk_unrealize (int /*long*/ widget) {
+	int /*long*/ imHandle = imHandle ();
+	if (imHandle != 0) OS.gtk_im_context_set_client_window (imHandle, 0);
+	return 0;
+}
+
+int /*long*/ gtk_visibility_notify_event (int /*long*/ widget, int /*long*/ event) {
+	GdkEventVisibility gdkEvent = new GdkEventVisibility ();
+	OS.memmove (gdkEvent, event, GdkEventVisibility.sizeof);
+	int /*long*/ paintWindow = paintWindow();
+	int /*long*/ window = gdkEvent.window;
+	if (window == paintWindow) {
+		if (gdkEvent.state == OS.GDK_VISIBILITY_FULLY_OBSCURED) {
+			state |= OBSCURED;
+		} else {
+			if ((state & OBSCURED) != 0) {
+				int [] width = new int [1], height = new int [1];
+				OS.gdk_drawable_get_size (window, width, height);
+				GdkRectangle rect = new GdkRectangle ();
+				rect.width = width [0];
+				rect.height = height [0];
+				OS.gdk_window_invalidate_rect (window, rect, false);
+			}
+			state &= ~OBSCURED;
+		}
+	}
+	return 0;
+}
+
+void gtk_widget_size_request (int /*long*/ widget, GtkRequisition requisition) {
+	OS.gtk_widget_size_request (widget, requisition);
+}
+
+/**
+ * Invokes platform specific functionality to allocate a new GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Control</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param data the platform specific GC data
+ * @return the platform specific GC handle
+ */
+public int /*long*/ internal_new_GC (GCData data) {
+	checkWidget ();
+	int /*long*/ window = paintWindow ();
+	if (window == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+	int /*long*/ gdkGC = OS.gdk_gc_new (window);
+	if (gdkGC == 0) error (SWT.ERROR_NO_HANDLES);
+	if (data != null) {
+		int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
+		if ((data.style & mask) == 0) {
+			data.style |= style & (mask | SWT.MIRRORED);
+		}
+		data.drawable = window;
+		data.device = display;
+		data.foreground = getForegroundColor ();
+		Control control = findBackgroundControl ();
+		if (control == null) control = this;
+		data.background = control.getBackgroundColor ();
+		data.font = font != null ? font.handle : defaultFont ();
+	}
+	return gdkGC;
+}
+
+int /*long*/ imHandle () {
+	return 0;
+}
+
+/**
+ * Invokes platform specific functionality to dispose a GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Control</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param hDC the platform specific GC handle
+ * @param data the platform specific GC data
+ */
+public void internal_dispose_GC (int /*long*/ gdkGC, GCData data) {
+	checkWidget ();
+	OS.g_object_unref (gdkGC);
+}
+
+/**
+ * Returns <code>true</code> if the underlying operating
+ * system supports this reparenting, otherwise <code>false</code>
+ *
+ * @return <code>true</code> if the widget can be reparented, otherwise <code>false</code>
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isReparentable () {
+	checkWidget();
+	return true;
+}
+boolean isShowing () {
+	/*
+	* This is not complete.  Need to check if the
+	* widget is obscurred by a parent or sibling.
+	*/
+	if (!isVisible ()) return false;
+	Control control = this;
+	while (control != null) {
+		Point size = control.getSize ();
+		if (size.x == 0 || size.y == 0) {
+			return false;
+		}
+		control = control.parent;
+	}
+	return true;
+}
+boolean isTabGroup () {
+	Control [] tabList = parent._getTabList ();
+	if (tabList != null) {
+		for (int i=0; i<tabList.length; i++) {
+			if (tabList [i] == this) return true;
+		}
+	}
+	int code = traversalCode (0, null);
+	if ((code & (SWT.TRAVERSE_ARROW_PREVIOUS | SWT.TRAVERSE_ARROW_NEXT)) != 0) return false;
+	return (code & (SWT.TRAVERSE_TAB_PREVIOUS | SWT.TRAVERSE_TAB_NEXT)) != 0;
+}
+boolean isTabItem () {
+	Control [] tabList = parent._getTabList ();
+	if (tabList != null) {
+		for (int i=0; i<tabList.length; i++) {
+			if (tabList [i] == this) return false;
+		}
+	}
+	int code = traversalCode (0, null);
+	return (code & (SWT.TRAVERSE_ARROW_PREVIOUS | SWT.TRAVERSE_ARROW_NEXT)) != 0;
+}
+
+/**
+ * Returns <code>true</code> if the receiver is enabled and all
+ * ancestors up to and including the receiver's nearest ancestor
+ * shell are enabled.  Otherwise, <code>false</code> is returned.
+ * A disabled control is typically not selectable from the user
+ * interface and draws with an inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getEnabled
+ */
+public boolean isEnabled () {
+	checkWidget ();
+	return getEnabled () && parent.isEnabled ();
+}
+
+boolean isFocusAncestor (Control control) {
+	while (control != null && control != this && !(control instanceof Shell)) {
+		control = control.parent;
+	}
+	return control == this;
+}
+
+/**
+ * Returns <code>true</code> if the receiver has the user-interface
+ * focus, and <code>false</code> otherwise.
+ *
+ * @return the receiver's focus state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isFocusControl () {
+	checkWidget();
+	Control focusControl = display.focusControl;
+	if (focusControl != null && !focusControl.isDisposed ()) {
+		return this == focusControl;
+	}
+	return hasFocus ();
+}
+
+/**
+ * Returns <code>true</code> if the receiver is visible and all
+ * ancestors up to and including the receiver's nearest ancestor
+ * shell are visible. Otherwise, <code>false</code> is returned.
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getVisible
+ */
+public boolean isVisible () {
+	checkWidget();
+	return getVisible () && parent.isVisible ();
+}
+
+Decorations menuShell () {
+	return parent.menuShell ();
+}
+
+boolean mnemonicHit (char key) {
+	return false;
+}
+
+boolean mnemonicMatch (char key) {
+	return false;
+}
+
+void register () {
+	super.register ();
+	if (fixedHandle != 0) display.addWidget (fixedHandle, this);
+	int /*long*/ imHandle = imHandle ();
+	if (imHandle != 0) display.addWidget (imHandle, this);
+}
+
+/**
+ * Causes the entire bounds of the receiver to be marked
+ * as needing to be redrawn. The next time a paint request
+ * is processed, the control will be completely painted,
+ * including the background.
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #update()
+ * @see PaintListener
+ * @see SWT#Paint
+ * @see SWT#NO_BACKGROUND
+ * @see SWT#NO_REDRAW_RESIZE
+ * @see SWT#NO_MERGE_PAINTS
+ * @see SWT#DOUBLE_BUFFERED
+ */
+public void redraw () {
+	checkWidget();
+	redraw (false);
+}
+
+void redraw (boolean all) {
+//	checkWidget();
+	if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return;
+	redrawWidget (0, 0, 0, 0, true, all, false);
+}
+
+/**
+ * Causes the rectangular area of the receiver specified by
+ * the arguments to be marked as needing to be redrawn.
+ * The next time a paint request is processed, that area of
+ * the receiver will be painted, including the background.
+ * If the <code>all</code> flag is <code>true</code>, any
+ * children of the receiver which intersect with the specified
+ * area will also paint their intersecting areas. If the
+ * <code>all</code> flag is <code>false</code>, the children
+ * will not be painted.
+ *
+ * @param x the x coordinate of the area to draw
+ * @param y the y coordinate of the area to draw
+ * @param width the width of the area to draw
+ * @param height the height of the area to draw
+ * @param all <code>true</code> if children should redraw, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #update()
+ * @see PaintListener
+ * @see SWT#Paint
+ * @see SWT#NO_BACKGROUND
+ * @see SWT#NO_REDRAW_RESIZE
+ * @see SWT#NO_MERGE_PAINTS
+ * @see SWT#DOUBLE_BUFFERED
+ */
+public void redraw (int x, int y, int width, int height, boolean all) {
+	checkWidget();
+	if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return;
+	redrawWidget (x, y, width, height, false, all, false);
+}
+
+void redrawChildren () {
+}
+
+void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean all, boolean trim) {
+	if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return;
+	int /*long*/ window = paintWindow ();
+	GdkRectangle rect = new GdkRectangle ();
+	if (redrawAll) {
+		int [] w = new int [1], h = new int [1];
+		OS.gdk_drawable_get_size (window, w, h);
+		rect.width = w [0];
+		rect.height = h [0];
+	} else {
+		rect.x = x;
+		rect.y = y;
+		rect.width = width;
+		rect.height = height;
+	}
+	OS.gdk_window_invalidate_rect (window, rect, all);
+}
+
+void release (boolean destroy) {
+	Control next = null, previous = null;
+	if (destroy && parent != null) {
+		Control[] children = parent._getChildren ();
+		int index = 0;
+		while (index < children.length) {
+			if (children [index] == this) break;
+			index++;
+		}
+		if (0 < index && (index + 1) < children.length) {
+			next = children [index + 1];
+			previous = children [index - 1];
+		}
+	}
+	super.release (destroy);
+	if (destroy) {
+		if (previous != null) previous.addRelation (next);
+	}
+}
+
+void releaseHandle () {
+	super.releaseHandle ();
+	fixedHandle = 0;
+	parent = null;
+}
+
+void releaseParent () {
+	parent.removeControl (this);
+}
+
+void releaseWidget () {
+	super.releaseWidget ();
+	if (display.currentControl == this) display.currentControl = null;
+	display.removeMouseHoverTimeout (handle);
+	int /*long*/ imHandle = imHandle ();
+	if (imHandle != 0) {
+		OS.gtk_im_context_reset (imHandle);
+		OS.gtk_im_context_set_client_window (imHandle, 0);
+	}
+	if (enableWindow != 0) {
+		OS.gdk_window_set_user_data (enableWindow, 0);
+		OS.gdk_window_destroy (enableWindow);
+		enableWindow = 0;
+	}
+	redrawWindow = 0;
+	if (menu != null && !menu.isDisposed ()) {
+		menu.dispose ();
+	}
+	menu = null;
+	cursor = null;
+	toolTipText = null;
+	layoutData = null;
+	accessible = null;
+}
+
+boolean sendDragEvent (int button, int stateMask, int x, int y, boolean isStateMask) {
+	Event event = new Event ();
+	event.button = button;
+	event.x = x;
+	event.y = y;
+	if (isStateMask) {
+		event.stateMask = stateMask;
+	} else {
+		setInputState (event, stateMask);
+	}
+	postEvent (SWT.DragDetect, event);
+	if (isDisposed ()) return false;
+	return event.doit;
+}
+
+void sendFocusEvent (int type) {
+	Shell shell = _getShell ();
+	Display display = this.display;
+	display.focusControl = this;
+	display.focusEvent = type;
+	sendEvent (type);
+	display.focusControl = null;
+	display.focusEvent = SWT.None;
+	/*
+	* It is possible that the shell may be
+	* disposed at this point.  If this happens
+	* don't send the activate and deactivate
+	* events.
+	*/
+	if (!shell.isDisposed ()) {
+		switch (type) {
+			case SWT.FocusIn:
+				shell.setActiveControl (this);
+				break;
+			case SWT.FocusOut:
+				if (shell != display.activeShell) {
+					shell.setActiveControl (null);
+				}
+				break;
+		}
+	}
+}
+
+boolean sendHelpEvent (int /*long*/ helpType) {
+	Control control = this;
+	while (control != null) {
+		if (control.hooks (SWT.Help)) {
+			control.postEvent (SWT.Help);
+			return true;
+		}
+		control = control.parent;
+	}
+	return false;
+}
+
+boolean sendLeaveNotify() {
+	return false;
+}
+
+boolean sendMouseEvent (int type, int button, int time, double x, double y, boolean is_hint, int state) {
+	return sendMouseEvent (type, button, 0, 0, false, time, x, y, is_hint, state);
+}
+
+boolean sendMouseEvent (int type, int button, int count, int detail, boolean send, int time, double x, double y, boolean is_hint, int state) {
+	if (!hooks (type) && !filters (type)) return true;
+	Event event = new Event ();
+	event.time = time;
+	event.button = button;
+	event.detail = detail;
+	event.count = count;
+	if (is_hint) {
+		event.x = (int)x;
+		event.y = (int)y;
+	} else {
+		int /*long*/ window = eventWindow ();
+		int [] origin_x = new int [1], origin_y = new int [1];
+		OS.gdk_window_get_origin (window, origin_x, origin_y);
+		event.x = (int)x - origin_x [0];
+		event.y = (int)y - origin_y [0];
+	}
+	setInputState (event, state);
+	if (send) {
+		sendEvent (type, event);
+		if (isDisposed ()) return false;
+	} else {
+		postEvent (type, event);
+	}
+	return event.doit;
+}
+
+void setBackground () {
+	if ((state & PARENT_BACKGROUND) != 0 && (state & BACKGROUND) == 0 && backgroundImage == null) {
+		setParentBackground ();
+	} else {
+		setWidgetBackground ();
+	}
+	redrawWidget (0, 0, 0, 0, true, false, false);
+}
+
+/**
+ * Sets the receiver's background color to the color specified
+ * by the argument, or to the default system color for the control
+ * if the argument is null.
+ * <p>
+ * Note: This operation is a hint and may be overridden by the platform.
+ * For example, on Windows the background of a Button cannot be changed.
+ * </p>
+ * @param color the new color (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBackground (Color color) {
+	checkWidget();
+	if (((state & BACKGROUND) == 0) && color == null) return;
+	GdkColor gdkColor = null;
+	if (color != null) {
+		if (color.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+		gdkColor = color.handle;
+	}
+	boolean set = false;
+	if (gdkColor == null) {
+		int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
+		set = (OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL) & OS.GTK_RC_BG) != 0;
+	} else {
+		GdkColor oldColor = getBackgroundColor ();
+		set = oldColor.pixel != gdkColor.pixel;
+	}
+	if (set) {
+		if (color == null) {
+			state &= ~BACKGROUND;
+		} else {
+			state |= BACKGROUND;
+		}
+		setBackgroundColor (gdkColor);
+		redrawChildren ();
+	}
+}
+
+void setBackgroundColor (int /*long*/ handle, GdkColor color) {
+	int index = OS.GTK_STATE_NORMAL;
+	int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
+	int /*long*/ ptr = OS.gtk_rc_style_get_bg_pixmap_name (style, index);
+	if (ptr != 0) OS.g_free (ptr);
+	String name = color == null ? "<parent>" : "<none>";
+	byte[] buffer = Converter.wcsToMbcs (null, name, true);
+	ptr = OS.g_malloc (buffer.length);
+	OS.memmove (ptr, buffer, buffer.length);
+	OS.gtk_rc_style_set_bg_pixmap_name (style, index, ptr);
+	OS.gtk_rc_style_set_bg (style, index, color);
+	int flags = OS.gtk_rc_style_get_color_flags (style, index);
+	flags = (color == null) ? flags & ~OS.GTK_RC_BG : flags | OS.GTK_RC_BG;
+	OS.gtk_rc_style_set_color_flags (style, index, flags);
+	OS.gtk_widget_modify_style (handle, style);
+}
+
+void setBackgroundColor (GdkColor color) {
+	setBackgroundColor (handle, color);
+}
+
+/**
+ * Sets the receiver's background image to the image specified
+ * by the argument, or to the default system color for the control
+ * if the argument is null.  The background image is tiled to fill
+ * the available space.
+ * <p>
+ * Note: This operation is a hint and may be overridden by the platform.
+ * For example, on Windows the background of a Button cannot be changed.
+ * </p>
+ * @param image the new image (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ *    <li>ERROR_INVALID_ARGUMENT - if the argument is not a bitmap</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.2
+ */
+public void setBackgroundImage (Image image) {
+	checkWidget ();
+	if (image != null && image.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+	if (image == backgroundImage) return;
+	this.backgroundImage = image;
+	if (backgroundImage != null) {
+		setBackgroundPixmap (backgroundImage.pixmap);
+		redrawWidget (0, 0, 0, 0, true, false, false);
+	} else {
+		setWidgetBackground ();
+	}
+	redrawChildren ();
+}
+
+void setBackgroundPixmap (int /*long*/ pixmap) {
+	int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
+	if (window != 0) OS.gdk_window_set_back_pixmap (window, backgroundImage.pixmap, false);
+}
+
+/**
+ * If the argument is <code>true</code>, causes the receiver to have
+ * all mouse events delivered to it until the method is called with
+ * <code>false</code> as the argument.
+ *
+ * @param capture <code>true</code> to capture the mouse, and <code>false</code> to release it
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setCapture (boolean capture) {
+	checkWidget();
+	/* FIXME !!!!! */
+	/*
+	if (capture) {
+		OS.gtk_widget_grab_focus (handle);
+	} else {
+		OS.gtk_widget_grab_default (handle);
+	}
+	*/
+}
+/**
+ * Sets the receiver's cursor to the cursor specified by the
+ * argument, or to the default cursor for that kind of control
+ * if the argument is null.
+ * <p>
+ * When the mouse pointer passes over a control its appearance
+ * is changed to match the control's cursor.
+ * </p>
+ *
+ * @param cursor the new cursor (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setCursor (Cursor cursor) {
+	checkWidget();
+	if (cursor != null && cursor.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
+	this.cursor = cursor;
+	setCursor (cursor != null ? cursor.handle : 0);
+}
+
+void setCursor (int /*long*/ cursor) {
+	int /*long*/ window = eventWindow ();
+	if (window != 0) {
+		OS.gdk_window_set_cursor (window, cursor);
+		if (!OS.GDK_WINDOWING_X11 ()) {
+			OS.gdk_flush ();
+		} else {
+			int /*long*/ xDisplay = OS.GDK_DISPLAY ();
+			OS.XFlush (xDisplay);
+		}
+	}
+}
+
+/**
+ * Sets the receiver's drag detect state. If the argument is
+ * <code>true</code>, the receiver will detect drag gestures,
+ * otherwise these gestures will be ignored.
+ *
+ * @param dragDetect the new drag detect state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.3
+ */
+public void setDragDetect (boolean dragDetect) {
+	checkWidget ();
+	if (dragDetect) {
+		state |= DRAG_DETECT;
+	} else {
+		state &= ~DRAG_DETECT;
+	}
+}
+
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+	checkWidget();
+	if (((state & DISABLED) == 0) == enabled) return;
+	Control control = null;
+	boolean fixFocus = false;
+	if (!enabled) {
+		if (display.focusEvent != SWT.FocusOut) {
+			control = display.getFocusControl ();
+			fixFocus = isFocusAncestor (control);
+		}
+	}
+	if (enabled) {
+		state &= ~DISABLED;
+	} else {
+		state |= DISABLED;
+	}
+	enableWidget (enabled);
+	if (isDisposed ()) return;
+	if (enabled) {
+		if (enableWindow != 0) {
+			OS.gdk_window_set_user_data (enableWindow, 0);
+			OS.gdk_window_destroy (enableWindow);
+			enableWindow = 0;
+		}
+	} else {
+		OS.gtk_widget_realize (handle);
+		int /*long*/ parentHandle = parent.parentingHandle ();
+		int /*long*/ window = OS.GTK_WIDGET_WINDOW (parentHandle);
+		Rectangle rect = getBounds ();
+		GdkWindowAttr attributes = new GdkWindowAttr ();
+		attributes.x = rect.x;
+		attributes.y = rect.y;
+		attributes.width = rect.width;
+		attributes.height = rect.height;
+		attributes.event_mask = (0xFFFFFFFF & ~OS.ExposureMask);
+		attributes.wclass = OS.GDK_INPUT_ONLY;
+		attributes.window_type = OS.GDK_WINDOW_CHILD;
+		enableWindow = OS.gdk_window_new (window, attributes, OS.GDK_WA_X | OS.GDK_WA_Y);
+		if (enableWindow != 0) {
+			int /*long*/ topHandle = topHandle ();
+			OS.gdk_window_set_user_data (enableWindow, parentHandle);
+			if (!OS.GDK_WINDOWING_X11 ()) {
+				OS.gdk_window_raise (enableWindow);
+			} else {
+				int /*long*/ topWindow = OS.GTK_WIDGET_WINDOW (topHandle);
+				int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (topWindow);
+				int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (enableWindow);
+				int xScreen = OS.XDefaultScreen (xDisplay);
+				int flags = OS.CWStackMode | OS.CWSibling;
+				XWindowChanges changes = new XWindowChanges ();
+				changes.sibling = OS.gdk_x11_drawable_get_xid (topWindow);
+				changes.stack_mode = OS.Above;
+				OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
+			}
+			if (OS.GTK_WIDGET_VISIBLE (topHandle)) OS.gdk_window_show_unraised (enableWindow);
+		}
+	}
+	if (fixFocus) fixFocus (control);
+}
+
+/**
+ * Causes the receiver to have the <em>keyboard focus</em>,
+ * such that all keyboard events will be delivered to it.  Focus
+ * reassignment will respect applicable platform constraints.
+ *
+ * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #forceFocus
+ */
+public boolean setFocus () {
+	checkWidget();
+	if ((style & SWT.NO_FOCUS) != 0) return false;
+	return forceFocus ();
+}
+
+/**
+ * Sets the font that the receiver will use to paint textual information
+ * to the font specified by the argument, or to the default font for that
+ * kind of control if the argument is null.
+ *
+ * @param font the new font (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setFont (Font font) {
+	checkWidget();
+	if (((state & FONT) == 0) && font == null) return;
+	this.font = font;
+	int /*long*/ fontDesc;
+	if (font == null) {
+		fontDesc = defaultFont ();
+	} else {
+		if (font.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+		fontDesc = font.handle;
+	}
+	if (font == null) {
+		state &= ~FONT;
+	} else {
+		state |= FONT;
+	}
+	setFontDescription (fontDesc);
+}
+
+void setFontDescription (int /*long*/ font) {
+	OS.gtk_widget_modify_font (handle, font);
+}
+
+/**
+ * Sets the receiver's foreground color to the color specified
+ * by the argument, or to the default system color for the control
+ * if the argument is null.
+ * <p>
+ * Note: This operation is a hint and may be overridden by the platform.
+ * </p>
+ * @param color the new color (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setForeground (Color color) {
+	checkWidget();
+	if (((state & FOREGROUND) == 0) && color == null) return;
+	GdkColor gdkColor = null;
+	if (color != null) {
+		if (color.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+		gdkColor = color.handle;
+	}
+	boolean set = false;
+	if (gdkColor == null) {
+		int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
+		set = (OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL) & OS.GTK_RC_FG) != 0;
+	} else {
+		GdkColor oldColor = getForegroundColor ();
+		set = oldColor.pixel != gdkColor.pixel;
+	}
+	if (set) {
+		if (color == null) {
+			state &= ~FOREGROUND;
+		} else {
+			state |= FOREGROUND;
+		}
+		setForegroundColor (gdkColor);
+	}
+}
+
+void setForegroundColor (GdkColor color) {
+	setForegroundColor (handle, color);
+}
+
+void setInitialBounds () {
+	if ((state & ZERO_WIDTH) != 0 && (state & ZERO_HEIGHT) != 0) {
+		/*
+		* Feature in GTK.  On creation, each widget's allocation is
+		* initialized to a position of (-1, -1) until the widget is
+		* first sized.  The fix is to set the value to (0, 0) as
+		* expected by SWT.
+		*/
+		int /*long*/ topHandle = topHandle ();
+		OS.GTK_WIDGET_SET_X (topHandle, 0);
+		OS.GTK_WIDGET_SET_Y (topHandle, 0);
+	} else {
+		resizeHandle (1, 1);
+		forceResize ();
+	}
+}
+
+/**
+ * Sets the receiver's pop up menu to the argument.
+ * All controls may optionally have a pop up
+ * menu that is displayed when the user requests one for
+ * the control. The sequence of key strokes, button presses
+ * and/or button releases that are used to request a pop up
+ * menu is platform specific.
+ * <p>
+ * Note: Disposing of a control that has a pop up menu will
+ * dispose of the menu.  To avoid this behavior, set the
+ * menu to null before the control is disposed.
+ * </p>
+ *
+ * @param menu the new pop up menu
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu</li>
+ *    <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
+ *    <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMenu (Menu menu) {
+	checkWidget();
+	if (menu != null) {
+		if ((menu.style & SWT.POP_UP) == 0) {
+			error (SWT.ERROR_MENU_NOT_POP_UP);
+		}
+		if (menu.parent != menuShell ()) {
+			error (SWT.ERROR_INVALID_PARENT);
+		}
+	}
+	this.menu = menu;
+}
+
+void setOrientation () {
+	if ((style & SWT.RIGHT_TO_LEFT) != 0) {
+		if (handle != 0) OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
+		if (fixedHandle != 0) OS.gtk_widget_set_direction (fixedHandle, OS.GTK_TEXT_DIR_RTL);
+	}
+}
+
+/**
+ * Changes the parent of the widget to be the one provided if
+ * the underlying operating system supports this feature.
+ * Returns <code>true</code> if the parent is successfully changed.
+ *
+ * @param parent the new parent for the control.
+ * @return <code>true</code> if the parent is changed and <code>false</code> otherwise.
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ *    <li>ERROR_NULL_ARGUMENT - if the parent is <code>null</code></li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ *	</ul>
+ */
+public boolean setParent (Composite parent) {
+	checkWidget ();
+	if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+	if (parent.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
+	if (this.parent == parent) return true;
+	if (!isReparentable ()) return false;
+	releaseParent ();
+	Shell newShell = parent.getShell (), oldShell = getShell ();
+	Decorations newDecorations = parent.menuShell (), oldDecorations = menuShell ();
+	Menu [] menus = oldShell.findMenus (this);
+	if (oldShell != newShell || oldDecorations != newDecorations) {
+		fixChildren (newShell, oldShell, newDecorations, oldDecorations, menus);
+		newDecorations.fixAccelGroup ();
+		oldDecorations.fixAccelGroup ();
+	}
+	int /*long*/ topHandle = topHandle ();
+	int /*long*/ newParent = parent.parentingHandle();
+	int x = OS.GTK_WIDGET_X (topHandle);
+	int y = OS.GTK_WIDGET_Y (topHandle);
+	OS.gtk_widget_reparent (topHandle, newParent);
+	OS.gtk_fixed_move (newParent, topHandle, x, y);
+	this.parent = parent;
+	setZOrder (null, false, true);
+	return true;
+}
+
+void setParentBackground () {
+	setBackgroundColor (handle, null);
+	if (fixedHandle != 0) setBackgroundColor (fixedHandle, null);
+}
+
+void setParentWindow (int /*long*/ widget) {
+}
+
+boolean setRadioSelection (boolean value) {
+	return false;
+}
+
+/**
+ * If the argument is <code>false</code>, causes subsequent drawing
+ * operations in the receiver to be ignored. No drawing of any kind
+ * can occur in the receiver until the flag is set to true.
+ * Graphics operations that occurred while the flag was
+ * <code>false</code> are lost. When the flag is set to <code>true</code>,
+ * the entire widget is marked as needing to be redrawn.  Nested calls
+ * to this method are stacked.
+ * <p>
+ * Note: This operation is a hint and may not be supported on some
+ * platforms or for some widgets.
+ * </p>
+ *
+ * @param redraw the new redraw state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #redraw(int, int, int, int, boolean)
+ * @see #update()
+ */
+public void setRedraw (boolean redraw) {
+	checkWidget();
+	if (redraw) {
+		if (--drawCount == 0) {
+			if (redrawWindow != 0) {
+				int /*long*/ window = paintWindow ();
+				/* Explicitly hiding the window avoids flicker on GTK+ >= 2.6 */
+				OS.gdk_window_hide (redrawWindow);
+				OS.gdk_window_destroy (redrawWindow);
+				OS.gdk_window_set_events (window, OS.gtk_widget_get_events (paintHandle ()));
+				redrawWindow = 0;
+			}
+		}
+	} else {
+		if (drawCount++ == 0) {
+			if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) != 0) {
+				int /*long*/ window = paintWindow ();
+				Rectangle rect = getBounds ();
+				GdkWindowAttr attributes = new GdkWindowAttr ();
+				attributes.width = rect.width;
+				attributes.height = rect.height;
+				attributes.event_mask = OS.GDK_EXPOSURE_MASK;
+				attributes.window_type = OS.GDK_WINDOW_CHILD;
+				redrawWindow = OS.gdk_window_new (window, attributes, 0);
+				if (redrawWindow != 0) {
+					int mouseMask = OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
+						OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK |
+						OS.GDK_POINTER_MOTION_MASK | OS.GDK_POINTER_MOTION_HINT_MASK |
+						OS.GDK_BUTTON_MOTION_MASK | OS.GDK_BUTTON1_MOTION_MASK |
+						OS.GDK_BUTTON2_MOTION_MASK | OS.GDK_BUTTON3_MOTION_MASK;
+					OS.gdk_window_set_events (window, OS.gdk_window_get_events (window) & ~mouseMask);
+					OS.gdk_window_set_back_pixmap (redrawWindow, 0, false);
+					OS.gdk_window_show (redrawWindow);
+				}
+			}
+		}
+	}
+}
+
+boolean setTabGroupFocus (boolean next) {
+	return setTabItemFocus (next);
+}
+boolean setTabItemFocus (boolean next) {
+	if (!isShowing ()) return false;
+	return forceFocus ();
+}
+
+/**
+ * Sets the receiver's tool tip text to the argument, which
+ * may be null indicating that no tool tip text should be shown.
+ *
+ * @param string the new tool tip text (or null)
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setToolTipText (String string) {
+	checkWidget();
+	setToolTipText (_getShell (), string);
+	toolTipText = string;
+}
+
+void setToolTipText (Shell shell, String newString) {
+	shell.setToolTipText (eventHandle (), newString);
+}
+
+/**
+ * Marks the receiver as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setVisible (boolean visible) {
+	checkWidget();
+	if (((state & HIDDEN) == 0) == visible) return;
+	int /*long*/ topHandle = topHandle();
+	if (visible) {
+		/*
+		* It is possible (but unlikely), that application
+		* code could have disposed the widget in the show
+		* event.  If this happens, just return.
+		*/
+		sendEvent (SWT.Show);
+		if (isDisposed ()) return;
+		state &= ~HIDDEN;
+		if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
+			if (enableWindow != 0) OS.gdk_window_show_unraised (enableWindow);
+			OS.gtk_widget_show (topHandle);
+		}
+	} else {
+		/*
+		* Bug in GTK.  Invoking gtk_widget_hide() on a widget that has
+		* focus causes a focus_out_event to be sent. If the client disposes
+		* the widget inside the event, GTK GP's.  The fix is to reassign focus
+		* before hiding the widget.
+		*
+		* NOTE: In order to stop the same widget from taking focus,
+		* temporarily clear and set the GTK_VISIBLE flag.
+		*/
+		Control control = null;
+		boolean fixFocus = false;
+		if (display.focusEvent != SWT.FocusOut) {
+			control = display.getFocusControl ();
+			fixFocus = isFocusAncestor (control);
+		}
+		state |= HIDDEN;
+		if (fixFocus) {
+			OS.GTK_WIDGET_UNSET_FLAGS (topHandle, OS.GTK_VISIBLE);
+			fixFocus (control);
+			if (isDisposed ()) return;
+			OS.GTK_WIDGET_SET_FLAGS (topHandle, OS.GTK_VISIBLE);
+		}
+		OS.gtk_widget_hide (topHandle);
+		if (isDisposed ()) return;
+		if (enableWindow != 0) OS.gdk_window_hide (enableWindow);
+		sendEvent (SWT.Hide);
+	}
+}
+
+void setZOrder (Control sibling, boolean above, boolean fixRelations) {
+	 setZOrder (sibling, above, fixRelations, true);
+}
+
+void setZOrder (Control sibling, boolean above, boolean fixRelations, boolean fixChildren) {
+	int index = 0, siblingIndex = 0, oldNextIndex = -1;
+	Control[] children = null;
+	if (fixRelations) {
+		/* determine the receiver's and sibling's indexes in the parent */
+		children = parent._getChildren ();
+		while (index < children.length) {
+			if (children [index] == this) break;
+			index++;
+		}
+		if (sibling != null) {
+			while (siblingIndex < children.length) {
+				if (children [siblingIndex] == sibling) break;
+				siblingIndex++;
+			}
+		}
+		/* remove "Labelled by" relationships that will no longer be valid */
+		removeRelation ();
+		if (index + 1 < children.length) {
+			oldNextIndex = index + 1;
+			children [oldNextIndex].removeRelation ();
+		}
+		if (sibling != null) {
+			if (above) {
+				sibling.removeRelation ();
+			} else {
+				if (siblingIndex + 1 < children.length) {
+					children [siblingIndex + 1].removeRelation ();
+				}
+			}
+		}
+	}
+
+	int /*long*/ topHandle = topHandle ();
+	int /*long*/ siblingHandle = sibling != null ? sibling.topHandle () : 0;
+	int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle);
+	if (window != 0) {
+		int /*long*/ siblingWindow = 0;
+		if (sibling != null) {
+			if (above && sibling.enableWindow != 0) {
+				siblingWindow = enableWindow;
+			} else {
+				siblingWindow = OS.GTK_WIDGET_WINDOW (siblingHandle);
+			}
+		}
+		int /*long*/ redrawWindow = fixChildren ? parent.redrawWindow : 0;
+		if (!OS.GDK_WINDOWING_X11 () || (siblingWindow == 0 && (!above || redrawWindow == 0))) {
+			if (above) {
+				OS.gdk_window_raise (window);
+				if (redrawWindow != 0) OS.gdk_window_raise (redrawWindow);
+				if (enableWindow != 0) OS.gdk_window_raise (enableWindow);
+			} else {
+				if (enableWindow != 0) OS.gdk_window_lower (enableWindow);
+				OS.gdk_window_lower (window);
+			}
+		} else {
+			XWindowChanges changes = new XWindowChanges ();
+			changes.sibling = OS.gdk_x11_drawable_get_xid (siblingWindow != 0 ? siblingWindow : redrawWindow);
+			changes.stack_mode = above ? OS.Above : OS.Below;
+			if (redrawWindow != 0 && siblingWindow == 0) changes.stack_mode = OS.Below;
+			int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window);
+			int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (window);
+			int xScreen = OS.XDefaultScreen (xDisplay);
+			int flags = OS.CWStackMode | OS.CWSibling;
+			/*
+			* Feature in X. If the receiver is a top level, XConfigureWindow ()
+			* will fail (with a BadMatch error) for top level shells because top
+			* level shells are reparented by the window manager and do not share
+			* the same X window parent.  This is the correct behavior but it is
+			* unexpected.  The fix is to use XReconfigureWMWindow () instead.
+			* When the receiver is not a top level shell, XReconfigureWMWindow ()
+			* behaves the same as XConfigureWindow ().
+			*/
+			OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
+			if (enableWindow != 0) {
+				changes.sibling = OS.gdk_x11_drawable_get_xid (window);
+				changes.stack_mode = OS.Above;
+				xWindow = OS.gdk_x11_drawable_get_xid (enableWindow);
+				OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
+			}
+		}
+	}
+	if (fixChildren) {
+		if (above) {
+			parent.moveAbove (topHandle, siblingHandle);
+		} else {
+			parent.moveBelow (topHandle, siblingHandle);
+		}
+	}
+	/*  Make sure that the parent internal windows are on the bottom of the stack	*/
+	if (!above && fixChildren) 	parent.fixZOrder ();
+
+	if (fixRelations) {
+		/* determine the receiver's new index in the parent */
+		if (sibling != null) {
+			if (above) {
+				index = siblingIndex - (index < siblingIndex ? 1 : 0);
+			} else {
+				index = siblingIndex + (siblingIndex < index ? 1 : 0);
+			}
+		} else {
+			if (above) {
+				index = 0;
+			} else {
+				index = children.length - 1;
+			}
+		}
+
+		/* add new "Labelled by" relations as needed */
+		children = parent._getChildren ();
+		if (0 < index) {
+			children [index - 1].addRelation (this);
+		}
+		if (index + 1 < children.length) {
+			addRelation (children [index + 1]);
+		}
+		if (oldNextIndex != -1) {
+			if (oldNextIndex <= index) oldNextIndex--;
+			/* the last two conditions below ensure that duplicate relations are not hooked */
+			if (0 < oldNextIndex && oldNextIndex != index && oldNextIndex != index + 1) {
+				children [oldNextIndex - 1].addRelation (children [oldNextIndex]);
+			}
+		}
+	}
+}
+
+void setWidgetBackground  () {
+	if (fixedHandle != 0) {
+		int /*long*/ style = OS.gtk_widget_get_modifier_style (fixedHandle);
+		OS.gtk_widget_modify_style (fixedHandle, style);
+	}
+	int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
+	OS.gtk_widget_modify_style (handle, style);
+}
+
+boolean showMenu (int x, int y) {
+	Event event = new Event ();
+	event.x = x;
+	event.y = y;
+	sendEvent (SWT.MenuDetect, event);
+	if (event.doit) {
+		if (menu != null && !menu.isDisposed ()) {
+			boolean hooksKeys = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
+			menu.createIMMenu (hooksKeys ? imHandle() : 0);
+			if (event.x != x || event.y != y) {
+				menu.setLocation (event.x, event.y);
+			}
+			menu.setVisible (true);
+			return true;
+		}
+	}
+	return false;
+}
+
+void showWidget () {
+	// Comment this line to disable zero-sized widgets
+	state |= ZERO_WIDTH | ZERO_HEIGHT;
+	int /*long*/ topHandle = topHandle ();
+	int /*long*/ parentHandle = parent.parentingHandle ();
+	parent.setParentWindow (topHandle);
+	OS.gtk_container_add (parentHandle, topHandle);
+	if (handle != 0 && handle != topHandle) OS.gtk_widget_show (handle);
+	if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
+		if (fixedHandle != 0) OS.gtk_widget_show (fixedHandle);
+	}
+	if (fixedHandle != 0) fixStyle (fixedHandle);
+}
+
+void sort (int [] items) {
+	/* Shell Sort from K&R, pg 108 */
+	int length = items.length;
+	for (int gap=length/2; gap>0; gap/=2) {
+		for (int i=gap; i<length; i++) {
+			for (int j=i-gap; j>=0; j-=gap) {
+		   		if (items [j] <= items [j + gap]) {
+					int swap = items [j];
+					items [j] = items [j + gap];
+					items [j + gap] = swap;
+		   		}
+	    	}
+	    }
+	}
+}
+
+/**
+ * Based on the argument, perform one of the expected platform
+ * traversal action. The argument should be one of the constants:
+ * <code>SWT.TRAVERSE_ESCAPE</code>, <code>SWT.TRAVERSE_RETURN</code>,
+ * <code>SWT.TRAVERSE_TAB_NEXT</code>, <code>SWT.TRAVERSE_TAB_PREVIOUS</code>,
+ * <code>SWT.TRAVERSE_ARROW_NEXT</code> and <code>SWT.TRAVERSE_ARROW_PREVIOUS</code>.
+ *
+ * @param traversal the type of traversal
+ * @return true if the traversal succeeded
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean traverse (int traversal) {
+	checkWidget ();
+	Event event = new Event ();
+	event.doit = true;
+	event.detail = traversal;
+	return traverse (event);
+}
+
+boolean translateMnemonic (Event event, Control control) {
+	if (control == this) return false;
+	if (!isVisible () || !isEnabled ()) return false;
+	event.doit = this == display.mnemonicControl || mnemonicMatch (event.character);
+	return traverse (event);
+}
+
+boolean translateMnemonic (int keyval, GdkEventKey gdkEvent) {
+	int key = OS.gdk_keyval_to_unicode (keyval);
+	if (key < 0x20) return false;
+	if (gdkEvent.state == 0) {
+		int code = traversalCode (keyval, gdkEvent);
+		if ((code & SWT.TRAVERSE_MNEMONIC) == 0) return false;
+	} else {
+		Shell shell = _getShell ();
+		int mask = OS.GDK_CONTROL_MASK | OS.GDK_SHIFT_MASK | OS.GDK_MOD1_MASK;
+		if ((gdkEvent.state & mask) != OS.gtk_window_get_mnemonic_modifier (shell.shellHandle)) return false;
+	}
+	Decorations shell = menuShell ();
+	if (shell.isVisible () && shell.isEnabled ()) {
+		Event event = new Event ();
+		event.detail = SWT.TRAVERSE_MNEMONIC;
+		if (setKeyState (event, gdkEvent)) {
+			return translateMnemonic (event, null) || shell.translateMnemonic (event, this);
+		}
+	}
+	return false;
+}
+
+boolean translateTraversal (GdkEventKey keyEvent) {
+	int detail = SWT.TRAVERSE_NONE;
+	int key = keyEvent.keyval;
+	int code = traversalCode (key, keyEvent);
+	boolean all = false;
+	switch (key) {
+		case OS.GDK_Escape: {
+			all = true;
+			detail = SWT.TRAVERSE_ESCAPE;
+			break;
+		}
+		case OS.GDK_KP_Enter:
+		case OS.GDK_Return: {
+			all = true;
+			detail = SWT.TRAVERSE_RETURN;
+			break;
+		}
+		case OS.GDK_ISO_Left_Tab:
+		case OS.GDK_Tab: {
+			boolean next = (keyEvent.state & OS.GDK_SHIFT_MASK) == 0;
+			detail = next ? SWT.TRAVERSE_TAB_NEXT : SWT.TRAVERSE_TAB_PREVIOUS;
+			break;
+		}
+		case OS.GDK_Up:
+		case OS.GDK_Left:
+		case OS.GDK_Down:
+		case OS.GDK_Right: {
+			boolean next = key == OS.GDK_Down || key == OS.GDK_Right;
+			detail = next ? SWT.TRAVERSE_ARROW_NEXT : SWT.TRAVERSE_ARROW_PREVIOUS;
+			break;
+		}
+		case OS.GDK_Page_Up:
+		case OS.GDK_Page_Down: {
+			all = true;
+			if ((keyEvent.state & OS.GDK_CONTROL_MASK) == 0) return false;
+			detail = key == OS.GDK_Page_Down ? SWT.TRAVERSE_PAGE_NEXT : SWT.TRAVERSE_PAGE_PREVIOUS;
+			break;
+		}
+		default:
+			return false;
+	}
+	Event event = new Event ();
+	event.doit = (code & detail) != 0;
+	event.detail = detail;
+	event.time = keyEvent.time;
+	if (!setKeyState (event, keyEvent)) return false;
+	Shell shell = getShell ();
+	Control control = this;
+	do {
+		if (control.traverse (event)) return true;
+		if (!event.doit && control.hooks (SWT.Traverse)) return false;
+		if (control == shell) return false;
+		control = control.parent;
+	} while (all && control != null);
+	return false;
+}
+
+int traversalCode (int key, GdkEventKey event) {
+	int code = SWT.TRAVERSE_RETURN | SWT.TRAVERSE_TAB_NEXT |  SWT.TRAVERSE_TAB_PREVIOUS | SWT.TRAVERSE_PAGE_NEXT | SWT.TRAVERSE_PAGE_PREVIOUS;
+	Shell shell = getShell ();
+	if (shell.parent != null) code |= SWT.TRAVERSE_ESCAPE;
+	return code;
+}
+
+boolean traverse (Event event) {
+	/*
+	* It is possible (but unlikely), that application
+	* code could have disposed the widget in the traverse
+	* event.  If this happens, return true to stop further
+	* event processing.
+	*/
+	sendEvent (SWT.Traverse, event);
+	if (isDisposed ()) return true;
+	if (!event.doit) return false;
+	switch (event.detail) {
+		case SWT.TRAVERSE_NONE:			return true;
+		case SWT.TRAVERSE_ESCAPE:			return traverseEscape ();
+		case SWT.TRAVERSE_RETURN:			return traverseReturn ();
+		case SWT.TRAVERSE_TAB_NEXT:		return traverseGroup (true);
+		case SWT.TRAVERSE_TAB_PREVIOUS:	return traverseGroup (false);
+		case SWT.TRAVERSE_ARROW_NEXT:		return traverseItem (true);
+		case SWT.TRAVERSE_ARROW_PREVIOUS:	return traverseItem (false);
+		case SWT.TRAVERSE_MNEMONIC:		return traverseMnemonic (event.character);
+		case SWT.TRAVERSE_PAGE_NEXT:		return traversePage (true);
+		case SWT.TRAVERSE_PAGE_PREVIOUS:	return traversePage (false);
+	}
+	return false;
+}
+
+boolean traverseEscape () {
+	return false;
+}
+
+boolean traverseGroup (boolean next) {
+	Control root = computeTabRoot ();
+	Control group = computeTabGroup ();
+	Control [] list = root.computeTabList ();
+	int length = list.length;
+	int index = 0;
+	while (index < length) {
+		if (list [index] == group) break;
+		index++;
+	}
+	/*
+	* It is possible (but unlikely), that application
+	* code could have disposed the widget in focus in
+	* or out events.  Ensure that a disposed widget is
+	* not accessed.
+	*/
+	if (index == length) return false;
+	int start = index, offset = (next) ? 1 : -1;
+	while ((index = ((index + offset + length) % length)) != start) {
+		Control control = list [index];
+		if (!control.isDisposed () && control.setTabGroupFocus (next)) {
+			return true;
+		}
+	}
+	if (group.isDisposed ()) return false;
+	return group.setTabGroupFocus (next);
+}
+
+boolean traverseItem (boolean next) {
+	Control [] children = parent._getChildren ();
+	int length = children.length;
+	int index = 0;
+	while (index < length) {
+		if (children [index] == this) break;
+		index++;
+	}
+	/*
+	* It is possible (but unlikely), that application
+	* code could have disposed the widget in focus in
+	* or out events.  Ensure that a disposed widget is
+	* not accessed.
+	*/
+	if (index == length) return false;
+	int start = index, offset = (next) ? 1 : -1;
+	while ((index = (index + offset + length) % length) != start) {
+		Control child = children [index];
+		if (!child.isDisposed () && child.isTabItem ()) {
+			if (child.setTabItemFocus (next)) return true;
+		}
+	}
+	return false;
+}
+
+boolean traverseReturn () {
+	return false;
+}
+
+boolean traversePage (boolean next) {
+	return false;
+}
+
+boolean traverseMnemonic (char key) {
+	return mnemonicHit (key);
+}
+
+/**
+ * Forces all outstanding paint requests for the widget
+ * to be processed before this method returns. If there
+ * are no outstanding paint request, this method does
+ * nothing.
+ * <p>
+ * Note: This method does not cause a redraw.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #redraw()
+ * @see #redraw(int, int, int, int, boolean)
+ * @see PaintListener
+ * @see SWT#Paint
+ */
+public void update () {
+	checkWidget ();
+	update (false, true);
+}
+
+void update (boolean all, boolean flush) {
+//	checkWidget();
+	if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return;
+	if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return;
+	int /*long*/ window = paintWindow ();
+	if (flush) display.flushExposes (window, all);
+	OS.gdk_window_process_updates (window, all);
+	OS.gdk_flush ();
+}
+
+void updateBackgroundMode () {
+	int oldState = state & PARENT_BACKGROUND;
+	checkBackground ();
+	if (oldState != (state & PARENT_BACKGROUND)) {
+		setBackground ();
+	}
+}
+
+void updateLayout (boolean all) {
+	/* Do nothing */
+}
+
+int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
+	switch ((int)/*64*/user_data) {
+		case EXPOSE_EVENT_INVERSE: {
+			if ((OS.GTK_VERSION <  OS.VERSION (2, 8, 0)) && ((state & OBSCURED) == 0)) {
+				Control control = findBackgroundControl ();
+				if (control != null && control.backgroundImage != null) {
+					GdkEventExpose gdkEvent = new GdkEventExpose ();
+					OS.memmove (gdkEvent, arg0, GdkEventExpose.sizeof);
+					int /*long*/ paintWindow = paintWindow();
+					int /*long*/ window = gdkEvent.window;
+					if (window != paintWindow) break;
+					int /*long*/ gdkGC = OS.gdk_gc_new (window);
+					OS.gdk_gc_set_clip_region (gdkGC, gdkEvent.region);
+					int[] dest_x = new int[1], dest_y = new int[1];
+					OS.gtk_widget_translate_coordinates (paintHandle (), control.paintHandle (), 0, 0, dest_x, dest_y);
+					OS.gdk_gc_set_fill (gdkGC, OS.GDK_TILED);
+					OS.gdk_gc_set_ts_origin (gdkGC, -dest_x [0], -dest_y [0]);
+					OS.gdk_gc_set_tile (gdkGC, control.backgroundImage.pixmap);
+					OS.gdk_draw_rectangle (window, gdkGC, 1, gdkEvent.area_x, gdkEvent.area_y, gdkEvent.area_width, gdkEvent.area_height);
+					OS.g_object_unref (gdkGC);
+				}
+			}
+			break;
+		}
+	}
+	return super.windowProc (handle, arg0, user_data);
+}
+}
++++/
\ No newline at end of file
--- a/dwt/widgets/Display.d	Mon Jan 07 23:29:21 2008 +0100
+++ b/dwt/widgets/Display.d	Tue Jan 08 01:23:25 2008 +0100
@@ -10,14 +10,43 @@
  *******************************************************************************/
 module dwt.widgets.Display;
 
-
-class Display {
+import dwt.SWT;
+import dwt.graphics.Color;
+import dwt.graphics.Cursor;
+import dwt.graphics.Device;
+import dwt.graphics.DeviceData;
+import dwt.graphics.Font;
+import dwt.graphics.GCData;
+import dwt.graphics.Image;
+import dwt.graphics.ImageData;
+import dwt.graphics.PaletteData;
+import dwt.graphics.Point;
+import dwt.graphics.Rectangle;
+import dwt.graphics.Resource;
+import dwt.internal.Compatibility;
+import dwt.internal.Converter;
+import dwt.internal.Lock;
+import dwt.internal.gtk.c.gdktypes;
+import dwt.internal.gtk.c.gtktypes;
+import dwt.internal.gtk.OS;
+import dwt.widgets.Caret;
+import dwt.widgets.Control;
+import dwt.widgets.Event;
+import dwt.widgets.EventTable;
+import dwt.widgets.Listener;
+import dwt.widgets.Menu;
+import dwt.widgets.Monitor;
+import dwt.widgets.Shell;
+import dwt.widgets.Synchronizer;
+import dwt.widgets.Tray;
+import dwt.widgets.Widget;
+
+class Display{
 }
-/++++
-import dwt.*;
-import dwt.internal.*;
-import dwt.internal.gtk.*;
-import dwt.graphics.*;
+
+
+/++
+
 
 /**
  * Instances of this class are responsible for managing the
@@ -94,25 +123,25 @@
  * @see #sleep
  * @see Device#dispose
  */
-public class Display extends Device {
-
-	/* Events Dispatching and Callback */
+public class Display : Device {
+
+	/* Events Dispatching and void*/*Callback*/ */
 	int gdkEventCount;
-	int /*long*/ [] gdkEvents;
+	GdkEvent* [] gdkEvents;
 	Widget [] gdkEventWidgets;
 	int [] dispatchEvents;
 	Event [] eventQueue;
 	int /*long*/ fds;
 	int allocated_nfds;
-	boolean wake;
-	int [] max_priority = new int [1], timeout = new int [1];
-	Callback eventCallback, filterCallback;
+	bool wake;
+	int max_priority, timeout;
+	void*/*Callback*/ eventCallback, filterCallback;
 	int /*long*/ eventProc, filterProc, windowProc2, windowProc3, windowProc4, windowProc5;
-	Callback windowCallback2, windowCallback3, windowCallback4, windowCallback5;
+	void*/*Callback*/ windowCallback2, windowCallback3, windowCallback4, windowCallback5;
 	EventTable eventTable, filterTable;
-	static String APP_NAME = "SWT";
-	static final String DISPATCH_EVENT_KEY = "dwt.internal.gtk.dispatchEvent";
-	static final String ADD_WIDGET_KEY = "dwt.internal.addWidget";
+	static char[] APP_NAME = "SWT";
+	static const char[] DISPATCH_EVENT_KEY = "dwt.internal.gtk.dispatchEvent";
+	static const char[] ADD_WIDGET_KEY = "dwt.internal.addWidget";
 	int /*long*/ [] closures;
 	int [] signalIds;
 	int /*long*/ shellMapProcClosure;
@@ -123,11 +152,11 @@
 	int /*long*/ lastHandle;
 	Widget lastWidget;
 	Widget [] widgetTable;
-	final static int GROW_SIZE = 1024;
-	static final int SWT_OBJECT_INDEX;
-	static final int SWT_OBJECT_INDEX1;
-	static final int SWT_OBJECT_INDEX2;
-	static {
+	const static int GROW_SIZE = 1024;
+	static const int SWT_OBJECT_INDEX;
+	static const int SWT_OBJECT_INDEX1;
+	static const int SWT_OBJECT_INDEX2;
+	static this(){
 		byte [] buffer = Converter.wcsToMbcs (null, "SWT_OBJECT_INDEX", true);
 		SWT_OBJECT_INDEX = OS.g_quark_from_string (buffer);
 		buffer = Converter.wcsToMbcs (null, "SWT_OBJECT_INDEX1", true);
@@ -140,8 +169,8 @@
 	int focusEvent;
 	Control focusControl;
 	Shell activeShell;
-	boolean activePending;
-	boolean ignoreActivate, ignoreFocus;
+	bool activePending;
+	bool ignoreActivate, ignoreFocus;
 
 	/* Input method resources */
 	Control imControl;
@@ -160,14 +189,14 @@
 	/* Timers */
 	int [] timerIds;
 	Runnable [] timerList;
-	Callback timerCallback;
+	void*/*Callback*/ timerCallback;
 	int /*long*/ timerProc;
-	Callback windowTimerCallback;
+	void*/*Callback*/ windowTimerCallback;
 	int /*long*/ windowTimerProc;
 
 	/* Caret */
 	Caret currentCaret;
-	Callback caretCallback;
+	void*/*Callback*/ caretCallback;
 	int caretId;
 	int /*long*/ caretProc;
 
@@ -177,64 +206,64 @@
 	/* Mouse hover */
 	int mouseHoverId;
 	int /*long*/ mouseHoverHandle, mouseHoverProc;
-	Callback mouseHoverCallback;
+	void*/*Callback*/ mouseHoverCallback;
 
 	/* Menu position callback */
 	int /*long*/ menuPositionProc;
-	Callback menuPositionCallback;
+	void*/*Callback*/ menuPositionCallback;
 
 	/* Tooltip size allocate callback */
 	int /*long*/ sizeAllocateProc;
-	Callback sizeAllocateCallback;
+	void*/*Callback*/ sizeAllocateCallback;
 	int /*long*/ sizeRequestProc;
-	Callback sizeRequestCallback;
+	void*/*Callback*/ sizeRequestCallback;
 
 	/* Shell map callback */
 	int /*long*/ shellMapProc;
-	Callback shellMapCallback;
+	void*/*Callback*/ shellMapCallback;
 
 	/* Idle proc callback */
 	int /*long*/ idleProc;
 	int idleHandle;
-	Callback idleCallback;
-	static final String ADD_IDLE_PROC_KEY = "dwt.internal.gtk2.addIdleProc";
-	static final String REMOVE_IDLE_PROC_KEY = "dwt.internal.gtk2.removeIdleProc";
+	void*/*Callback*/ idleCallback;
+	static const char[] ADD_IDLE_PROC_KEY = "dwt.internal.gtk2.addIdleProc";
+	static const char[] REMOVE_IDLE_PROC_KEY = "dwt.internal.gtk2.removeIdleProc";
 	Object idleLock = new Object();
-	boolean idleNeeded;
+	bool idleNeeded;
 
 	/* GtkTreeView callbacks */
 	int[] treeSelection;
 	int treeSelectionLength;
 	int /*long*/ treeSelectionProc;
-	Callback treeSelectionCallback;
+	void*/*Callback*/ treeSelectionCallback;
 	int /*long*/ cellDataProc;
-	Callback cellDataCallback;
+	void*/*Callback*/ cellDataCallback;
 
 	/* Set direction callback */
 	int /*long*/ setDirectionProc;
-	Callback setDirectionCallback;
+	void*/*Callback*/ setDirectionCallback;
 
 	/* Get all children callback */
 	int /*long*/ allChildrenProc, allChildren;
-	Callback allChildrenCallback;
+	void*/*Callback*/ allChildrenCallback;
 
 	/* Settings callbacks */
 	int /*long*/ styleSetProc;
-	Callback styleSetCallback;
+	void*/*Callback*/ styleSetCallback;
 	int /*long*/ shellHandle;
-	boolean settingsChanged, runSettings;
+	bool settingsChanged, runSettings;
 
 	/* Entry focus behaviour */
-	boolean entrySelectOnFocus;
+	bool entrySelectOnFocus;
 
 	/* Enter/Exit events */
 	Control currentControl;
 
 	/* Flush exposes */
 	int /*long*/ checkIfEventProc;
-	Callback checkIfEventCallback;
+	void*/*Callback*/ checkIfEventCallback;
 	int /*long*/ flushWindow;
-	boolean flushAll;
+	bool flushAll;
 	GdkRectangle flushRect = new GdkRectangle ();
 	XExposeEvent exposeEvent = new XExposeEvent ();
 	XVisibilityEvent visibilityEvent = new XVisibilityEvent ();
@@ -245,7 +274,7 @@
 	Image errorImage, infoImage, questionImage, warningImage;
 	Cursor [] cursors = new Cursor [SWT.CURSOR_HAND + 1];
 	Resource [] resources;
-	static final int RESOURCE_SIZE = 1 + 4 + SWT.CURSOR_HAND + 1;
+	static const int RESOURCE_SIZE = 1 + 4 + SWT.CURSOR_HAND + 1;
 
 	/* Colors */
 	GdkColor COLOR_WIDGET_DARK_SHADOW, COLOR_WIDGET_NORMAL_SHADOW, COLOR_WIDGET_LIGHT_SHADOW;
@@ -267,118 +296,118 @@
 	/* Fixed Subclass */
 	static int /*long*/ fixed_type;
 	static int /*long*/ fixed_info_ptr;
-	static Callback fixedClassInitCallback, fixedMapCallback;
+	static void*/*Callback*/ fixedClassInitCallback, fixedMapCallback;
 	static int /*long*/ fixedClassInitProc, fixedMapProc;
 
 	/* Renderer Subclass */
 	static int /*long*/ text_renderer_type, pixbuf_renderer_type, toggle_renderer_type;
 	static int /*long*/ text_renderer_info_ptr, pixbuf_renderer_info_ptr, toggle_renderer_info_ptr;
-	static Callback rendererClassInitCallback, rendererRenderCallback, rendererGetSizeCallback;
+	static void*/*Callback*/ rendererClassInitCallback, rendererRenderCallback, rendererGetSizeCallback;
 	static int /*long*/ rendererClassInitProc, rendererRenderProc, rendererGetSizeProc;
 
 	/* Key Mappings */
-	static final int [] [] KeyTable = {
+	static const int [] [] KeyTable = [
 
 		/* Keyboard and Mouse Masks */
-		{OS.GDK_Alt_L,		SWT.ALT},
-		{OS.GDK_Alt_R,		SWT.ALT},
-		{OS.GDK_Meta_L,	SWT.ALT},
-		{OS.GDK_Meta_R,	SWT.ALT},
-		{OS.GDK_Shift_L,		SWT.SHIFT},
-		{OS.GDK_Shift_R,		SWT.SHIFT},
-		{OS.GDK_Control_L,	SWT.CONTROL},
-		{OS.GDK_Control_R,	SWT.CONTROL},
-//		{OS.GDK_????,		SWT.COMMAND},
-//		{OS.GDK_????,		SWT.COMMAND},
+		[OS.GDK_Alt_L,		SWT.ALT],
+		[OS.GDK_Alt_R,		SWT.ALT],
+		[OS.GDK_Meta_L,	SWT.ALT],
+		[OS.GDK_Meta_R,	SWT.ALT],
+		[OS.GDK_Shift_L,		SWT.SHIFT],
+		[OS.GDK_Shift_R,		SWT.SHIFT],
+		[OS.GDK_Control_L,	SWT.CONTROL],
+		[OS.GDK_Control_R,	SWT.CONTROL],
+//		[OS.GDK_????,		SWT.COMMAND],
+//		[OS.GDK_????,		SWT.COMMAND],
 
 		/* Non-Numeric Keypad Keys */
-		{OS.GDK_Up,						SWT.ARROW_UP},
-		{OS.GDK_KP_Up,					SWT.ARROW_UP},
-		{OS.GDK_Down,					SWT.ARROW_DOWN},
-		{OS.GDK_KP_Down,			SWT.ARROW_DOWN},
-		{OS.GDK_Left,						SWT.ARROW_LEFT},
-		{OS.GDK_KP_Left,				SWT.ARROW_LEFT},
-		{OS.GDK_Right,					SWT.ARROW_RIGHT},
-		{OS.GDK_KP_Right,				SWT.ARROW_RIGHT},
-		{OS.GDK_Page_Up,				SWT.PAGE_UP},
-		{OS.GDK_KP_Page_Up,		SWT.PAGE_UP},
-		{OS.GDK_Page_Down,			SWT.PAGE_DOWN},
-		{OS.GDK_KP_Page_Down,	SWT.PAGE_DOWN},
-		{OS.GDK_Home,					SWT.HOME},
-		{OS.GDK_KP_Home,			SWT.HOME},
-		{OS.GDK_End,						SWT.END},
-		{OS.GDK_KP_End,				SWT.END},
-		{OS.GDK_Insert,					SWT.INSERT},
-		{OS.GDK_KP_Insert,			SWT.INSERT},
+		[OS.GDK_Up,						SWT.ARROW_UP],
+		[OS.GDK_KP_Up,					SWT.ARROW_UP],
+		[OS.GDK_Down,					SWT.ARROW_DOWN],
+		[OS.GDK_KP_Down,			SWT.ARROW_DOWN],
+		[OS.GDK_Left,						SWT.ARROW_LEFT],
+		[OS.GDK_KP_Left,				SWT.ARROW_LEFT],
+		[OS.GDK_Right,					SWT.ARROW_RIGHT],
+		[OS.GDK_KP_Right,				SWT.ARROW_RIGHT],
+		[OS.GDK_Page_Up,				SWT.PAGE_UP],
+		[OS.GDK_KP_Page_Up,		SWT.PAGE_UP],
+		[OS.GDK_Page_Down,			SWT.PAGE_DOWN],
+		[OS.GDK_KP_Page_Down,	SWT.PAGE_DOWN],
+		[OS.GDK_Home,					SWT.HOME],
+		[OS.GDK_KP_Home,			SWT.HOME],
+		[OS.GDK_End,						SWT.END],
+		[OS.GDK_KP_End,				SWT.END],
+		[OS.GDK_Insert,					SWT.INSERT],
+		[OS.GDK_KP_Insert,			SWT.INSERT],
 
 		/* Virtual and Ascii Keys */
-		{OS.GDK_BackSpace,		SWT.BS},
-		{OS.GDK_Return,				SWT.CR},
-		{OS.GDK_Delete,				SWT.DEL},
-		{OS.GDK_KP_Delete,		SWT.DEL},
-		{OS.GDK_Escape,			SWT.ESC},
-		{OS.GDK_Linefeed,			SWT.LF},
-		{OS.GDK_Tab,					SWT.TAB},
-		{OS.GDK_ISO_Left_Tab, 	SWT.TAB},
+		[OS.GDK_BackSpace,		SWT.BS],
+		[OS.GDK_Return,				SWT.CR],
+		[OS.GDK_Delete,				SWT.DEL],
+		[OS.GDK_KP_Delete,		SWT.DEL],
+		[OS.GDK_Escape,			SWT.ESC],
+		[OS.GDK_Linefeed,			SWT.LF],
+		[OS.GDK_Tab,					SWT.TAB],
+		[OS.GDK_ISO_Left_Tab, 	SWT.TAB],
 
 		/* Functions Keys */
-		{OS.GDK_F1,		SWT.F1},
-		{OS.GDK_F2,		SWT.F2},
-		{OS.GDK_F3,		SWT.F3},
-		{OS.GDK_F4,		SWT.F4},
-		{OS.GDK_F5,		SWT.F5},
-		{OS.GDK_F6,		SWT.F6},
-		{OS.GDK_F7,		SWT.F7},
-		{OS.GDK_F8,		SWT.F8},
-		{OS.GDK_F9,		SWT.F9},
-		{OS.GDK_F10,		SWT.F10},
-		{OS.GDK_F11,		SWT.F11},
-		{OS.GDK_F12,		SWT.F12},
-		{OS.GDK_F13,		SWT.F13},
-		{OS.GDK_F14,		SWT.F14},
-		{OS.GDK_F15,		SWT.F15},
+		[OS.GDK_F1,		SWT.F1],
+		[OS.GDK_F2,		SWT.F2],
+		[OS.GDK_F3,		SWT.F3],
+		[OS.GDK_F4,		SWT.F4],
+		[OS.GDK_F5,		SWT.F5],
+		[OS.GDK_F6,		SWT.F6],
+		[OS.GDK_F7,		SWT.F7],
+		[OS.GDK_F8,		SWT.F8],
+		[OS.GDK_F9,		SWT.F9],
+		[OS.GDK_F10,		SWT.F10],
+		[OS.GDK_F11,		SWT.F11],
+		[OS.GDK_F12,		SWT.F12],
+		[OS.GDK_F13,		SWT.F13],
+		[OS.GDK_F14,		SWT.F14],
+		[OS.GDK_F15,		SWT.F15],
 
 		/* Numeric Keypad Keys */
-		{OS.GDK_KP_Multiply,		SWT.KEYPAD_MULTIPLY},
-		{OS.GDK_KP_Add,			SWT.KEYPAD_ADD},
-		{OS.GDK_KP_Enter,			SWT.KEYPAD_CR},
-		{OS.GDK_KP_Subtract,	SWT.KEYPAD_SUBTRACT},
-		{OS.GDK_KP_Decimal,	SWT.KEYPAD_DECIMAL},
-		{OS.GDK_KP_Divide,		SWT.KEYPAD_DIVIDE},
-		{OS.GDK_KP_0,			SWT.KEYPAD_0},
-		{OS.GDK_KP_1,			SWT.KEYPAD_1},
-		{OS.GDK_KP_2,			SWT.KEYPAD_2},
-		{OS.GDK_KP_3,			SWT.KEYPAD_3},
-		{OS.GDK_KP_4,			SWT.KEYPAD_4},
-		{OS.GDK_KP_5,			SWT.KEYPAD_5},
-		{OS.GDK_KP_6,			SWT.KEYPAD_6},
-		{OS.GDK_KP_7,			SWT.KEYPAD_7},
-		{OS.GDK_KP_8,			SWT.KEYPAD_8},
-		{OS.GDK_KP_9,			SWT.KEYPAD_9},
-		{OS.GDK_KP_Equal,	SWT.KEYPAD_EQUAL},
+		[OS.GDK_KP_Multiply,		SWT.KEYPAD_MULTIPLY],
+		[OS.GDK_KP_Add,			SWT.KEYPAD_ADD],
+		[OS.GDK_KP_Enter,			SWT.KEYPAD_CR],
+		[OS.GDK_KP_Subtract,	SWT.KEYPAD_SUBTRACT],
+		[OS.GDK_KP_Decimal,	SWT.KEYPAD_DECIMAL],
+		[OS.GDK_KP_Divide,		SWT.KEYPAD_DIVIDE],
+		[OS.GDK_KP_0,			SWT.KEYPAD_0],
+		[OS.GDK_KP_1,			SWT.KEYPAD_1],
+		[OS.GDK_KP_2,			SWT.KEYPAD_2],
+		[OS.GDK_KP_3,			SWT.KEYPAD_3],
+		[OS.GDK_KP_4,			SWT.KEYPAD_4],
+		[OS.GDK_KP_5,			SWT.KEYPAD_5],
+		[OS.GDK_KP_6,			SWT.KEYPAD_6],
+		[OS.GDK_KP_7,			SWT.KEYPAD_7],
+		[OS.GDK_KP_8,			SWT.KEYPAD_8],
+		[OS.GDK_KP_9,			SWT.KEYPAD_9],
+		[OS.GDK_KP_Equal,	SWT.KEYPAD_EQUAL],
 
 		/* Other keys */
-		{OS.GDK_Caps_Lock,		SWT.CAPS_LOCK},
-		{OS.GDK_Num_Lock,		SWT.NUM_LOCK},
-		{OS.GDK_Scroll_Lock,		SWT.SCROLL_LOCK},
-		{OS.GDK_Pause,				SWT.PAUSE},
-		{OS.GDK_Break,				SWT.BREAK},
-		{OS.GDK_Print,					SWT.PRINT_SCREEN},
-		{OS.GDK_Help,					SWT.HELP},
-
-	};
+		[OS.GDK_Caps_Lock,		SWT.CAPS_LOCK],
+		[OS.GDK_Num_Lock,		SWT.NUM_LOCK],
+		[OS.GDK_Scroll_Lock,		SWT.SCROLL_LOCK],
+		[OS.GDK_Pause,				SWT.PAUSE],
+		[OS.GDK_Break,				SWT.BREAK],
+		[OS.GDK_Print,					SWT.PRINT_SCREEN],
+		[OS.GDK_Help,					SWT.HELP],
+
+	];
 
 	/* Multiple Displays. */
 	static Display Default;
-	static Display [] Displays = new Display [4];
+	static Display [] Displays;
 
 	/* Package name */
-	static final String PACKAGE_PREFIX = "dwt.widgets.";
+	static const char[] PACKAGE_PREFIX = "dwt.widgets.";
 	/* This code is intentionally commented.
 	 * ".class" can not be used on CLDC.
 	 */
 //	static {
-//		String name = Display.class.getName ();
+//		char[] name = Display.class.getName ();
 //		int index = name.lastIndexOf ('.');
 //		PACKAGE_NAME = name.substring (0, index + 1);
 //	}
@@ -388,24 +417,26 @@
 	* it does not compile on some Java compilers when they are
 	* targeted for CLDC.  Use Class.forName() instead.
 	*/
-	static final Class OS_LOCK;
-	static {
+	static const Class OS_LOCK;
+	static this(){
 		Class lock = null;
 		try {
 			lock = Class.forName ("dwt.internal.gtk.OS");
 		} catch (Throwable th) {
 		}
 		OS_LOCK = lock;
+        Displays = new Display [4];
+        initDeviceFinder();
 	}
 
 	/* GTK Version */
-	static final int MAJOR = 2;
-	static final int MINOR = 0;
-	static final int MICRO = 6;
+	static const int MAJOR = 2;
+	static const int MINOR = 0;
+	static const int MICRO = 6;
 
 	/* Display Data */
 	Object data;
-	String [] keys;
+	char[] [] keys;
 	Object [] values;
 
 	/* Initial Guesses for Shell Trimmings. */
@@ -414,21 +445,21 @@
 	int titleBorderTrimWidth = 5, titleBorderTrimHeight = 28;
 	int titleResizeTrimWidth = 6, titleResizeTrimHeight = 29;
 	int titleTrimWidth = 0, titleTrimHeight = 23;
-	boolean ignoreTrim;
+	bool ignoreTrim;
 
 	/* Window Manager */
-	String windowManager;
+	char[] windowManager;
 
 	/*
 	* TEMPORARY CODE.  Install the runnable that
 	* gets the current display. This code will
 	* be removed in the future.
 	*/
-	static {
-		DeviceFinder = new Runnable () {
+	private static void initDeviceFinder(){
+		DeviceFinder = new class() Runnable {
 			public void run () {
 				Device device = getCurrent ();
-				if (device == null) {
+				if (device is null) {
 					device = getDefault ();
 				}
 				setDevice (device);
@@ -462,7 +493,7 @@
  * @see Widget#checkSubclass
  * @see Shell
  */
-public Display () {
+public this () {
 	this (null);
 }
 
@@ -471,7 +502,7 @@
  *
  * @param data the device data
  */
-public Display (DeviceData data) {
+public this (DeviceData data) {
 	super (data);
 }
 
@@ -513,19 +544,19 @@
  */
 public void addFilter (int eventType, Listener listener) {
 	checkDevice ();
-	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
-	if (filterTable == null) filterTable = new EventTable ();
+	if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (filterTable is null) filterTable = new EventTable ();
 	filterTable.hook (eventType, listener);
 }
 
 void addGdkEvent (int /*long*/ event) {
-	if (gdkEvents == null) {
+	if (gdkEvents is null) {
 		int length = GROW_SIZE;
 		gdkEvents = new int /*long*/ [length];
 		gdkEventWidgets = new Widget [length];
 		gdkEventCount = 0;
 	}
-	if (gdkEventCount == gdkEvents.length) {
+	if (gdkEventCount is gdkEvents.length) {
 		int length = gdkEventCount + GROW_SIZE;
 		int /*long*/ [] newEvents = new int /*long*/ [length];
 		System.arraycopy (gdkEvents, 0, newEvents, 0, gdkEventCount);
@@ -536,10 +567,10 @@
 	}
 	Widget widget = null;
 	int /*long*/ handle = OS.gtk_get_event_widget (event);
-	if (handle != 0) {
+	if (handle !is null) {
 		do {
 			widget = getWidget (handle);
-		} while (widget == null && (handle = OS.gtk_widget_get_parent (handle)) != 0);
+		} while (widget is null && (handle = OS.gtk_widget_get_parent (handle)) !is null);
 	}
 	gdkEvents [gdkEventCount] = event;
 	gdkEventWidgets [gdkEventCount] = widget;
@@ -549,7 +580,7 @@
 void addIdleProc() {
 	synchronized (idleLock){
 		this.idleNeeded = true;
-		if (idleHandle == 0) {
+		if (idleHandle is null) {
 			idleHandle = OS.g_idle_add (idleProc, 0);
 		}
 	}
@@ -581,37 +612,37 @@
  */
 public void addListener (int eventType, Listener listener) {
 	checkDevice ();
-	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
-	if (eventTable == null) eventTable = new EventTable ();
+	if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable is null) eventTable = new EventTable ();
 	eventTable.hook (eventType, listener);
 }
 
 int /*long*/ allChildrenProc (int /*long*/ widget, int /*long*/ recurse) {
 	allChildren = OS.g_list_append (allChildren, widget);
-	if (recurse != 0 && OS.GTK_IS_CONTAINER (widget)) {
+	if (recurse !is null && OS.GTK_IS_CONTAINER (widget)) {
 		OS.gtk_container_forall (widget, allChildrenProc, recurse);
 	}
 	return 0;
 }
 
 void addMouseHoverTimeout (int /*long*/ handle) {
-	if (mouseHoverId != 0) OS.gtk_timeout_remove (mouseHoverId);
+	if (mouseHoverId !is null) OS.gtk_timeout_remove (mouseHoverId);
 	mouseHoverId = OS.gtk_timeout_add (400, mouseHoverProc, handle);
 	mouseHoverHandle = handle;
 }
 
 void addPopup (Menu menu) {
-	if (popups == null) popups = new Menu [4];
+	if (popups is null) popups = new Menu [4];
 	int length = popups.length;
 	for (int i=0; i<length; i++) {
-		if (popups [i] == menu) return;
+		if (popups [i] is menu) return;
 	}
 	int index = 0;
 	while (index < length) {
-		if (popups [index] == null) break;
+		if (popups [index] is null) break;
 		index++;
 	}
-	if (index == length) {
+	if (index is length) {
 		Menu [] newPopups = new Menu [length + 4];
 		System.arraycopy (popups, 0, newPopups, 0, length);
 		popups = newPopups;
@@ -620,8 +651,8 @@
 }
 
 void addWidget (int /*long*/ handle, Widget widget) {
-	if (handle == 0) return;
-	if (freeSlot == -1) {
+	if (handle is null) return;
+	if (freeSlot is -1) {
 		int length = (freeSlot = indexTable.length) + GROW_SIZE;
 		int[] newIndexTable = new int[length];
 		Widget[] newWidgetTable = new Widget [length];
@@ -667,7 +698,7 @@
 public void asyncExec (Runnable runnable) {
 	if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
 	synchronized (idleLock) {
-		if (idleNeeded && idleHandle == 0) {
+		if (idleNeeded && idleHandle is null) {
  			//NOTE: calling unlocked function in OS
 			idleHandle = OS._g_idle_add (idleProc, 0);
 		}
@@ -697,21 +728,21 @@
 
 int /*long*/ cellDataProc (int /*long*/ tree_column, int /*long*/ cell, int /*long*/ tree_model, int /*long*/ iter, int /*long*/ data) {
 	Widget widget = getWidget (data);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.cellDataProc (tree_column, cell, tree_model, iter, data);
 }
 
 protected void checkDevice () {
-	if (thread == null) error (SWT.ERROR_WIDGET_DISPOSED);
-	if (thread != Thread.currentThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+	if (thread is null) error (SWT.ERROR_WIDGET_DISPOSED);
+	if (thread !is Thread.currentThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
 	if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
 }
 
-static synchronized void checkDisplay (Thread thread, boolean multiple) {
+static synchronized void checkDisplay (Thread thread, bool multiple) {
 	for (int i=0; i<Displays.length; i++) {
-		if (Displays [i] != null) {
+		if (Displays [i] !is null) {
 			if (!multiple) SWT.error (SWT.ERROR_NOT_IMPLEMENTED, null, " [multiple displays]");
-			if (Displays [i].thread == thread) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
+			if (Displays [i].thread is thread) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
 		}
 	}
 }
@@ -727,16 +758,16 @@
 			return 0;
 	}
 	int /*long*/ window = OS.gdk_window_lookup (OS.X_EVENT_WINDOW (xEvent));
-	if (window == 0) return 0;
-	if (flushWindow != 0) {
+	if (window is null) return 0;
+	if (flushWindow !is null) {
 		if (flushAll) {
 			int /*long*/ tempWindow = window;
 			do {
-				if (tempWindow == flushWindow) break;
-			} while ((tempWindow = OS.gdk_window_get_parent (tempWindow)) != 0);
-			if (tempWindow != flushWindow) return 0;
+				if (tempWindow is flushWindow) break;
+			} while ((tempWindow = OS.gdk_window_get_parent (tempWindow)) !is null);
+			if (tempWindow !is flushWindow) return 0;
 		} else {
-			if (window != flushWindow) return 0;
+			if (window !is flushWindow) return 0;
 		}
 	}
 	OS.memmove (exposeEvent, xEvent, XExposeEvent.sizeof);
@@ -756,11 +787,11 @@
 			OS.memmove (visibilityEvent, xEvent, XVisibilityEvent.sizeof);
 			OS.gdk_window_get_user_data (window, flushData);
 			int /*long*/ handle = flushData [0];
-			Widget widget = handle != 0 ? getWidget (handle) : null;
-			if (widget != null && widget instanceof Control) {
+			Widget widget = handle !is null ? getWidget (handle) : null;
+			if (widget !is null && (null !is cast(Control)widget)) {
 				Control control = (Control) widget;
-				if (window == control.paintWindow ()) {
-					if (visibilityEvent.state == OS.VisibilityFullyObscured) {
+				if (window is control.paintWindow ()) {
+					if (visibilityEvent.state is OS.VisibilityFullyObscured) {
 						control.state |= Widget.OBSCURED;
 					} else {
 						control.state &= ~Widget.OBSCURED;
@@ -826,7 +857,7 @@
 	checkDisplay(thread = Thread.currentThread (), false);
 	createDisplay (data);
 	register ();
-	if (Default == null) Default = this;
+	if (Default is null) Default = this;
 }
 
 synchronized void createDisplay (DeviceData data) {
@@ -840,7 +871,7 @@
 	}
 	if (OS.GDK_WINDOWING_X11 ()) xDisplay = OS.GDK_DISPLAY ();
 	int /*long*/ ptr = OS.gtk_check_version (MAJOR, MINOR, MICRO);
-	if (ptr != 0) {
+	if (ptr !is null) {
 		int length = OS.strlen (ptr);
 		byte [] buffer = new byte [length];
 		OS.memmove (buffer, ptr, length);
@@ -849,62 +880,62 @@
 		int major = OS.gtk_major_version (), minor = OS.gtk_minor_version (), micro = OS.gtk_micro_version ();
 		System.out.println ("***WARNING: Detected: " + major + "." + minor + "." + micro);
 	}
-	if (fixed_type == 0) {
+	if (fixed_type is null) {
 		byte [] type_name = Converter.wcsToMbcs (null, "SwtFixed", true);
-		fixedClassInitCallback = new Callback (getClass (), "fixedClassInitProc", 2);
+		fixedClassInitCallback = new void*/*Callback*/ (getClass (), "fixedClassInitProc", 2);
 		fixedClassInitProc = fixedClassInitCallback.getAddress ();
-		if (fixedClassInitProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-		fixedMapCallback = new Callback (getClass (), "fixedMapProc", 1);
+		if (fixedClassInitProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+		fixedMapCallback = new void*/*Callback*/ (getClass (), "fixedMapProc", 1);
 		fixedMapProc = fixedMapCallback.getAddress ();
-		if (fixedMapProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+		if (fixedMapProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
 		GTypeInfo fixed_info = new GTypeInfo ();
-		fixed_info.class_size = (short) OS.GtkFixedClass_sizeof ();
+		fixed_info.class_size = cast(short) OS.GtkFixedClass_sizeof ();
 		fixed_info.class_init = fixedClassInitProc;
-		fixed_info.instance_size = (short) OS.GtkFixed_sizeof ();
+		fixed_info.instance_size = cast(short) OS.GtkFixed_sizeof ();
 		fixed_info_ptr = OS.g_malloc (GTypeInfo.sizeof);
 		OS.memmove (fixed_info_ptr, fixed_info, GTypeInfo.sizeof);
 		fixed_type = OS.g_type_register_static (OS.GTK_TYPE_FIXED (), type_name, fixed_info_ptr, 0);
 	}
-	if (rendererClassInitProc == 0) {
-		rendererClassInitCallback = new Callback (getClass (), "rendererClassInitProc", 2);
+	if (rendererClassInitProc is null) {
+		rendererClassInitCallback = new void*/*Callback*/ (getClass (), "rendererClassInitProc", 2);
 		rendererClassInitProc = rendererClassInitCallback.getAddress ();
-		if (rendererClassInitProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+		if (rendererClassInitProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
 	}
-	if (rendererRenderProc == 0) {
-		rendererRenderCallback = new Callback (getClass (), "rendererRenderProc", 7);
+	if (rendererRenderProc is null) {
+		rendererRenderCallback = new void*/*Callback*/ (getClass (), "rendererRenderProc", 7);
 		rendererRenderProc = rendererRenderCallback.getAddress ();
-		if (rendererRenderProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+		if (rendererRenderProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
 	}
-	if (rendererGetSizeProc == 0) {
-		rendererGetSizeCallback = new Callback (getClass (), "rendererGetSizeProc", 7);
+	if (rendererGetSizeProc is null) {
+		rendererGetSizeCallback = new void*/*Callback*/ (getClass (), "rendererGetSizeProc", 7);
 		rendererGetSizeProc = rendererGetSizeCallback.getAddress ();
-		if (rendererGetSizeProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+		if (rendererGetSizeProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
 	}
-	if (text_renderer_type == 0) {
+	if (text_renderer_type is null) {
 		GTypeInfo renderer_info = new GTypeInfo ();
-		renderer_info.class_size = (short) OS.GtkCellRendererTextClass_sizeof ();
+		renderer_info.class_size = cast(short) OS.GtkCellRendererTextClass_sizeof ();
 		renderer_info.class_init = rendererClassInitProc;
-		renderer_info.instance_size = (short) OS.GtkCellRendererText_sizeof ();
+		renderer_info.instance_size = cast(short) OS.GtkCellRendererText_sizeof ();
 		text_renderer_info_ptr = OS.g_malloc (GTypeInfo.sizeof);
 		OS.memmove (text_renderer_info_ptr, renderer_info, GTypeInfo.sizeof);
 		byte [] type_name = Converter.wcsToMbcs (null, "SwtTextRenderer", true);
 		text_renderer_type = OS.g_type_register_static (OS.GTK_TYPE_CELL_RENDERER_TEXT (), type_name, text_renderer_info_ptr, 0);
 	}
-	if (pixbuf_renderer_type == 0) {
+	if (pixbuf_renderer_type is null) {
 		GTypeInfo renderer_info = new GTypeInfo ();
-		renderer_info.class_size = (short) OS.GtkCellRendererPixbufClass_sizeof ();
+		renderer_info.class_size = cast(short) OS.GtkCellRendererPixbufClass_sizeof ();
 		renderer_info.class_init = rendererClassInitProc;
-		renderer_info.instance_size = (short) OS.GtkCellRendererPixbuf_sizeof ();
+		renderer_info.instance_size = cast(short) OS.GtkCellRendererPixbuf_sizeof ();
 		pixbuf_renderer_info_ptr = OS.g_malloc (GTypeInfo.sizeof);
 		OS.memmove (pixbuf_renderer_info_ptr, renderer_info, GTypeInfo.sizeof);
 		byte [] type_name = Converter.wcsToMbcs (null, "SwtPixbufRenderer", true);
 		pixbuf_renderer_type = OS.g_type_register_static (OS.GTK_TYPE_CELL_RENDERER_PIXBUF (), type_name, pixbuf_renderer_info_ptr, 0);
 	}
-	if (toggle_renderer_type == 0) {
+	if (toggle_renderer_type is null) {
 		GTypeInfo renderer_info = new GTypeInfo ();
-		renderer_info.class_size = (short) OS.GtkCellRendererToggleClass_sizeof ();
+		renderer_info.class_size = cast(short) OS.GtkCellRendererToggleClass_sizeof ();
 		renderer_info.class_init = rendererClassInitProc;
-		renderer_info.instance_size = (short) OS.GtkCellRendererToggle_sizeof ();
+		renderer_info.instance_size = cast(short) OS.GtkCellRendererToggle_sizeof ();
 		toggle_renderer_info_ptr = OS.g_malloc (GTypeInfo.sizeof);
 		OS.memmove (toggle_renderer_info_ptr, renderer_info, GTypeInfo.sizeof);
 		byte [] type_name = Converter.wcsToMbcs (null, "SwtToggleRenderer", true);
@@ -921,31 +952,31 @@
 
 	/* Initialize the hidden shell */
 	shellHandle = OS.gtk_window_new (OS.GTK_WINDOW_TOPLEVEL);
-	if (shellHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+	if (shellHandle is null) SWT.error (SWT.ERROR_NO_HANDLES);
 	OS.gtk_widget_realize (shellHandle);
 
 	/* Initialize the filter and event callback */
-	eventCallback = new Callback (this, "eventProc", 2);
+	eventCallback = new void*/*Callback*/ (this, "eventProc", 2);
 	eventProc = eventCallback.getAddress ();
-	if (eventProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+	if (eventProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
 	OS.gdk_event_handler_set (eventProc, 0, 0);
-	filterCallback = new Callback (this, "filterProc", 3);
+	filterCallback = new void*/*Callback*/ (this, "filterProc", 3);
 	filterProc = filterCallback.getAddress ();
-	if (filterProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
+	if (filterProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
 	OS.gdk_window_add_filter  (0, filterProc, 0);
 }
 
-Image createImage (String name) {
+Image createImage (char[] name) {
 	int /*long*/ style = OS.gtk_widget_get_default_style ();
 	byte[] buffer = Converter.wcsToMbcs (null, name, true);
 	int /*long*/ pixbuf = OS.gtk_icon_set_render_icon (
 		OS.gtk_icon_factory_lookup_default (buffer), style,
 		OS.GTK_TEXT_DIR_NONE, OS.GTK_STATE_NORMAL, OS.GTK_ICON_SIZE_DIALOG, 0, 0);
-	if (pixbuf == 0) return null;
+	if (pixbuf is null) return null;
 	int width = OS.gdk_pixbuf_get_width (pixbuf);
 	int height = OS.gdk_pixbuf_get_height (pixbuf);
 	int stride = OS.gdk_pixbuf_get_rowstride (pixbuf);
-	boolean hasAlpha = OS.gdk_pixbuf_get_has_alpha (pixbuf);
+	bool hasAlpha = OS.gdk_pixbuf_get_has_alpha (pixbuf);
 	int /*long*/ pixels = OS.gdk_pixbuf_get_pixels (pixbuf);
 	byte [] data = new byte [stride * height];
 	OS.memmove (data, pixels, data.length);
@@ -976,13 +1007,13 @@
  	OS.gdk_drawable_get_size (image.pixmap, w, h);
 	int /*long*/ colormap = OS.gdk_colormap_get_system ();
 	int /*long*/ pixbuf;
-	boolean hasMask = image.mask != 0 && OS.gdk_drawable_get_depth (image.mask) == 1;
+	bool hasMask = image.mask !is null && OS.gdk_drawable_get_depth (image.mask) is 1;
 	if (hasMask) {
 		pixbuf = OS.gdk_pixbuf_new (OS.GDK_COLORSPACE_RGB, true, 8, w [0], h [0]);
-		if (pixbuf == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+		if (pixbuf is null) SWT.error (SWT.ERROR_NO_HANDLES);
 		OS.gdk_pixbuf_get_from_drawable (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w [0], h [0]);
 		int /*long*/ maskPixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, w [0], h [0]);
-		if (maskPixbuf == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+		if (maskPixbuf is null) SWT.error (SWT.ERROR_NO_HANDLES);
 		OS.gdk_pixbuf_get_from_drawable(maskPixbuf, image.mask, 0, 0, 0, 0, 0, w [0], h [0]);
 		int stride = OS.gdk_pixbuf_get_rowstride(pixbuf);
 		int /*long*/ pixels = OS.gdk_pixbuf_get_pixels(pixbuf);
@@ -996,7 +1027,7 @@
 			int /*long*/ maskOffset = maskPixels + (y * maskStride);
 			OS.memmove(maskLine, maskOffset, maskStride);
 			for (int x=0; x<w[0]; x++) {
-				if (maskLine[x * 3] == 0) {
+				if (maskLine[x * 3] is 0) {
 					line[x * 4 + 3] = 0;
 				}
 			}
@@ -1005,9 +1036,9 @@
 		OS.g_object_unref(maskPixbuf);
 	} else {
 		ImageData data = image.getImageData ();
-		boolean hasAlpha = data.getTransparencyType () == SWT.TRANSPARENCY_ALPHA;
+		bool hasAlpha = data.getTransparencyType () is SWT.TRANSPARENCY_ALPHA;
 		pixbuf = OS.gdk_pixbuf_new (OS.GDK_COLORSPACE_RGB, hasAlpha, 8, w [0], h [0]);
-		if (pixbuf == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+		if (pixbuf is null) SWT.error (SWT.ERROR_NO_HANDLES);
 		OS.gdk_pixbuf_get_from_drawable (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w [0], h [0]);
 		if (hasAlpha) {
 			byte [] alpha = data.alphaData;
@@ -1029,7 +1060,7 @@
 
 synchronized void deregister () {
 	for (int i=0; i<Displays.length; i++) {
-		if (this == Displays [i]) Displays [i] = null;
+		if (this is Displays [i]) Displays [i] = null;
 	}
 }
 
@@ -1044,7 +1075,7 @@
  * @see #release
  */
 protected void destroy () {
-	if (this == Default) Default = null;
+	if (this is Default) Default = null;
 	deregister ();
 	destroyDisplay ();
 }
@@ -1065,7 +1096,7 @@
 public static synchronized Display findDisplay (Thread thread) {
 	for (int i=0; i<Displays.length; i++) {
 		Display display = Displays [i];
-		if (display != null && display.thread == thread) {
+		if (display !is null && display.thread is thread) {
 			return display;
 		}
 	}
@@ -1087,9 +1118,9 @@
  */
 public void disposeExec (Runnable runnable) {
 	checkDevice ();
-	if (disposeList == null) disposeList = new Runnable [4];
+	if (disposeList is null) disposeList = new Runnable [4];
 	for (int i=0; i<disposeList.length; i++) {
-		if (disposeList [i] == null) {
+		if (disposeList [i] is null) {
 			disposeList [i] = runnable;
 			return;
 		}
@@ -1122,7 +1153,7 @@
 	* return zero.
 	*/
 	int time = OS.gdk_event_get_time (event);
-	if (time != 0) lastEventTime = time;
+	if (time !is 0) lastEventTime = time;
 
 	int eventType = OS.GDK_EVENT_TYPE (event);
 	switch (eventType) {
@@ -1130,11 +1161,11 @@
 		case OS.GDK_KEY_PRESS:
 			lastUserEventTime = time;
 	}
-	boolean dispatch = true;
-	if (dispatchEvents != null) {
+	bool dispatch = true;
+	if (dispatchEvents !is null) {
 		dispatch = false;
 		for (int i = 0; i < dispatchEvents.length; i++) {
-			if (eventType == dispatchEvents [i]) {
+			if (eventType is dispatchEvents [i]) {
 				dispatch = true;
 				break;
 			}
@@ -1159,7 +1190,7 @@
 	Shell shell = null;
 	Control control = null;
 	int /*long*/ grabHandle = OS.gtk_grab_get_current ();
-	if (grabHandle != 0 && OS.GTK_IS_WINDOW (grabHandle) && OS.gtk_window_get_modal (grabHandle)) {
+	if (grabHandle !is null && OS.GTK_IS_WINDOW (grabHandle) && OS.gtk_window_get_modal (grabHandle)) {
 		switch (eventType) {
 			case OS.GDK_KEY_PRESS:
 			case OS.GDK_KEY_RELEASE:
@@ -1175,27 +1206,27 @@
 				do {
 					OS.gdk_window_get_user_data (window, user_data);
 					int /*long*/ handle = user_data [0];
-					if (handle != 0) {
+					if (handle !is null) {
 						Widget widget = getWidget (handle);
-						if (widget != null && widget instanceof Control) {
+						if (widget !is null && (null !is cast(Control)widget)) {
 							control = (Control) widget;
 							break;
 						}
 					}
-				} while ((window = OS.gdk_window_get_parent (window)) != 0);
+				} while ((window = OS.gdk_window_get_parent (window)) !is null);
 			}
 		}
-		if (control != null) {
+		if (control !is null) {
 			shell = control.getShell ();
-			if ((shell.style & SWT.ON_TOP) != 0) {
+			if ((shell.style & SWT.ON_TOP) !is 0) {
 				OS.gtk_grab_add (shell.shellHandle);
 			}
 		}
 	}
 	OS.gtk_main_do_event (event);
-	if (dispatchEvents == null) putGdkEvents ();
-	if (control != null) {
-		if (shell != null && !shell.isDisposed () && (shell.style & SWT.ON_TOP) != 0) {
+	if (dispatchEvents is null) putGdkEvents ();
+	if (control !is null) {
+		if (shell !is null && !shell.isDisposed () && (shell.style & SWT.ON_TOP) !is 0) {
 			OS.gtk_grab_remove (shell.shellHandle);
 		}
 	}
@@ -1285,7 +1316,7 @@
 static int /*long*/ fixedMapProc (int /*long*/ handle) {
 	Display display = getCurrent ();
 	Widget widget = display.getWidget (handle);
-	if (widget != null) return widget.fixedMapProc (handle);
+	if (widget !is null) return widget.fixedMapProc (handle);
 	return 0;
 }
 
@@ -1301,18 +1332,18 @@
 static int /*long*/ rendererGetSizeProc (int /*long*/ cell, int /*long*/ handle, int /*long*/ cell_area, int /*long*/ x_offset, int /*long*/ y_offset, int /*long*/ width, int /*long*/ height) {
 	Display display = getCurrent ();
 	Widget widget = display.getWidget (handle);
-	if (widget != null) return widget.rendererGetSizeProc (cell, handle, cell_area, x_offset, y_offset, width, height);
+	if (widget !is null) return widget.rendererGetSizeProc (cell, handle, cell_area, x_offset, y_offset, width, height);
 	return 0;
 }
 
 static int /*long*/ rendererRenderProc (int /*long*/ cell, int /*long*/ window, int /*long*/ handle, int /*long*/ background_area, int /*long*/ cell_area, int /*long*/ expose_area, int /*long*/ flags) {
 	Display display = getCurrent ();
 	Widget widget = display.getWidget (handle);
-	if (widget != null) return widget.rendererRenderProc (cell, window, handle, background_area, cell_area, expose_area, flags);
+	if (widget !is null) return widget.rendererRenderProc (cell, window, handle, background_area, cell_area, expose_area, flags);
 	return 0;
 }
 
-void flushExposes (int /*long*/ window, boolean all) {
+void flushExposes (int /*long*/ window, bool all) {
 	OS.gdk_flush ();
 	OS.gdk_flush ();
 	if (OS.GDK_WINDOWING_X11 ()) {
@@ -1369,7 +1400,7 @@
 	Thread current = Thread.currentThread ();
 	for (int i=0; i<Displays.length; i++) {
 		Display display = Displays [i];
-		if (display != null && display.thread == current) return display;
+		if (display !is null && display.thread is current) return display;
 	}
 	return null;
 }
@@ -1377,12 +1408,12 @@
 int getCaretBlinkTime () {
 //	checkDevice ();
 	int /*long*/ settings = OS.gtk_settings_get_default ();
-	if (settings == 0) return 500;
+	if (settings is null) return 500;
 	int [] buffer = new int [1];
 	OS.g_object_get (settings, OS.gtk_cursor_blink, buffer, 0);
-	if (buffer [0] == 0) return 0;
+	if (buffer [0] is 0) return 0;
 	OS.g_object_get (settings, OS.gtk_cursor_blink_time, buffer, 0);
-	if (buffer [0] == 0) return 500;
+	if (buffer [0] is 0) return 500;
 	/*
 	* By experimentation, GTK application don't use the whole
 	* blink cycle time.  Instead, they divide up the time, using
@@ -1407,33 +1438,33 @@
 	checkDevice();
 	int[] x = new int[1], y = new int[1];
 	int /*long*/ window = OS.gdk_window_at_pointer (x,y);
-	if (window == 0) return null;
+	if (window is null) return null;
 	int /*long*/ [] user_data = new int /*long*/ [1];
 	OS.gdk_window_get_user_data (window, user_data);
 	int /*long*/ handle = user_data [0];
-	if (handle == 0) return null;
+	if (handle is null) return null;
 	do {
 		Widget widget = getWidget (handle);
-		if (widget != null && widget instanceof Control) {
+		if (widget !is null && (null !is cast(Control)widget)) {
 			Control control = (Control) widget;
 			if (control.isEnabled ()) return control;
 		}
-	} while ((handle = OS.gtk_widget_get_parent (handle)) != 0);
+	} while ((handle = OS.gtk_widget_get_parent (handle)) !is null);
 	return null;
 }
 
-boolean filterEvent (Event event) {
-	if (filterTable != null) filterTable.sendEvent (event);
+bool filterEvent (Event event) {
+	if (filterTable !is null) filterTable.sendEvent (event);
 	return false;
 }
 
-boolean filters (int eventType) {
-	if (filterTable == null) return false;
+bool filters (int eventType) {
+	if (filterTable is null) return false;
 	return filterTable.hooks (eventType);
 }
 
 int /*long*/ filterProc (int /*long*/ xEvent, int /*long*/ gdkEvent, int /*long*/ data) {
-	if (data == 0) {
+	if (data is null) {
 		/*
 		* Feature in GTK.  When button 4, 5, 6, or 7 is released, GTK
 		* does not deliver a corresponding GTK event.  Button 6 and 7
@@ -1444,7 +1475,7 @@
 		*/
 		XButtonEvent mouseEvent = new XButtonEvent ();
 		OS.memmove (mouseEvent, xEvent, 4);
-		if (mouseEvent.type == OS.ButtonRelease) {
+		if (mouseEvent.type is OS.ButtonRelease) {
 			OS.memmove (mouseEvent, xEvent, XButtonEvent.sizeof);
 			switch (mouseEvent.button) {
 				case 6:
@@ -1456,7 +1487,7 @@
 		}
 	}
 	Widget widget = getWidget (data);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.filterProc (xEvent, gdkEvent, data);
 }
 
@@ -1520,15 +1551,15 @@
  * @see #setData(String, Object)
  * @see #disposeExec(Runnable)
  */
-public Object getData (String key) {
+public Object getData (char[] key) {
 	checkDevice ();
-	if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-	if (key.equals (DISPATCH_EVENT_KEY)) {
+	if (key is null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (key ==/*eq*/ DISPATCH_EVENT_KEY) {
 		return dispatchEvents;
 	}
-	if (keys == null) return null;
+	if (keys is null) return null;
 	for (int i=0; i<keys.length; i++) {
-		if (keys [i].equals (key)) return values [i];
+		if (keys [i] ==/*eq*/ key) return values [i];
 	}
 	return null;
 }
@@ -1604,14 +1635,14 @@
  * @return the default display
  */
 public static synchronized Display getDefault () {
-	if (Default == null) Default = new Display ();
+	if (Default is null) Default = new Display ();
 	return Default;
 }
 
-static boolean isValidClass (Class clazz) {
-	String name = clazz.getName ();
+static bool isValidClass (Class clazz) {
+	char[] name = clazz.getName ();
 	int index = name.lastIndexOf ('.');
-	return name.substring (0, index + 1).equals (PACKAGE_PREFIX);
+	return name.substring (0, index + 1)==/*eq*/ PACKAGE_PREFIX;
 }
 
 /**
@@ -1671,20 +1702,20 @@
  */
 public Control getFocusControl () {
 	checkDevice ();
-	if (focusControl != null && !focusControl.isDisposed ()) {
+	if (focusControl !is null && !focusControl.isDisposed ()) {
 		return focusControl;
 	}
-	if (activeShell == null) return null;
+	if (activeShell is null) return null;
 	int /*long*/ shellHandle = activeShell.shellHandle;
 	int /*long*/ handle = OS.gtk_window_get_focus (shellHandle);
-	if (handle == 0) return null;
+	if (handle is null) return null;
 	do {
 		Widget widget = getWidget (handle);
-		if (widget != null && widget instanceof Control) {
+		if (widget !is null && (null !is cast(Control)widget)) {
 			Control control = (Control) widget;
 			return control.isEnabled () ? control : null;
 		}
-	} while ((handle = OS.gtk_widget_get_parent (handle)) != 0);
+	} while ((handle = OS.gtk_widget_get_parent (handle)) !is null);
 	return null;
 }
 
@@ -1705,7 +1736,7 @@
  *
  * @since 3.0
  */
-public boolean getHighContrast () {
+public bool getHighContrast () {
 	checkDevice ();
 	return false;
 }
@@ -1770,7 +1801,7 @@
 Rectangle getWorkArea() {
 	byte[] name = Converter.wcsToMbcs (null, "_NET_WORKAREA", true);
 	int /*long*/ atom = OS.gdk_atom_intern (name, true);
-	if (atom == OS.GDK_NONE) return null;
+	if (atom is OS.GDK_NONE) return null;
 	int /*long*/[] actualType = new int /*long*/[1];
 	int[] actualFormat = new int[1];
 	int[] actualLength = new int[1];
@@ -1779,15 +1810,15 @@
 		return null;
 	}
 	Rectangle result = null;
-	if (data [0] != 0) {
-		if (actualLength [0] == 16) {
+	if (data [0] !is 0) {
+		if (actualLength [0] is 16) {
 			int values [] = new int [4];
 			OS.memmove (values, data[0], 16);
 			result = new Rectangle (values [0],values [1],values [2],values [3]);
-		} else if (actualLength [0] == 32) {
+		} else if (actualLength [0] is 32) {
 			long values [] = new long [4];
 			OS.memmove (values, data[0], 32);
-			result = new Rectangle ((int)values [0],(int)values [1],(int)values [2],(int)values [3]);
+			result = new Rectangle (cast(int)values [0],cast(int)values [1],cast(int)values [2],cast(int)values [3]);
 		}
 		OS.g_free (data [0]);
 	}
@@ -1806,7 +1837,7 @@
 	Monitor [] monitors = null;
 	Rectangle workArea = getWorkArea();
 	int /*long*/ screen = OS.gdk_screen_get_default ();
-	if (screen != 0) {
+	if (screen !is null) {
 		int monitorCount = OS.gdk_screen_get_n_monitors (screen);
 		if (monitorCount > 0) {
 			monitors = new Monitor [monitorCount];
@@ -1819,7 +1850,7 @@
 				monitor.y = dest.y;
 				monitor.width = dest.width;
 				monitor.height = dest.height;
-				if (i == 0 && workArea != null) {
+				if (i is 0 && workArea !is null) {
 					monitor.clientX = workArea.x;
 					monitor.clientY = workArea.y;
 					monitor.clientWidth = workArea.width;
@@ -1834,7 +1865,7 @@
 			}
 		}
 	}
-	if (monitors == null) {
+	if (monitors is null) {
 		/* No multimonitor support detected, default to one monitor */
 		Monitor monitor = new Monitor ();
 		Rectangle bounds = getBounds ();
@@ -1842,7 +1873,7 @@
 		monitor.y = bounds.y;
 		monitor.width = bounds.width;
 		monitor.height = bounds.height;
-		if (workArea != null) {
+		if (workArea !is null) {
 			monitor.clientX = workArea.x;
 			monitor.clientY = workArea.y;
 			monitor.clientWidth = workArea.width;
@@ -1888,14 +1919,14 @@
 	Shell [] result = new Shell [16];
 	for (int i = 0; i < widgetTable.length; i++) {
 		Widget widget = widgetTable [i];
-		if (widget != null && widget instanceof Shell) {
+		if (widget !is null && (null !is cast(Shell)widget)) {
 			int j = 0;
 			while (j < index) {
-				if (result [j] == widget) break;
+				if (result [j] is widget) break;
 				j++;
 			}
-			if (j == index) {
-				if (index == result.length) {
+			if (j is index) {
+				if (index is result.length) {
 					Shell [] newResult = new Shell [index + 16];
 					System.arraycopy (result, 0, newResult, 0, index);
 					result = newResult;
@@ -1904,7 +1935,7 @@
 			}
 		}
 	}
-	if (index == result.length) return result;
+	if (index is result.length) return result;
 	Shell [] newResult = new Shell [index];
 	System.arraycopy (result, 0, newResult, 0, index);
 	return newResult;
@@ -1975,7 +2006,7 @@
 		default:
 			return super.getSystemColor (id);
 	}
-	if (gdkColor == null) return super.getSystemColor (SWT.COLOR_BLACK);
+	if (gdkColor is null) return super.getSystemColor (SWT.COLOR_BLACK);
 	return Color.gtk_new (this, gdkColor);
 }
 
@@ -2024,7 +2055,7 @@
 public Cursor getSystemCursor (int id) {
 	checkDevice ();
 	if (!(0 <= id && id < cursors.length)) return null;
-	if (cursors [id] == null) {
+	if (cursors [id] is null) {
 		cursors [id] = new Cursor (this, id);
 	}
 	return cursors [id];
@@ -2060,23 +2091,23 @@
 	checkDevice ();
 	switch (id) {
 		case SWT.ICON_ERROR:
-			if (errorImage == null) {
+			if (errorImage is null) {
 				errorImage = createImage ("gtk-dialog-error");
 			}
 			return errorImage;
 		case SWT.ICON_INFORMATION:
 		case SWT.ICON_WORKING:
-			if (infoImage == null) {
+			if (infoImage is null) {
 				infoImage = createImage ("gtk-dialog-info");
 			}
 			return infoImage;
 		case SWT.ICON_QUESTION:
-			if (questionImage == null) {
+			if (questionImage is null) {
 				questionImage = createImage ("gtk-dialog-question");
 			}
 			return questionImage;
 		case SWT.ICON_WARNING:
-			if (warningImage == null) {
+			if (warningImage is null) {
 				warningImage = createImage ("gtk-dialog-warning");
 			}
 			return warningImage;
@@ -2089,7 +2120,7 @@
 
 	/* Get Tooltip resources */
 	int /*long*/ tooltipShellHandle = OS.gtk_window_new (OS.GTK_WINDOW_POPUP);
-	if (tooltipShellHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+	if (tooltipShellHandle is null) SWT.error (SWT.ERROR_NO_HANDLES);
 	byte[] gtk_tooltips = Converter.wcsToMbcs (null, "gtk-tooltips", true);
 	OS.gtk_widget_set_name (tooltipShellHandle, gtk_tooltips);
 	OS.gtk_widget_realize (tooltipShellHandle);
@@ -2183,7 +2214,7 @@
  */
 public Font getSystemFont () {
 	checkDevice ();
-	if (systemFont != null) return systemFont;
+	if (systemFont !is null) return systemFont;
 	int /*long*/ style = OS.gtk_widget_get_style (shellHandle);
 	int /*long*/ defaultFont = OS.pango_font_description_copy (OS.gtk_style_get_font_desc (style));
 	return systemFont = Font.gtk_new (this, defaultFont);
@@ -2203,7 +2234,7 @@
  */
 public Tray getSystemTray () {
 	checkDevice ();
-	if (tray != null) return tray;
+	if (tray !is null) return tray;
 	return tray = new Tray (this, SWT.NONE);
 }
 
@@ -2222,18 +2253,18 @@
 }
 
 Widget getWidget (int /*long*/ handle) {
-	if (handle == 0) return null;
-	if (lastWidget != null && lastHandle == handle) return lastWidget;
+	if (handle is null) return null;
+	if (lastWidget !is null && lastHandle is handle) return lastWidget;
 	int /*long*/ index = OS.g_object_get_qdata (handle, SWT_OBJECT_INDEX) - 1;
 	if (0 <= index && index < widgetTable.length) {
 		lastHandle = handle;
-		return lastWidget = widgetTable [(int)/*64*/index];
+		return lastWidget = widgetTable [cast(int)/*64*/index];
 	}
 	return null;
 }
 
 int /*long*/ idleProc (int /*long*/ data) {
-	boolean result = runAsyncMessages (false);
+	bool result = runAsyncMessages (false);
 	if (!result) {
 		synchronized (idleLock) {
 			idleHandle = 0;
@@ -2298,9 +2329,9 @@
 	signalIds [Widget.VISIBILITY_NOTIFY_EVENT] = OS.g_signal_lookup (OS.visibility_notify_event, OS.GTK_TYPE_WIDGET ());
 	signalIds [Widget.WINDOW_STATE_EVENT] = OS.g_signal_lookup (OS.window_state_event, OS.GTK_TYPE_WIDGET ());
 
-	windowCallback2 = new Callback (this, "windowProc", 2);
+	windowCallback2 = new void*/*Callback*/ (this, "windowProc", 2);
 	windowProc2 = windowCallback2.getAddress ();
-	if (windowProc2 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+	if (windowProc2 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
 
 	closures [Widget.ACTIVATE] = OS.g_cclosure_new (windowProc2, Widget.ACTIVATE, 0);
 	closures [Widget.ACTIVATE_INVERSE] = OS.g_cclosure_new (windowProc2, Widget.ACTIVATE_INVERSE, 0);
@@ -2321,9 +2352,9 @@
 	closures [Widget.UNMAP] = OS.g_cclosure_new (windowProc2, Widget.UNMAP, 0);
 	closures [Widget.UNREALIZE] = OS.g_cclosure_new (windowProc2, Widget.UNREALIZE, 0);
 
-	windowCallback3 = new Callback (this, "windowProc", 3);
+	windowCallback3 = new void*/*Callback*/ (this, "windowProc", 3);
 	windowProc3 = windowCallback3.getAddress ();
-	if (windowProc3 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+	if (windowProc3 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
 
 	closures [Widget.BUTTON_PRESS_EVENT] = OS.g_cclosure_new (windowProc3, Widget.BUTTON_PRESS_EVENT, 0);
 	closures [Widget.BUTTON_PRESS_EVENT_INVERSE] = OS.g_cclosure_new (windowProc3, Widget.BUTTON_PRESS_EVENT_INVERSE, 0);
@@ -2358,9 +2389,9 @@
 	closures [Widget.VISIBILITY_NOTIFY_EVENT] = OS.g_cclosure_new (windowProc3, Widget.VISIBILITY_NOTIFY_EVENT, 0);
 	closures [Widget.WINDOW_STATE_EVENT] = OS.g_cclosure_new (windowProc3, Widget.WINDOW_STATE_EVENT, 0);
 
-	windowCallback4 = new Callback (this, "windowProc", 4);
+	windowCallback4 = new void*/*Callback*/ (this, "windowProc", 4);
 	windowProc4 = windowCallback4.getAddress ();
-	if (windowProc4 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+	if (windowProc4 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
 
 	closures [Widget.DELETE_RANGE] = OS.g_cclosure_new (windowProc4, Widget.DELETE_RANGE, 0);
 	closures [Widget.DELETE_TEXT] = OS.g_cclosure_new (windowProc4, Widget.DELETE_TEXT, 0);
@@ -2370,9 +2401,9 @@
 	closures [Widget.TEST_COLLAPSE_ROW] = OS.g_cclosure_new (windowProc4, Widget.TEST_COLLAPSE_ROW, 0);
 	closures [Widget.TEST_EXPAND_ROW] = OS.g_cclosure_new (windowProc4, Widget.TEST_EXPAND_ROW, 0);
 
-	windowCallback5 = new Callback (this, "windowProc", 5);
+	windowCallback5 = new void*/*Callback*/ (this, "windowProc", 5);
 	windowProc5 = windowCallback5.getAddress ();
-	if (windowProc5 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+	if (windowProc5 is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
 
 	closures [Widget.CHANGE_VALUE] = OS.g_cclosure_new (windowProc5, Widget.CHANGE_VALUE, 0);
 	closures [Widget.EXPAND_COLLAPSE_CURSOR_ROW] = OS.g_cclosure_new (windowProc5, Widget.EXPAND_COLLAPSE_CURSOR_ROW, 0);
@@ -2380,73 +2411,73 @@
 	closures [Widget.TEXT_BUFFER_INSERT_TEXT] = OS.g_cclosure_new (windowProc5, Widget.TEXT_BUFFER_INSERT_TEXT, 0);
 
 	for (int i = 0; i < Widget.LAST_SIGNAL; i++) {
-		if (closures [i] != 0) OS.g_closure_ref (closures [i]);
+		if (closures [i] !is null) OS.g_closure_ref (closures [i]);
 	}
 
-	timerCallback = new Callback (this, "timerProc", 1);
+	timerCallback = new void*/*Callback*/ (this, "timerProc", 1);
 	timerProc = timerCallback.getAddress ();
-	if (timerProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	windowTimerCallback = new Callback (this, "windowTimerProc", 1);
+	if (timerProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	windowTimerCallback = new void*/*Callback*/ (this, "windowTimerProc", 1);
 	windowTimerProc = windowTimerCallback.getAddress ();
-	if (windowTimerProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	mouseHoverCallback = new Callback (this, "mouseHoverProc", 1);
+	if (windowTimerProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	mouseHoverCallback = new void*/*Callback*/ (this, "mouseHoverProc", 1);
 	mouseHoverProc = mouseHoverCallback.getAddress ();
-	if (mouseHoverProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	caretCallback = new Callback(this, "caretProc", 1);
+	if (mouseHoverProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	caretCallback = new void*/*Callback*/(this, "caretProc", 1);
 	caretProc = caretCallback.getAddress();
-	if (caretProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	menuPositionCallback = new Callback(this, "menuPositionProc", 5);
+	if (caretProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	menuPositionCallback = new void*/*Callback*/(this, "menuPositionProc", 5);
 	menuPositionProc = menuPositionCallback.getAddress();
-	if (menuPositionProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	sizeAllocateCallback = new Callback(this, "sizeAllocateProc", 3);
+	if (menuPositionProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	sizeAllocateCallback = new void*/*Callback*/(this, "sizeAllocateProc", 3);
 	sizeAllocateProc = sizeAllocateCallback.getAddress();
-	if (sizeAllocateProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	sizeRequestCallback = new Callback(this, "sizeRequestProc", 3);
+	if (sizeAllocateProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	sizeRequestCallback = new void*/*Callback*/(this, "sizeRequestProc", 3);
 	sizeRequestProc = sizeRequestCallback.getAddress();
-	if (sizeRequestProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	shellMapCallback = new Callback(this, "shellMapProc", 3);
+	if (sizeRequestProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	shellMapCallback = new void*/*Callback*/(this, "shellMapProc", 3);
 	shellMapProc = shellMapCallback.getAddress();
-	if (shellMapProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
+	if (shellMapProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
 
 	shellMapProcClosure = OS.g_cclosure_new (shellMapProc, 0, 0);
 	OS.g_closure_ref (shellMapProcClosure);
 
-	treeSelectionCallback = new Callback(this, "treeSelectionProc", 4);
+	treeSelectionCallback = new void*/*Callback*/(this, "treeSelectionProc", 4);
 	treeSelectionProc = treeSelectionCallback.getAddress();
-	if (treeSelectionProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	cellDataCallback = new Callback (this, "cellDataProc", 5);
+	if (treeSelectionProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	cellDataCallback = new void*/*Callback*/ (this, "cellDataProc", 5);
 	cellDataProc = cellDataCallback.getAddress ();
-	if (cellDataProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	setDirectionCallback = new Callback (this, "setDirectionProc", 2);
+	if (cellDataProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	setDirectionCallback = new void*/*Callback*/ (this, "setDirectionProc", 2);
 	setDirectionProc = setDirectionCallback.getAddress ();
-	if (setDirectionProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	allChildrenCallback = new Callback (this, "allChildrenProc", 2);
+	if (setDirectionProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	allChildrenCallback = new void*/*Callback*/ (this, "allChildrenProc", 2);
 	allChildrenProc = allChildrenCallback.getAddress ();
-	if (allChildrenProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	checkIfEventCallback = new Callback (this, "checkIfEventProc", 3);
+	if (allChildrenProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	checkIfEventCallback = new void*/*Callback*/ (this, "checkIfEventProc", 3);
 	checkIfEventProc = checkIfEventCallback.getAddress ();
-	if (checkIfEventProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
-
-	idleCallback = new Callback (this, "idleProc", 1);
+	if (checkIfEventProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+	idleCallback = new void*/*Callback*/ (this, "idleProc", 1);
 	idleProc = idleCallback.getAddress ();
-	if (idleProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
+	if (idleProc is null) error (SWT.ERROR_NO_MORE_CALLBACKS);
 }
 
 void initializeSystemSettings () {
-	styleSetCallback = new Callback (this, "styleSetProc", 3);
+	styleSetCallback = new void*/*Callback*/ (this, "styleSetProc", 3);
 	styleSetProc = styleSetCallback.getAddress ();
-	if (styleSetProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+	if (styleSetProc is null) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
 	OS.g_signal_connect (shellHandle, OS.style_set, styleSetProc, 0);
 
 	/*
@@ -2463,7 +2494,7 @@
 	int [] buffer2 = new int [1];
 	int /*long*/ settings = OS.gtk_settings_get_default ();
 	OS.g_object_get (settings, OS.gtk_entry_select_on_focus, buffer2, 0);
-	entrySelectOnFocus = buffer2 [0] != 0;
+	entrySelectOnFocus = buffer2 [0] !is 0;
 }
 
 void initializeWidgetTable () {
@@ -2478,14 +2509,14 @@
 	windowManager = "";
 	if (OS.GTK_VERSION >= OS.VERSION (2, 2, 0)) {
 		int /*long*/ screen = OS.gdk_screen_get_default ();
-		if (screen != 0) {
+		if (screen !is null) {
 			int /*long*/ ptr2 = OS.gdk_x11_screen_get_window_manager_name (screen);
-			if (ptr2 != 0) {
+			if (ptr2 !is null) {
 				int length = OS.strlen (ptr2);
 				if (length > 0) {
 					byte [] buffer2 = new byte [length];
 					OS.memmove (buffer2, ptr2, length);
-					windowManager = new String (Converter.mbcsToWcs (null, buffer2));
+					windowManager = new char[] (Converter.mbcsToWcs (null, buffer2));
 				}
 			}
 		}
@@ -2533,11 +2564,11 @@
 	if (isDisposed()) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
 	int /*long*/ root = OS.GDK_ROOT_PARENT ();
 	int /*long*/ gdkGC = OS.gdk_gc_new (root);
-	if (gdkGC == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+	if (gdkGC is null) SWT.error (SWT.ERROR_NO_HANDLES);
 	OS.gdk_gc_set_subwindow (gdkGC, OS.GDK_INCLUDE_INFERIORS);
-	if (data != null) {
+	if (data !is null) {
 		int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
-		if ((data.style & mask) == 0) {
+		if ((data.style & mask) is 0) {
 			data.style |= SWT.LEFT_TO_RIGHT;
 		}
 		data.device = this;
@@ -2549,8 +2580,8 @@
 	return gdkGC;
 }
 
-boolean isValidThread () {
-	return thread == Thread.currentThread ();
+bool isValidThread () {
+	return thread is Thread.currentThread ();
 }
 
 /**
@@ -2591,7 +2622,7 @@
  */
 public Point map (Control from, Control to, Point point) {
 	checkDevice ();
-	if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (point is null) error (SWT.ERROR_NULL_ARGUMENT);
 	return map (from, to, point.x, point.y);
 }
 
@@ -2633,18 +2664,18 @@
  */
 public Point map (Control from, Control to, int x, int y) {
 	checkDevice ();
-	if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
-	if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
+	if (from !is null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
+	if (to !is null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
 	Point point = new Point (x, y);
-	if (from == to) return point;
-	if (from != null) {
+	if (from is to) return point;
+	if (from !is null) {
 		int /*long*/ window = from.eventWindow ();
 		int [] origin_x = new int [1], origin_y = new int [1];
 		OS.gdk_window_get_origin (window, origin_x, origin_y);
 		point.x += origin_x [0];
 		point.y += origin_y [0];
 	}
-	if (to != null) {
+	if (to !is null) {
 		int /*long*/ window = to.eventWindow ();
 		int [] origin_x = new int [1], origin_y = new int [1];
 		OS.gdk_window_get_origin (window, origin_x, origin_y);
@@ -2692,7 +2723,7 @@
  */
 public Rectangle map (Control from, Control to, Rectangle rectangle) {
 	checkDevice();
-	if (rectangle == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (rectangle is null) error (SWT.ERROR_NULL_ARGUMENT);
 	return map (from, to, rectangle.x, rectangle.y, rectangle.width, rectangle.height);
 }
 
@@ -2702,20 +2733,20 @@
 	byte [] buffer;
 	if (key <= 0xFF) {
 		buffer = new byte [1];
-		buffer [0] = (byte) key;
+		buffer [0] = cast(byte) key;
 	} else {
 		buffer = new byte [2];
-		buffer [0] = (byte) ((key >> 8) & 0xFF);
-		buffer [1] = (byte) (key & 0xFF);
+		buffer [0] = cast(byte) ((key >> 8) & 0xFF);
+		buffer [1] = cast(byte) (key & 0xFF);
 	}
 	char [] result = Converter.mbcsToWcs (null, buffer);
-	if (result.length == 0) return 0;
+	if (result.length is 0) return 0;
 	return result [0];
 }
 
 int /*long*/ menuPositionProc (int /*long*/ menu, int /*long*/ x, int /*long*/ y, int /*long*/ push_in, int /*long*/ user_data) {
 	Widget widget = getWidget (menu);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.menuPositionProc (menu, x, y, push_in, user_data);
 }
 
@@ -2759,18 +2790,18 @@
  */
 public Rectangle map (Control from, Control to, int x, int y, int width, int height) {
 	checkDevice();
-	if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
-	if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
+	if (from !is null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
+	if (to !is null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
 	Rectangle rect = new Rectangle (x, y, width, height);
-	if (from == to) return rect;
-	if (from != null) {
+	if (from is to) return rect;
+	if (from !is null) {
 		int /*long*/ window = from.eventWindow ();
 		int [] origin_x = new int [1], origin_y = new int [1];
 		OS.gdk_window_get_origin (window, origin_x, origin_y);
 		rect.x += origin_x [0];
 		rect.y += origin_y [0];
 	}
-	if (to != null) {
+	if (to !is null) {
 		int /*long*/ window = to.eventWindow ();
 		int [] origin_x = new int [1], origin_y = new int [1];
 		OS.gdk_window_get_origin (window, origin_x, origin_y);
@@ -2782,7 +2813,7 @@
 
 int /*long*/ mouseHoverProc (int /*long*/ handle) {
 	Widget widget = getWidget (handle);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.hoverProc (handle);
 }
 
@@ -2839,9 +2870,9 @@
  * @since 3.0
  *
  */
-public boolean post (Event event) {
+public bool post (Event event) {
 	if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
-	if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (event is null) error (SWT.ERROR_NULL_ARGUMENT);
 	if (!OS.GDK_WINDOWING_X11()) return false;
 	int /*long*/ xDisplay = OS.GDK_DISPLAY ();
 	int type = event.type;
@@ -2850,8 +2881,8 @@
 		case SWT.KeyUp: {
 			int keyCode = 0;
 			int /*long*/ keysym = untranslateKey (event.keyCode);
-			if (keysym != 0) keyCode = OS.XKeysymToKeycode (xDisplay, keysym);
-			if (keyCode == 0) {
+			if (keysym !is 0) keyCode = OS.XKeysymToKeycode (xDisplay, keysym);
+			if (keyCode is 0) {
 				char key = event.character;
 				switch (key) {
 					case SWT.BS: keysym = OS.GDK_BackSpace; break;
@@ -2864,15 +2895,15 @@
 						keysym = wcsToMbcs (key);
 				}
 				keyCode = OS.XKeysymToKeycode (xDisplay, keysym);
-				if (keyCode == 0) return false;
+				if (keyCode is 0) return false;
 			}
-			OS.XTestFakeKeyEvent (xDisplay, keyCode, type == SWT.KeyDown, 0);
+			OS.XTestFakeKeyEvent (xDisplay, keyCode, type is SWT.KeyDown, 0);
 			return true;
 		}
 		case SWT.MouseDown:
 		case SWT.MouseMove:
 		case SWT.MouseUp: {
-			if (type == SWT.MouseMove) {
+			if (type is SWT.MouseMove) {
 				OS.XTestFakeMotionEvent (xDisplay, -1, event.x, event.y, 0);
 			} else {
 				int button = event.button;
@@ -2884,7 +2915,7 @@
 					case 5: button = 7;	break;
 					default: return false;
 				}
-				OS.XTestFakeButtonEvent (xDisplay, button, type == SWT.MouseDown, 0);
+				OS.XTestFakeButtonEvent (xDisplay, button, type is SWT.MouseDown, 0);
 			}
 			return true;
 		}
@@ -2894,9 +2925,9 @@
 		* to subsequent mouse actions.
 		*/
 //		case SWT.MouseWheel: {
-//			if (event.count == 0) return false;
+//			if (event.count is 0) return false;
 //			int button = event.count < 0 ? 5 : 4;
-//			OS.XTestFakeButtonEvent (xDisplay, button, type == SWT.MouseWheel, 0);
+//			OS.XTestFakeButtonEvent (xDisplay, button, type is SWT.MouseWheel, 0);
 //		}
 	}
 	return false;
@@ -2909,14 +2940,14 @@
 	* thread so it must be re-enterant but does not
 	* need to be synchronized.
 	*/
-	if (eventQueue == null) eventQueue = new Event [4];
+	if (eventQueue is null) eventQueue = new Event [4];
 	int index = 0;
 	int length = eventQueue.length;
 	while (index < length) {
-		if (eventQueue [index] == null) break;
+		if (eventQueue [index] is null) break;
 		index++;
 	}
-	if (index == length) {
+	if (index is length) {
 		Event [] newQueue = new Event [length + 4];
 		System.arraycopy (eventQueue, 0, newQueue, 0, length);
 		eventQueue = newQueue;
@@ -2925,11 +2956,11 @@
 }
 
 void putGdkEvents () {
-	if (gdkEventCount != 0) {
+	if (gdkEventCount !is 0) {
 		for (int i = 0; i < gdkEventCount; i++) {
 			int /*long*/ event = gdkEvents [i];
 			Widget widget = gdkEventWidgets [i];
-			if (widget == null || !widget.isDisposed ()) {
+			if (widget is null || !widget.isDisposed ()) {
 				OS.gdk_event_put (event);
 			}
 			OS.gdk_event_free (event);
@@ -2964,9 +2995,9 @@
  * @see #sleep
  * @see #wake
  */
-public boolean readAndDispatch () {
+public bool readAndDispatch () {
 	checkDevice ();
-	boolean events = false;
+	bool events = false;
 	events |= runSettings ();
 	events |= runPopups ();
 	events |= OS.g_main_context_iteration (0, false);
@@ -2979,7 +3010,7 @@
 
 synchronized void register () {
 	for (int i=0; i<Displays.length; i++) {
-		if (Displays [i] == null) {
+		if (Displays [i] is null) {
 			Displays [i] = this;
 			return;
 		}
@@ -3021,12 +3052,12 @@
 		Shell shell = shells [i];
 		if (!shell.isDisposed ())  shell.dispose ();
 	}
-	if (tray != null) tray.dispose ();
+	if (tray !is null) tray.dispose ();
 	tray = null;
 	while (readAndDispatch ()) {}
-	if (disposeList != null) {
+	if (disposeList !is null) {
 		for (int i=0; i<disposeList.length; i++) {
-			if (disposeList [i] != null) disposeList [i].run ();
+			if (disposeList [i] !is null) disposeList [i].run ();
 		}
 	}
 	disposeList = null;
@@ -3052,7 +3083,7 @@
 	checkIfEventProc = 0;
 
 	/* Dispose preedit window */
-	if (preeditWindow != 0) OS.gtk_widget_destroy (preeditWindow);
+	if (preeditWindow !is null) OS.gtk_widget_destroy (preeditWindow);
 	imControl = null;
 
 	/* Dispose the menu callback */
@@ -3072,7 +3103,7 @@
 	/* Dispose the run async messages callback */
 	idleCallback.dispose (); idleCallback = null;
 	idleProc = 0;
-	if (idleHandle != 0) OS.g_source_remove (idleHandle);
+	if (idleHandle !is null) OS.g_source_remove (idleHandle);
 	idleHandle = 0;
 
 	/* Dispose GtkTreeView callbacks */
@@ -3090,7 +3121,7 @@
 	allChildrenProc = 0;
 
 	/* Dispose the caret callback */
-	if (caretId != 0) OS.gtk_timeout_remove (caretId);
+	if (caretId !is null) OS.gtk_timeout_remove (caretId);
 	caretId = 0;
 	caretProc = 0;
 	caretCallback.dispose ();
@@ -3098,14 +3129,14 @@
 
 	/* Release closures */
 	for (int i = 0; i < Widget.LAST_SIGNAL; i++) {
-		if (closures [i] != 0) OS.g_closure_unref (closures [i]);
+		if (closures [i] !is null) OS.g_closure_unref (closures [i]);
 	}
-	if (shellMapProcClosure != 0) OS.g_closure_unref (shellMapProcClosure);
+	if (shellMapProcClosure !is null) OS.g_closure_unref (shellMapProcClosure);
 
 	/* Dispose the timer callback */
-	if (timerIds != null) {
+	if (timerIds !is null) {
 		for (int i=0; i<timerIds.length; i++) {
-			if (timerIds [i] != 0) OS.gtk_timeout_remove (timerIds [i]);
+			if (timerIds [i] !is null) OS.gtk_timeout_remove (timerIds [i]);
 		}
 	}
 	timerIds = null;
@@ -3118,33 +3149,33 @@
 	windowTimerCallback = null;
 
 	/* Dispose mouse hover callback */
-	if (mouseHoverId != 0) OS.gtk_timeout_remove (mouseHoverId);
+	if (mouseHoverId !is null) OS.gtk_timeout_remove (mouseHoverId);
 	mouseHoverId = 0;
 	mouseHoverHandle = mouseHoverProc = 0;
 	mouseHoverCallback.dispose ();
 	mouseHoverCallback = null;
 
 	/* Dispose the default font */
-	if (systemFont != null) systemFont.dispose ();
+	if (systemFont !is null) systemFont.dispose ();
 	systemFont = null;
 
 	/* Dispose the System Images */
-	if (errorImage != null) errorImage.dispose();
-	if (infoImage != null) infoImage.dispose();
-	if (questionImage != null) questionImage.dispose();
-	if (warningImage != null) warningImage.dispose();
+	if (errorImage !is null) errorImage.dispose();
+	if (infoImage !is null) infoImage.dispose();
+	if (questionImage !is null) questionImage.dispose();
+	if (warningImage !is null) warningImage.dispose();
 	errorImage = infoImage = questionImage = warningImage = null;
 
 	/* Release the System Cursors */
 	for (int i = 0; i < cursors.length; i++) {
-		if (cursors [i] != null) cursors [i].dispose ();
+		if (cursors [i] !is null) cursors [i].dispose ();
 	}
 	cursors = null;
 
 	/* Release Acquired Resources */
-	if (resources != null) {
+	if (resources !is null) {
 		for (int i=0; i<resources.length; i++) {
-			if (resources [i] != null) resources [i].dispose ();
+			if (resources [i] !is null) resources [i].dispose ();
 		}
 		resources = null;
 	}
@@ -3160,7 +3191,7 @@
 	eventCallback.dispose ();  eventCallback = null;
 
 	/* Dispose the hidden shell */
-	if (shellHandle != 0) OS.gtk_widget_destroy (shellHandle);
+	if (shellHandle !is null) OS.gtk_widget_destroy (shellHandle);
 	shellHandle = 0;
 
 	/* Dispose the settings callback */
@@ -3169,7 +3200,7 @@
 
 	/* Release the sleep resources */
 	max_priority = timeout = null;
-	if (fds != 0) OS.g_free (fds);
+	if (fds !is null) OS.g_free (fds);
 	fds = 0;
 
 	/* Release references */
@@ -3206,21 +3237,21 @@
  */
 public void removeFilter (int eventType, Listener listener) {
 	checkDevice ();
-	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
-	if (filterTable == null) return;
+	if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (filterTable is null) return;
 	filterTable.unhook (eventType, listener);
-	if (filterTable.size () == 0) filterTable = null;
+	if (filterTable.size () is 0) filterTable = null;
 }
 
 int /*long*/ removeGdkEvent () {
-	if (gdkEventCount == 0) return 0;
+	if (gdkEventCount is 0) return 0;
 	int /*long*/ event = gdkEvents [0];
 	--gdkEventCount;
 	System.arraycopy (gdkEvents, 1, gdkEvents, 0, gdkEventCount);
 	System.arraycopy (gdkEventWidgets, 1, gdkEventWidgets, 0, gdkEventCount);
 	gdkEvents [gdkEventCount] = 0;
 	gdkEventWidgets [gdkEventCount] = null;
-	if (gdkEventCount == 0) {
+	if (gdkEventCount is 0) {
 		gdkEvents = null;
 		gdkEventWidgets = null;
 	}
@@ -3229,7 +3260,7 @@
 
 void removeIdleProc () {
 	synchronized(idleLock) {
-		if (idleHandle != 0) OS.g_source_remove (idleHandle);
+		if (idleHandle !is null) OS.g_source_remove (idleHandle);
 		idleNeeded = false;
 		idleHandle = 0;
 	}
@@ -3258,22 +3289,22 @@
  */
 public void removeListener (int eventType, Listener listener) {
 	checkDevice ();
-	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
-	if (eventTable == null) return;
+	if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable is null) return;
 	eventTable.unhook (eventType, listener);
 }
 
 void removeMouseHoverTimeout (int /*long*/ handle) {
-	if (handle != mouseHoverHandle) return;
-	if (mouseHoverId != 0) OS.gtk_timeout_remove (mouseHoverId);
+	if (handle !is mouseHoverHandle) return;
+	if (mouseHoverId !is null) OS.gtk_timeout_remove (mouseHoverId);
 	mouseHoverId = 0;
 	mouseHoverHandle = 0;
 }
 
 void removePopup (Menu menu) {
-	if (popups == null) return;
+	if (popups is null) return;
 	for (int i=0; i<popups.length; i++) {
-		if (popups [i] == menu) {
+		if (popups [i] is menu) {
 			popups [i] = null;
 			return;
 		}
@@ -3281,10 +3312,10 @@
 }
 
 Widget removeWidget (int /*long*/ handle) {
-	if (handle == 0) return null;
+	if (handle is null) return null;
 	lastWidget = null;
 	Widget widget = null;
-	int index = (int)/*64*/ OS.g_object_get_qdata (handle, SWT_OBJECT_INDEX) - 1;
+	int index = cast(int)/*64*/ OS.g_object_get_qdata (handle, SWT_OBJECT_INDEX) - 1;
 	if (0 <= index && index < widgetTable.length) {
 		widget = widgetTable [index];
 		widgetTable [index] = null;
@@ -3295,30 +3326,30 @@
 	return widget;
 }
 
-boolean runAsyncMessages (boolean all) {
+bool runAsyncMessages (bool all) {
 	return synchronizer.runAsyncMessages (all);
 }
 
-boolean runDeferredEvents () {
+bool runDeferredEvents () {
 	/*
 	* Run deferred events.  This code is always
 	* called in the Display's thread so it must
 	* be re-enterant but need not be synchronized.
 	*/
-	while (eventQueue != null) {
+	while (eventQueue !is null) {
 
 		/* Take an event off the queue */
 		Event event = eventQueue [0];
-		if (event == null) break;
+		if (event is null) break;
 		int length = eventQueue.length;
 		System.arraycopy (eventQueue, 1, eventQueue, 0, --length);
 		eventQueue [length] = null;
 
 		/* Run the event */
 		Widget widget = event.widget;
-		if (widget != null && !widget.isDisposed ()) {
+		if (widget !is null && !widget.isDisposed ()) {
 			Widget item = event.item;
-			if (item == null || !item.isDisposed ()) {
+			if (item is null || !item.isDisposed ()) {
 				widget.sendEvent (event);
 			}
 		}
@@ -3335,12 +3366,12 @@
 	return true;
 }
 
-boolean runPopups () {
-	if (popups == null) return false;
-	boolean result = false;
-	while (popups != null) {
+bool runPopups () {
+	if (popups is null) return false;
+	bool result = false;
+	while (popups !is null) {
 		Menu menu = popups [0];
-		if (menu == null) break;
+		if (menu is null) break;
 		int length = popups.length;
 		System.arraycopy (popups, 1, popups, 0, --length);
 		popups [length] = null;
@@ -3352,7 +3383,7 @@
 	return result;
 }
 
-boolean runSettings () {
+bool runSettings () {
 	if (!runSettings) return false;
 	runSettings = false;
 	saveResources ();
@@ -3378,7 +3409,7 @@
  *
  * @param name the new app name or <code>null</code>
  */
-public static void setAppName (String name) {
+public static void setAppName (char[] name) {
 	APP_NAME = name;
 }
 
@@ -3423,7 +3454,7 @@
  */
 public void setCursorLocation (Point point) {
 	checkDevice ();
-	if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (point is null) error (SWT.ERROR_NULL_ARGUMENT);
 	setCursorLocation (point.x, point.y);
 }
 
@@ -3452,49 +3483,49 @@
  * @see #getData(String)
  * @see #disposeExec(Runnable)
  */
-public void setData (String key, Object value) {
+public void setData (char[] key, Object value) {
 	checkDevice ();
-	if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
-
-	if (key.equals (DISPATCH_EVENT_KEY)) {
-		if (value == null || value instanceof int []) {
+	if (key is null) error (SWT.ERROR_NULL_ARGUMENT);
+
+	if (key==/*eq*/ DISPATCH_EVENT_KEY) {
+		if (value is null || value instanceof int []) {
 			dispatchEvents = (int []) value;
-			if (value == null) putGdkEvents ();
+			if (value is null) putGdkEvents ();
 			return;
 		}
 	}
 
-	if (key.equals (ADD_WIDGET_KEY)) {
+	if (key==/*eq*/ ADD_WIDGET_KEY) {
 		Object [] data = (Object []) value;
 		int /*long*/ handle = ((LONG) data [0]).value;
 		Widget widget = (Widget) data [1];
-		if (widget != null) {
+		if (widget !is null) {
 			addWidget (handle, widget);
 		} else {
 			removeWidget (handle);
 		}
 	}
 
-	if (key.equals (ADD_IDLE_PROC_KEY)) {
+	if (key==/*eq*/ ADD_IDLE_PROC_KEY) {
 		addIdleProc ();
 		return;
 	}
-	if (key.equals (REMOVE_IDLE_PROC_KEY)) {
+	if (key==/*eq*/ REMOVE_IDLE_PROC_KEY) {
 		removeIdleProc ();
 		return;
 	}
 
 	/* Remove the key/value pair */
-	if (value == null) {
-		if (keys == null) return;
+	if (value is null) {
+		if (keys is null) return;
 		int index = 0;
-		while (index < keys.length && !keys [index].equals (key)) index++;
-		if (index == keys.length) return;
-		if (keys.length == 1) {
+		while (index < keys.length && !keys [index]==/*eq*/ key) index++;
+		if (index is keys.length) return;
+		if (keys.length is 1) {
 			keys = null;
 			values = null;
 		} else {
-			String [] newKeys = new String [keys.length - 1];
+			char[] [] newKeys = new char[] [keys.length - 1];
 			Object [] newValues = new Object [values.length - 1];
 			System.arraycopy (keys, 0, newKeys, 0, index);
 			System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
@@ -3507,18 +3538,18 @@
 	}
 
 	/* Add the key/value pair */
-	if (keys == null) {
-		keys = new String [] {key};
+	if (keys is null) {
+		keys = new char[] [] {key};
 		values = new Object [] {value};
 		return;
 	}
 	for (int i=0; i<keys.length; i++) {
-		if (keys [i].equals (key)) {
+		if (keys [i]==/*eq*/ key) {
 			values [i] = value;
 			return;
 		}
 	}
-	String [] newKeys = new String [keys.length + 1];
+	char[] [] newKeys = new char[] [keys.length + 1];
 	Object [] newValues = new Object [values.length + 1];
 	System.arraycopy (keys, 0, newKeys, 0, keys.length);
 	System.arraycopy (values, 0, newValues, 0, values.length);
@@ -3557,7 +3588,7 @@
 }
 
 int /*long*/ setDirectionProc (int /*long*/ widget, int /*long*/ direction) {
-	OS.gtk_widget_set_direction (widget, (int)/*64*/ direction);
+	OS.gtk_widget_set_direction (widget, cast(int)/*64*/ direction);
 	if (OS.GTK_IS_CONTAINER (widget)) {
 		OS.gtk_container_forall (widget, setDirectionProc, direction);
 	}
@@ -3581,8 +3612,8 @@
  */
 public void setSynchronizer (Synchronizer synchronizer) {
 	checkDevice ();
-	if (synchronizer == null) error (SWT.ERROR_NULL_ARGUMENT);
-	if (this.synchronizer != null) {
+	if (synchronizer is null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (this.synchronizer !is null) {
 		this.synchronizer.runAsyncMessages(true);
 	}
 	this.synchronizer = synchronizer;
@@ -3590,11 +3621,11 @@
 
 void showIMWindow (Control control) {
 	imControl = control;
-	if (preeditWindow == 0) {
+	if (preeditWindow is null) {
 		preeditWindow = OS.gtk_window_new (OS.GTK_WINDOW_POPUP);
-		if (preeditWindow == 0) error (SWT.ERROR_NO_HANDLES);
+		if (preeditWindow is null) error (SWT.ERROR_NO_HANDLES);
 		preeditLabel = OS.gtk_label_new (null);
-		if (preeditLabel == 0) error (SWT.ERROR_NO_HANDLES);
+		if (preeditLabel is null) error (SWT.ERROR_NO_HANDLES);
 		OS.gtk_container_add (preeditWindow, preeditLabel);
 		OS.gtk_widget_show (preeditLabel);
 	}
@@ -3602,13 +3633,13 @@
 	int /*long*/ [] pangoAttrs = new int /*long*/ [1];
 	int /*long*/ imHandle = control.imHandle ();
 	OS.gtk_im_context_get_preedit_string (imHandle, preeditString, pangoAttrs, null);
-	if (preeditString [0] != 0 && OS.strlen (preeditString [0]) > 0) {
+	if (preeditString [0] !is null && OS.strlen (preeditString [0]) > 0) {
 		Control widget = control.findBackgroundControl ();
-		if (widget == null) widget = control;
+		if (widget is null) widget = control;
 		OS.gtk_widget_modify_bg (preeditWindow,  OS.GTK_STATE_NORMAL, widget.getBackgroundColor ());
 		widget.setForegroundColor (preeditLabel, control.getForegroundColor());
 		OS.gtk_widget_modify_font (preeditLabel, control.getFontDescription ());
-		if (pangoAttrs [0] != 0) OS.gtk_label_set_attributes (preeditLabel, pangoAttrs[0]);
+		if (pangoAttrs [0] !is null) OS.gtk_label_set_attributes (preeditLabel, pangoAttrs[0]);
 		OS.gtk_label_set_text (preeditLabel, preeditString [0]);
 		Point point = control.toDisplay (control.getIMCaretPos ());
 		OS.gtk_window_move (preeditWindow, point.x, point.y);
@@ -3619,8 +3650,8 @@
 	} else {
 		OS.gtk_widget_hide (preeditWindow);
 	}
-	if (preeditString [0] != 0) OS.g_free (preeditString [0]);
-	if (pangoAttrs [0] != 0) OS.pango_attr_list_unref (pangoAttrs [0]);
+	if (preeditString [0] !is null) OS.g_free (preeditString [0]);
+	if (pangoAttrs [0] !is null) OS.pango_attr_list_unref (pangoAttrs [0]);
 }
 
 /**
@@ -3637,9 +3668,9 @@
  *
  * @see #wake
  */
-public boolean sleep () {
+public bool sleep () {
 	checkDevice ();
-	if (gdkEventCount == 0) {
+	if (gdkEventCount is 0) {
 		gdkEvents = null;
 		gdkEventWidgets = null;
 	}
@@ -3648,14 +3679,14 @@
 		runSettings = true;
 		return false;
 	}
-	if (getMessageCount () != 0) return true;
-	if (fds == 0) {
+	if (getMessageCount () !is 0) return true;
+	if (fds is null) {
 		allocated_nfds = 2;
 		fds = OS.g_malloc (OS.GPollFD_sizeof () * allocated_nfds);
 	}
 	max_priority [0] = timeout [0] = 0;
 	int /*long*/ context = OS.g_main_context_default ();
-	boolean result = false;
+	bool result = false;
 	do {
 		if (OS.g_main_context_acquire (context)) {
 			result = OS.g_main_context_prepare (context, max_priority);
@@ -3666,8 +3697,8 @@
 				fds = OS.g_malloc (OS.GPollFD_sizeof() * allocated_nfds);
 			}
 			int /*long*/ poll = OS.g_main_context_get_poll_func (context);
-			if (poll != 0) {
-				if (nfds > 0 || timeout [0] != 0) {
+			if (poll !is null) {
+				if (nfds > 0 || timeout [0] !is 0) {
 					/*
 					* Bug in GTK. For some reason, g_main_context_wakeup() may
 					* fail to wake up the UI thread from the polling function.
@@ -3691,7 +3722,7 @@
 			OS.g_main_context_check (context, max_priority [0], fds, nfds);
 			OS.g_main_context_release (context);
 		}
-	} while (!result && getMessageCount () == 0 && !wake);
+	} while (!result && getMessageCount () is null && !wake);
 	wake = false;
 	return true;
 }
@@ -3723,15 +3754,15 @@
  */
 public void timerExec (int milliseconds, Runnable runnable) {
 	checkDevice ();
-	if (runnable == null) error (SWT.ERROR_NULL_ARGUMENT);
-	if (timerList == null) timerList = new Runnable [4];
-	if (timerIds == null) timerIds = new int [4];
+	if (runnable is null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (timerList is null) timerList = new Runnable [4];
+	if (timerIds is null) timerIds = new int [4];
 	int index = 0;
 	while (index < timerList.length) {
-		if (timerList [index] == runnable) break;
+		if (timerList [index] is runnable) break;
 		index++;
 	}
-	if (index != timerList.length) {
+	if (index !is timerList.length) {
 		OS.gtk_timeout_remove (timerIds [index]);
 		timerList [index] = null;
 		timerIds [index] = 0;
@@ -3740,10 +3771,10 @@
 		if (milliseconds < 0) return;
 		index = 0;
 		while (index < timerList.length) {
-			if (timerList [index] == null) break;
+			if (timerList [index] is null) break;
 			index++;
 		}
-		if (index == timerList.length) {
+		if (index is timerList.length) {
 			Runnable [] newTimerList = new Runnable [timerList.length + 4];
 			System.arraycopy (timerList, 0, newTimerList, 0, timerList.length);
 			timerList = newTimerList;
@@ -3753,32 +3784,32 @@
 		}
 	}
 	int timerId = OS.gtk_timeout_add (milliseconds, timerProc, index);
-	if (timerId != 0) {
+	if (timerId !is null) {
 		timerIds [index] = timerId;
 		timerList [index] = runnable;
 	}
 }
 
 int /*long*/ timerProc (int /*long*/ i) {
-	if (timerList == null) return 0;
-	int index = (int)/*64*/i;
+	if (timerList is null) return 0;
+	int index = cast(int)/*64*/i;
 	if (0 <= index && index < timerList.length) {
 		Runnable runnable = timerList [index];
 		timerList [index] = null;
 		timerIds [index] = 0;
-		if (runnable != null) runnable.run ();
+		if (runnable !is null) runnable.run ();
 	}
 	return 0;
 }
 
 int /*long*/ caretProc (int /*long*/ clientData) {
 	caretId = 0;
-	if (currentCaret == null) {
+	if (currentCaret is null) {
 		return 0;
 	}
 	if (currentCaret.blinkCaret()) {
 		int blinkRate = currentCaret.blinkRate;
-		if (blinkRate == 0) return 0;
+		if (blinkRate is 0) return 0;
 		caretId = OS.gtk_timeout_add (blinkRate, caretProc, 0);
 	} else {
 		currentCaret = null;
@@ -3788,25 +3819,25 @@
 
 int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
 	Widget widget = getWidget (user_data);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.sizeAllocateProc (handle, arg0, user_data);
 }
 
 int /*long*/ sizeRequestProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
 	Widget widget = getWidget (user_data);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.sizeRequestProc (handle, arg0, user_data);
 }
 
 int /*long*/ treeSelectionProc (int /*long*/ model, int /*long*/ path, int /*long*/ iter, int /*long*/ data) {
 	Widget widget = getWidget (data);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.treeSelectionProc (model, path, iter, treeSelection, treeSelectionLength++);
 }
 
 void saveResources () {
 	int resourceCount = 0;
-	if (resources == null) {
+	if (resources is null) {
 		resources = new Resource [RESOURCE_SIZE];
 	} else {
 		resourceCount = resources.length;
@@ -3814,17 +3845,17 @@
 		System.arraycopy (resources, 0, newResources, 0, resourceCount);
 		resources = newResources;
 	}
-	if (systemFont != null) {
+	if (systemFont !is null) {
 		resources [resourceCount++] = systemFont;
 		systemFont = null;
 	}
-	if (errorImage != null) resources [resourceCount++] = errorImage;
-	if (infoImage != null) resources [resourceCount++] = infoImage;
-	if (questionImage != null) resources [resourceCount++] = questionImage;
-	if (warningImage != null) resources [resourceCount++] = warningImage;
+	if (errorImage !is null) resources [resourceCount++] = errorImage;
+	if (infoImage !is null) resources [resourceCount++] = infoImage;
+	if (questionImage !is null) resources [resourceCount++] = questionImage;
+	if (warningImage !is null) resources [resourceCount++] = warningImage;
 	errorImage = infoImage = questionImage = warningImage = null;
 	for (int i=0; i<cursors.length; i++) {
-		if (cursors [i] != null) resources [resourceCount++] = cursors [i];
+		if (cursors [i] !is null) resources [resourceCount++] = cursors [i];
 		cursors [i] = null;
 	}
 	if (resourceCount < RESOURCE_SIZE) {
@@ -3835,30 +3866,30 @@
 }
 
 void sendEvent (int eventType, Event event) {
-	if (eventTable == null && filterTable == null) {
+	if (eventTable is null && filterTable is null) {
 		return;
 	}
-	if (event == null) event = new Event ();
+	if (event is null) event = new Event ();
 	event.display = this;
 	event.type = eventType;
-	if (event.time == 0) event.time = getLastEventTime ();
+	if (event.time is 0) event.time = getLastEventTime ();
 	if (!filterEvent (event)) {
-		if (eventTable != null) eventTable.sendEvent (event);
+		if (eventTable !is null) eventTable.sendEvent (event);
 	}
 }
 
 void setCurrentCaret (Caret caret) {
-	if (caretId != 0) OS.gtk_timeout_remove(caretId);
+	if (caretId !is null) OS.gtk_timeout_remove(caretId);
 	caretId = 0;
 	currentCaret = caret;
-	if (caret == null) return;
+	if (caret is null) return;
 	int blinkRate = currentCaret.blinkRate;
 	caretId = OS.gtk_timeout_add (blinkRate, caretProc, 0);
 }
 
 int /*long*/ shellMapProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
 	Widget widget = getWidget (handle);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.shellMapProc (handle, arg0, user_data);
 }
 
@@ -3892,7 +3923,7 @@
 public void syncExec (Runnable runnable) {
 	if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
 	synchronized (idleLock) {
-		if (idleNeeded && idleHandle == 0) {
+		if (idleNeeded && idleHandle is null) {
 			//NOTE: calling unlocked function in OS
 			idleHandle = OS._g_idle_add (idleProc, 0);
 		}
@@ -3902,14 +3933,14 @@
 
 static int translateKey (int key) {
 	for (int i=0; i<KeyTable.length; i++) {
-		if (KeyTable [i] [0] == key) return KeyTable [i] [1];
+		if (KeyTable [i] [0] is key) return KeyTable [i] [1];
 	}
 	return 0;
 }
 
 static int untranslateKey (int key) {
 	for (int i=0; i<KeyTable.length; i++) {
-		if (KeyTable [i] [1] == key) return KeyTable [i] [0];
+		if (KeyTable [i] [1] is key) return KeyTable [i] [0];
 	}
 	return 0;
 }
@@ -3944,7 +3975,7 @@
  */
 public void wake () {
 	if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
-	if (thread == Thread.currentThread ()) return;
+	if (thread is Thread.currentThread ()) return;
 	wakeThread ();
 }
 
@@ -3957,8 +3988,8 @@
 	int key = ch & 0xFFFF;
 	if (key <= 0x7F) return ch;
 	byte [] buffer = Converter.wcsToMbcs (null, new char [] {ch}, false);
-	if (buffer.length == 1) return (char) buffer [0];
-	if (buffer.length == 2) {
+	if (buffer.length is 1) return (char) buffer [0];
+	if (buffer.length is 2) {
 		return (char) (((buffer [0] & 0xFF) << 8) | (buffer [1] & 0xFF));
 	}
 	return 0;
@@ -3966,33 +3997,33 @@
 
 int /*long*/ windowProc (int /*long*/ handle, int /*long*/ user_data) {
 	Widget widget = getWidget (handle);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.windowProc (handle, user_data);
 }
 
 int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
 	Widget widget = getWidget (handle);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.windowProc (handle, arg0, user_data);
 }
 
 int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) {
 	Widget widget = getWidget (handle);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.windowProc (handle, arg0, arg1, user_data);
 }
 
 int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) {
 	Widget widget = getWidget (handle);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.windowProc (handle, arg0, arg1, arg2, user_data);
 }
 
 int /*long*/ windowTimerProc (int /*long*/ handle) {
 	Widget widget = getWidget (handle);
-	if (widget == null) return 0;
+	if (widget is null) return 0;
 	return widget.timerProc (handle);
 }
 
 }
-++++/
\ No newline at end of file
+++/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/EventTable.d	Tue Jan 08 01:23:25 2008 +0100
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.EventTable;
+
+class EventTable{}
+/+++
+import dwt.*;
+import dwt.internal.SWTEventListener;
+
+/**
+ * Instances of this class implement a simple
+ * look up mechanism that maps an event type
+ * to a listener.  Multiple listeners for the
+ * same event type are supported.
+ */
+
+class EventTable {
+	int [] types;
+	Listener [] listeners;
+	int level;
+
+public void hook (int eventType, Listener listener) {
+	if (types == null) types = new int [4];
+	if (listeners == null) listeners = new Listener [4];
+	int length = types.length, index = length - 1;
+	while (index >= 0) {
+		if (types [index] != 0) break;
+		--index;
+	}
+	index++;
+	if (index == length) {
+		int [] newTypes = new int [length + 4];
+		System.arraycopy (types, 0, newTypes, 0, length);
+		types = newTypes;
+		Listener [] newListeners = new Listener [length + 4];
+		System.arraycopy (listeners, 0, newListeners, 0, length);
+		listeners = newListeners;
+	}
+	types [index] = eventType;
+	listeners [index] = listener;
+}
+
+public boolean hooks (int eventType) {
+	if (types == null) return false;
+	for (int i=0; i<types.length; i++) {
+		if (types [i] == eventType) return true;
+	}
+	return false;
+}
+
+public void sendEvent (Event event) {
+	if (types == null) return;
+	level += level >= 0 ? 1 : -1;
+	try {
+		for (int i=0; i<types.length; i++) {
+			if (event.type == SWT.None) return;
+			if (types [i] == event.type) {
+				Listener listener = listeners [i];
+				if (listener != null) listener.handleEvent (event);
+			}
+		}
+	} finally {
+		boolean compact = level < 0;
+		level -= level >= 0 ? 1 : -1;
+		if (compact && level == 0) {
+			int index = 0;
+			for (int i=0; i<types.length; i++) {
+				if (types [i] != 0) {
+					types [index] = types [i];
+					listeners [index] = listeners [i];
+					index++;
+				}
+			}
+			for (int i=index; i<types.length; i++) {
+				types [i] = 0;
+				listeners [i] = null;
+			}
+		}
+	}
+}
+
+public int size () {
+	if (types == null) return 0;
+	int count = 0;
+	for (int i=0; i<types.length; i++) {
+		if (types [i] != 0) count++;
+	}
+	return count;
+}
+
+void remove (int index) {
+	if (level == 0) {
+		int end = types.length - 1;
+		System.arraycopy (types, index + 1, types, index, end - index);
+		System.arraycopy (listeners, index + 1, listeners, index, end - index);
+		index = end;
+	} else {
+		if (level > 0) level = -level;
+	}
+	types [index] = 0;
+	listeners [index] = null;
+}
+
+public void unhook (int eventType, Listener listener) {
+	if (types == null) return;
+	for (int i=0; i<types.length; i++) {
+		if (types [i] == eventType && listeners [i] == listener) {
+			remove (i);
+			return;
+		}
+	}
+}
+
+public void unhook (int eventType, SWTEventListener listener) {
+	if (types == null) return;
+	for (int i=0; i<types.length; i++) {
+		if (types [i] == eventType) {
+			if (listeners [i] instanceof TypedListener) {
+				TypedListener typedListener = (TypedListener) listeners [i];
+				if (typedListener.getEventListener () == listener) {
+					remove (i);
+					return;
+				}
+			}
+		}
+	}
+}
+
+}
++++/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/Listener.d	Tue Jan 08 01:23:25 2008 +0100
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.Listener;
+
+import dwt.widgets.Event;
+
+/**
+ * Implementers of <code>Listener</code> provide a simple
+ * <code>handleEvent()</code> method that is used internally
+ * by SWT to dispatch events.
+ * <p>
+ * After creating an instance of a class that implements this interface
+ * it can be added to a widget using the
+ * <code>addListener(int eventType, Listener handler)</code> method and
+ * removed using the
+ * <code>removeListener (int eventType, Listener handler)</code> method.
+ * When the specified event occurs, <code>handleEvent(...)</code> will
+ * be sent to the instance.
+ * </p>
+ * <p>
+ * Classes which implement this interface are described within SWT as
+ * providing the <em>untyped listener</em> API. Typically, widgets will
+ * also provide a higher-level <em>typed listener</em> API, that is based
+ * on the standard <code>java.util.EventListener</code> pattern.
+ * </p>
+ * <p>
+ * Note that, since all internal SWT event dispatching is based on untyped
+ * listeners, it is simple to build subsets of SWT for use on memory
+ * constrained, small footprint devices, by removing the classes and
+ * methods which implement the typed listener API.
+ * </p>
+ *
+ * @see Widget#addListener
+ * @see java.util.EventListener
+ * @see dwt.events
+ */
+public interface Listener {
+
+/**
+ * Sent when an event that the receiver has registered for occurs.
+ *
+ * @param event the event which occurred
+ */
+void handleEvent (Event event);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/Menu.d	Tue Jan 08 01:23:25 2008 +0100
@@ -0,0 +1,952 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.Menu;
+
+class Menu{}
+
+/+++
+import dwt.internal.*;
+import dwt.internal.gtk.*;
+import dwt.*;
+import dwt.events.*;
+import dwt.graphics.*;
+
+/**
+ * Instances of this class are user interface objects that contain
+ * menu items.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>BAR, DROP_DOWN, POP_UP, NO_RADIO_GROUP</dd>
+ * <dd>LEFT_TO_RIGHT, RIGHT_TO_LEFT</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Help, Hide, Show </dd>
+ * </dl>
+ * <p>
+ * Note: Only one of BAR, DROP_DOWN and POP_UP may be specified.
+ * Only one of LEFT_TO_RIGHT or RIGHT_TO_LEFT may be specified.
+ * </p><p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class Menu extends Widget {
+	int x, y;
+	boolean hasLocation;
+	MenuItem cascade, selectedItem;
+	Decorations parent;
+	int /*long*/ imItem, imSeparator, imHandle;
+	ImageList imageList;
+
+/**
+ * Constructs a new instance of this class given its parent,
+ * and sets the style for the instance so that the instance
+ * will be a popup menu on the given parent's shell.
+ *
+ * @param parent a control which will be the parent of the new instance (cannot be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT#POP_UP
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Menu (Control parent) {
+	this (checkNull (parent).menuShell (), SWT.POP_UP);
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Decorations</code>) and a style value
+ * describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * lists the style constants that are applicable to the class.
+ * Style bits are also inherited from superclasses.
+ * </p>
+ *
+ * @param parent a decorations control which will be the parent of the new instance (cannot be null)
+ * @param style the style of menu to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT#BAR
+ * @see SWT#DROP_DOWN
+ * @see SWT#POP_UP
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Menu (Decorations parent, int style) {
+	super (parent, checkStyle (style));
+	this.parent = parent;
+	createWidget (0);
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Menu</code>) and sets the style
+ * for the instance so that the instance will be a drop-down
+ * menu on the given parent's parent.
+ *
+ * @param parentMenu a menu which will be the parent of the new instance (cannot be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT#DROP_DOWN
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Menu (Menu parentMenu) {
+	this (checkNull (parentMenu).parent, SWT.DROP_DOWN);
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>MenuItem</code>) and sets the style
+ * for the instance so that the instance will be a drop-down
+ * menu on the given parent's parent menu.
+ *
+ * @param parentItem a menu item which will be the parent of the new instance (cannot be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT#DROP_DOWN
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Menu (MenuItem parentItem) {
+	this (checkNull (parentItem).parent);
+}
+
+static Control checkNull (Control control) {
+	if (control == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+	return control;
+}
+
+static Menu checkNull (Menu menu) {
+	if (menu == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+	return menu;
+}
+
+static MenuItem checkNull (MenuItem item) {
+	if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+	return item;
+}
+
+static int checkStyle (int style) {
+	return checkBits (style, SWT.POP_UP, SWT.BAR, SWT.DROP_DOWN, 0, 0, 0);
+}
+
+void _setVisible (boolean visible) {
+	if (visible == OS.GTK_WIDGET_MAPPED (handle)) return;
+	if (visible) {
+		sendEvent (SWT.Show);
+		if (getItemCount () != 0) {
+			if ((OS.GTK_VERSION >=  OS.VERSION (2, 8, 0))) {
+				OS.gtk_menu_shell_set_take_focus (handle, false);
+			}
+			int /*long*/ address = hasLocation ? display.menuPositionProc: 0;
+			/*
+			* Bug in GTK.  The timestamp passed into gtk_menu_popup is used
+			* to perform an X pointer grab.  It cannot be zero, else the grab
+			* will fail.  The fix is to ensure that the timestamp of the last
+			* event processed is used.
+			*/
+			OS.gtk_menu_popup (handle, 0, 0, address, 0, 0, display.getLastEventTime ());
+		} else {
+			sendEvent (SWT.Hide);
+		}
+	} else {
+		OS.gtk_menu_popdown (handle);
+	}
+}
+
+void addAccelerators (int /*long*/ accelGroup) {
+	MenuItem [] items = getItems ();
+	for (int i = 0; i < items.length; i++) {
+		MenuItem item = items[i];
+		item.addAccelerators (accelGroup);
+	}
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when menus are hidden or shown, by sending it
+ * one of the messages defined in the <code>MenuListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MenuListener
+ * @see #removeMenuListener
+ */
+public void addMenuListener (MenuListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener (SWT.Hide,typedListener);
+	addListener (SWT.Show,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when help events are generated for the control,
+ * by sending it one of the messages defined in the
+ * <code>HelpListener</code> interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #removeHelpListener
+ */
+public void addHelpListener (HelpListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener (SWT.Help, typedListener);
+}
+
+void createHandle (int index) {
+	state |= HANDLE;
+	if ((style & SWT.BAR) != 0) {
+		handle = OS.gtk_menu_bar_new ();
+		if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+		int /*long*/ vboxHandle = parent.vboxHandle;
+		OS.gtk_container_add (vboxHandle, handle);
+		OS.gtk_box_set_child_packing (vboxHandle, handle, false, true, 0, OS.GTK_PACK_START);
+	} else {
+		handle = OS.gtk_menu_new ();
+		if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+	}
+}
+
+void createIMMenu (int /*long*/ imHandle) {
+	if (this.imHandle == imHandle) return;
+	this.imHandle = imHandle;
+	if (imHandle == 0) {
+		if (imItem != 0) {
+			OS.gtk_widget_destroy (imItem);
+			imItem = 0;
+		}
+		if (imSeparator != 0) {
+			OS.gtk_widget_destroy (imSeparator);
+			imSeparator = 0;
+		}
+		return;
+	}
+	if (imSeparator == 0) {
+		imSeparator = OS.gtk_separator_menu_item_new ();
+		OS.gtk_widget_show (imSeparator);
+		OS.gtk_menu_shell_insert (handle, imSeparator, -1);
+	}
+	if (imItem == 0) {
+		byte[] buffer = Converter.wcsToMbcs (null, SWT.getMessage("SWT_InputMethods"), true);
+		imItem = OS.gtk_image_menu_item_new_with_label (buffer);
+		OS.gtk_widget_show (imItem);
+		OS.gtk_menu_shell_insert (handle, imItem, -1);
+	}
+	int /*long*/ imSubmenu = OS.gtk_menu_new ();
+	OS.gtk_im_multicontext_append_menuitems (imHandle, imSubmenu);
+	OS.gtk_menu_item_set_submenu (imItem, imSubmenu);
+}
+
+void createWidget (int index) {
+	checkOrientation (parent);
+	super.createWidget (index);
+	parent.addMenu (this);
+}
+
+void fixMenus (Decorations newParent) {
+	MenuItem [] items = getItems ();
+	for (int i=0; i<items.length; i++) {
+		items [i].fixMenus (newParent);
+	}
+	parent.removeMenu (this);
+	newParent.addMenu (this);
+	this.parent = newParent;
+}
+
+/*public*/ Rectangle getBounds () {
+	checkWidget();
+	if (!OS.GTK_WIDGET_MAPPED (handle)) {
+		return new Rectangle (0, 0, 0, 0);
+	}
+	int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle);
+	int [] origin_x = new int [1], origin_y = new int [1];
+	OS.gdk_window_get_origin (window, origin_x, origin_y);
+	int x = origin_x [0] + OS.GTK_WIDGET_X (handle);
+	int y = origin_y [0] + OS.GTK_WIDGET_Y (handle);
+	int width = OS.GTK_WIDGET_WIDTH (handle);
+	int height = OS.GTK_WIDGET_HEIGHT (handle);
+	return new Rectangle (x, y, width, height);
+}
+
+/**
+ * Returns the default menu item or null if none has
+ * been previously set.
+ *
+ * @return the default menu item.
+ *
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem getDefaultItem () {
+	checkWidget();
+	return null;
+}
+
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled menu is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #isEnabled
+ */
+public boolean getEnabled () {
+	checkWidget();
+	return OS.GTK_WIDGET_SENSITIVE (handle);
+}
+
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem getItem (int index) {
+	checkWidget();
+	int /*long*/ list = OS.gtk_container_get_children (handle);
+	if (list == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
+	int count = OS.g_list_length (list);
+	if (imSeparator != 0) count--;
+	if (imItem != 0) count--;
+	if (!(0 <= index && index < count)) error (SWT.ERROR_INVALID_RANGE);
+	int /*long*/ data = OS.g_list_nth_data (list, index);
+	OS.g_list_free (list);
+	if (data == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
+	return (MenuItem) display.getWidget (data);
+}
+
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+	checkWidget();
+	int /*long*/ list = OS.gtk_container_get_children (handle);
+	if (list == 0) return 0;
+	int count = OS.g_list_length (list);
+	OS.g_list_free (list);
+	if (imSeparator != 0) count--;
+	if (imItem != 0) count--;
+	return count;
+}
+
+/**
+ * Returns a (possibly empty) array of <code>MenuItem</code>s which
+ * are the items in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem [] getItems () {
+	checkWidget();
+	int /*long*/ list = OS.gtk_container_get_children (handle);
+	if (list == 0) return new MenuItem [0];
+	int count = OS.g_list_length (list);
+	if (imSeparator != 0) count--;
+	if (imItem != 0) count--;
+	MenuItem [] items = new MenuItem [count];
+	int index = 0;
+	for (int i=0; i<count; i++) {
+		int /*long*/ data = OS.g_list_nth_data (list, i);
+		MenuItem item = (MenuItem) display.getWidget (data);
+		if (item != null) items [index++] = item;
+	}
+	OS.g_list_free (list);
+	if (index != items.length) {
+		MenuItem [] newItems = new MenuItem[index];
+		System.arraycopy(items, 0, newItems, 0, index);
+		items = newItems;
+	}
+	return items;
+}
+
+String getNameText () {
+	String result = "";
+	MenuItem [] items = getItems ();
+	int length = items.length;
+	if (length > 0) {
+		for (int i=0; i<length-1; i++) {
+			result = result + items [i].getNameText() + ", ";
+		}
+		result = result + items [length-1].getNameText ();
+	}
+	return result;
+}
+
+/**
+ * Returns the receiver's parent, which must be a <code>Decorations</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Decorations getParent () {
+	checkWidget();
+	return parent;
+}
+
+/**
+ * Returns the receiver's parent item, which must be a
+ * <code>MenuItem</code> or null when the receiver is a
+ * root.
+ *
+ * @return the receiver's parent item
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem getParentItem () {
+	checkWidget();
+	return cascade;
+}
+
+/**
+ * Returns the receiver's parent item, which must be a
+ * <code>Menu</code> or null when the receiver is a
+ * root.
+ *
+ * @return the receiver's parent item
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getParentMenu () {
+	checkWidget();
+	if (cascade == null) return null;
+	return cascade.getParent ();
+}
+
+/**
+ * Returns the receiver's shell. For all controls other than
+ * shells, this simply returns the control's nearest ancestor
+ * shell. Shells return themselves, even if they are children
+ * of other shells.
+ *
+ * @return the receiver's shell
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getParent
+ */
+public Shell getShell () {
+	checkWidget();
+	return parent.getShell ();
+}
+
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getVisible () {
+	checkWidget();
+	if ((style & SWT.POP_UP) != 0) {
+		Menu [] popups = display.popups;
+		if (popups != null) {
+			for (int i=0; i<popups.length; i++) {
+				if (popups [i] == this) return true;
+			}
+		}
+	}
+	return OS.GTK_WIDGET_MAPPED (handle);
+}
+
+int /*long*/ gtk_hide (int /*long*/ widget) {
+	if ((style & SWT.POP_UP) != 0) {
+		display.activeShell = getShell ();
+	}
+	if (OS.GTK_VERSION >= OS.VERSION (2, 6, 0)) {
+		sendEvent (SWT.Hide);
+	} else {
+		/*
+		* Bug in GTK.  In GTK 2.4 and earlier
+		* a crash could occur if a menu item
+		* was disposed within gtk_hide.  The
+		* workaroud is to post the event instead
+		* of send it on these platforms
+		*/
+		postEvent (SWT.Hide);
+	}
+	return 0;
+}
+
+int /*long*/ gtk_show (int /*long*/ widget) {
+	if ((style & SWT.POP_UP) != 0) {
+		display.activeShell = getShell ();
+		return 0;
+	}
+	sendEvent (SWT.Show);
+	return 0;
+}
+
+
+int /*long*/ gtk_show_help (int /*long*/ widget, int /*long*/ helpType) {
+	if (sendHelpEvent (helpType)) {
+		OS.gtk_menu_shell_deactivate (handle);
+		return 1;
+	}
+	return 0;
+}
+
+void hookEvents () {
+	super.hookEvents ();
+	OS.g_signal_connect_closure_by_id (handle, display.signalIds [SHOW], 0, display.closures [SHOW], false);
+	OS.g_signal_connect_closure_by_id (handle, display.signalIds [HIDE], 0, display.closures [HIDE], false);
+	OS.g_signal_connect_closure_by_id (handle, display.signalIds [SHOW_HELP], 0, display.closures [SHOW_HELP], false);
+}
+
+/**
+ * Searches the receiver's list starting at the first item
+ * (index 0) until an item is found that is equal to the
+ * argument, and returns the index of that item. If no item
+ * is found, returns -1.
+ *
+ * @param item the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the item is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (MenuItem item) {
+	checkWidget();
+	if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+	MenuItem [] items = getItems ();
+	for (int i=0; i<items.length; i++) {
+		if (items [i] == item) return i;
+	}
+	return -1;
+}
+
+/**
+ * Returns <code>true</code> if the receiver is enabled and all
+ * of the receiver's ancestors are enabled, and <code>false</code>
+ * otherwise. A disabled menu is typically not selectable from the
+ * user interface and draws with an inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getEnabled
+ */
+public boolean isEnabled () {
+	checkWidget();
+	Menu parentMenu = getParentMenu ();
+	if (parentMenu == null) {
+		return getEnabled () && parent.isEnabled ();
+	}
+	return getEnabled () && parentMenu.isEnabled ();
+}
+
+/**
+ * Returns <code>true</code> if the receiver is visible and all
+ * of the receiver's ancestors are visible and <code>false</code>
+ * otherwise.
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getVisible
+ */
+public boolean isVisible () {
+	checkWidget();
+	return getVisible ();
+}
+
+int /*long*/ menuPositionProc (int /*long*/ menu, int /*long*/ x, int /*long*/ y, int /*long*/ push_in, int /*long*/ user_data) {
+	/*
+	* Feature in GTK.  The menu position function sets the position of the
+	* top-left pixel of the menu.  If the menu would be off-screen, GTK will
+	* add a scroll arrow at the bottom and position the first menu entry at
+	* the specified position.  The fix is to flip the menu location to be
+	* completely inside the screen.
+	*
+	* NOTE: This code doesn't work for multiple monitors.
+	*/
+    GtkRequisition requisition = new GtkRequisition ();
+    OS.gtk_widget_size_request (menu, requisition);
+    int screenHeight = OS.gdk_screen_height ();
+	int reqy = this.y;
+	if (reqy + requisition.height > screenHeight && reqy - requisition.height >= 0) {
+    	reqy -= requisition.height;
+    }
+    int screenWidth = OS.gdk_screen_width ();
+	int reqx = this.x;
+    if ((style & SWT.RIGHT_TO_LEFT) != 0) {
+    	if (reqx - requisition.width >= 0) reqx -= requisition.width;
+    } else {
+    	if (reqx + requisition.width > screenWidth) reqx -= requisition.width;
+    }
+	if (x != 0) OS.memmove (x, new int [] {reqx}, 4);
+	if (y != 0) OS.memmove (y, new int [] {reqy}, 4);
+	if (push_in != 0) OS.memmove (push_in, new int [] {1}, 4);
+	return 0;
+}
+
+void releaseChildren (boolean destroy) {
+	MenuItem [] items = getItems ();
+	for (int i=0; i<items.length; i++) {
+		MenuItem item = items [i];
+		if (item != null && !item.isDisposed ()) {
+			item.release (false);
+		}
+	}
+	super.releaseChildren (destroy);
+}
+
+void releaseParent () {
+	super.releaseParent ();
+	if (cascade != null) cascade.setMenu (null);
+	if ((style & SWT.BAR) != 0 && this == parent.menuBar) {
+		parent.setMenuBar (null);
+	}  else {
+		if ((style & SWT.POP_UP) != 0) {
+			display.removePopup (this);
+		}
+	}
+}
+
+void releaseWidget () {
+	super.releaseWidget ();
+	if (parent != null) parent.removeMenu (this);
+	parent = null;
+	cascade = null;
+	imItem = imSeparator = imHandle = 0;
+	if (imageList != null) imageList.dispose ();
+	imageList = null;
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the menu events are generated for the control.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MenuListener
+ * @see #addMenuListener
+ */
+public void removeMenuListener (MenuListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.Hide, listener);
+	eventTable.unhook (SWT.Show, listener);
+}
+
+void removeAccelerators (int /*long*/ accelGroup) {
+	MenuItem [] items = getItems ();
+	for (int i = 0; i < items.length; i++) {
+		MenuItem item = items[i];
+		item.removeAccelerators (accelGroup);
+	}
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the help events are generated for the control.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #addHelpListener
+ */
+public void removeHelpListener (HelpListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.Help, listener);
+}
+
+boolean sendHelpEvent (int /*long*/ helpType) {
+	if (selectedItem != null && !selectedItem.isDisposed()) {
+		if (selectedItem.hooks (SWT.Help)) {
+			selectedItem.postEvent (SWT.Help);
+			return true;
+		}
+	}
+	if (hooks (SWT.Help)) {
+		postEvent (SWT.Help);
+		return true;
+	}
+	return parent.sendHelpEvent (helpType);
+}
+
+/**
+ * Sets the default menu item to the argument or removes
+ * the default emphasis when the argument is <code>null</code>.
+ *
+ * @param item the default menu item or null
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setDefaultItem (MenuItem item) {
+	checkWidget();
+}
+
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise. A disabled menu is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+	checkWidget();
+	if (enabled) {
+		OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_SENSITIVE);
+	} else {
+		OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_SENSITIVE);
+	}
+}
+
+/**
+ * Sets the location of the receiver, which must be a popup,
+ * to the point specified by the arguments which are relative
+ * to the display.
+ * <p>
+ * Note that this is different from most widgets where the
+ * location of the widget is relative to the parent.
+ * </p><p>
+ * Note that the platform window manager ultimately has control
+ * over the location of popup menus.
+ * </p>
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (int x, int y) {
+	checkWidget();
+	if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
+	this.x = x;
+	this.y = y;
+	hasLocation = true;
+}
+
+/**
+ * Sets the location of the receiver, which must be a popup,
+ * to the point specified by the argument which is relative
+ * to the display.
+ * <p>
+ * Note that this is different from most widgets where the
+ * location of the widget is relative to the parent.
+ * </p><p>
+ * Note that the platform window manager ultimately has control
+ * over the location of popup menus.
+ * </p>
+ *
+ * @param location the new location for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 2.1
+ */
+public void setLocation (Point location) {
+	checkWidget();
+	if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
+	setLocation (location.x, location.y);
+}
+
+void setOrientation() {
+	if ((parent.style & SWT.RIGHT_TO_LEFT) != 0) {
+		if (handle != 0) OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
+	}
+}
+
+/**
+ * Marks the receiver as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setVisible (boolean visible) {
+	checkWidget();
+	if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
+	if (visible) {
+		display.addPopup (this);
+	} else {
+		display.removePopup (this);
+		_setVisible (false);
+	}
+}
+}
++++/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/Monitor.d	Tue Jan 08 01:23:25 2008 +0100
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.Monitor;
+
+import dwt.graphics.Rectangle;
+
+/**
+ * Instances of this class are descriptions of monitors.
+ *
+ * @see Display
+ *
+ * @since 3.0
+ */
+public final class Monitor {
+	int handle;
+	int x, y, width, height;
+	int clientX, clientY, clientWidth, clientHeight;
+
+/**
+ * Prevents uninitialized instances from being created outside the package.
+ */
+this () {
+}
+
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode()
+ */
+public override int opEquals (Object object) {
+	if (object is this) return true;
+	if ( auto mon = cast(dwt.widgets.Monitor.Monitor)object ){
+	   return handle is mon.handle;
+    }
+    return false;
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its device.
+ *
+ * @return the receiver's bounding rectangle
+ */
+public Rectangle getBounds () {
+	return new Rectangle (x, y, width, height);
+}
+
+/**
+ * Returns a rectangle which describes the area of the
+ * receiver which is capable of displaying data.
+ *
+ * @return the client area
+ */
+public Rectangle getClientArea () {
+	return new Rectangle (clientX, clientY, clientWidth, clientHeight);
+}
+
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals(Object)
+ */
+public override hash_t toHash() {
+	return cast(hash_t)handle;
+}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/Shell.d	Tue Jan 08 01:23:25 2008 +0100
@@ -0,0 +1,1788 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.Shell;
+
+class Shell{}
+
+/++
+import dwt.*;
+import dwt.internal.*;
+import dwt.internal.gtk.*;
+import dwt.graphics.*;
+import dwt.events.*;
+
+/**
+ * Instances of this class represent the "windows"
+ * which the desktop or "window manager" is managing.
+ * Instances that do not have a parent (that is, they
+ * are built using the constructor, which takes a
+ * <code>Display</code> as the argument) are described
+ * as <em>top level</em> shells. Instances that do have
+ * a parent are described as <em>secondary</em> or
+ * <em>dialog</em> shells.
+ * <p>
+ * Instances are always displayed in one of the maximized,
+ * minimized or normal states:
+ * <ul>
+ * <li>
+ * When an instance is marked as <em>maximized</em>, the
+ * window manager will typically resize it to fill the
+ * entire visible area of the display, and the instance
+ * is usually put in a state where it can not be resized
+ * (even if it has style <code>RESIZE</code>) until it is
+ * no longer maximized.
+ * </li><li>
+ * When an instance is in the <em>normal</em> state (neither
+ * maximized or minimized), its appearance is controlled by
+ * the style constants which were specified when it was created
+ * and the restrictions of the window manager (see below).
+ * </li><li>
+ * When an instance has been marked as <em>minimized</em>,
+ * its contents (client area) will usually not be visible,
+ * and depending on the window manager, it may be
+ * "iconified" (that is, replaced on the desktop by a small
+ * simplified representation of itself), relocated to a
+ * distinguished area of the screen, or hidden. Combinations
+ * of these changes are also possible.
+ * </li>
+ * </ul>
+ * </p><p>
+ * The <em>modality</em> of an instance may be specified using
+ * style bits. The modality style bits are used to determine
+ * whether input is blocked for other shells on the display.
+ * The <code>PRIMARY_MODAL</code> style allows an instance to block
+ * input to its parent. The <code>APPLICATION_MODAL</code> style
+ * allows an instance to block input to every other shell in the
+ * display. The <code>SYSTEM_MODAL</code> style allows an instance
+ * to block input to all shells, including shells belonging to
+ * different applications.
+ * </p><p>
+ * Note: The styles supported by this class are treated
+ * as <em>HINT</em>s, since the window manager for the
+ * desktop on which the instance is visible has ultimate
+ * control over the appearance and behavior of decorations
+ * and modality. For example, some window managers only
+ * support resizable windows and will always assume the
+ * RESIZE style, even if it is not set. In addition, if a
+ * modality style is not supported, it is "upgraded" to a
+ * more restrictive modality style that is supported. For
+ * example, if <code>PRIMARY_MODAL</code> is not supported,
+ * it would be upgraded to <code>APPLICATION_MODAL</code>.
+ * A modality style may also be "downgraded" to a less
+ * restrictive style. For example, most operating systems
+ * no longer support <code>SYSTEM_MODAL</code> because
+ * it can freeze up the desktop, so this is typically
+ * downgraded to <code>APPLICATION_MODAL</code>.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL</dd>
+ * <dd>APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Activate, Close, Deactivate, Deiconify, Iconify</dd>
+ * </dl>
+ * Class <code>SWT</code> provides two "convenience constants"
+ * for the most commonly required style combinations:
+ * <dl>
+ * <dt><code>SHELL_TRIM</code></dt>
+ * <dd>
+ * the result of combining the constants which are required
+ * to produce a typical application top level shell: (that
+ * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
+ * </dd>
+ * <dt><code>DIALOG_TRIM</code></dt>
+ * <dd>
+ * the result of combining the constants which are required
+ * to produce a typical application dialog shell: (that
+ * is, <code>TITLE | CLOSE | BORDER</code>)
+ * </dd>
+ * </dl>
+ * </p>
+ * <p>
+ * Note: Only one of the styles APPLICATION_MODAL, MODELESS,
+ * PRIMARY_MODAL and SYSTEM_MODAL may be specified.
+ * </p><p>
+ * IMPORTANT: This class is not intended to be subclassed.
+ * </p>
+ *
+ * @see Decorations
+ * @see SWT
+ */
+public class Shell extends Decorations {
+	int /*long*/ shellHandle, tooltipsHandle, tooltipWindow;
+	boolean mapped, moved, resized, opened;
+	int oldX, oldY, oldWidth, oldHeight;
+	int minWidth, minHeight;
+	Control lastActive;
+	Region region;
+
+	static final int MAXIMUM_TRIM = 128;
+
+/**
+ * Constructs a new instance of this class. This is equivalent
+ * to calling <code>Shell((Display) null)</code>.
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell () {
+	this ((Display) null);
+}
+/**
+ * Constructs a new instance of this class given only the style
+ * value describing its behavior and appearance. This is equivalent
+ * to calling <code>Shell((Display) null, style)</code>.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * lists the style constants that are applicable to the class.
+ * Style bits are also inherited from superclasses.
+ * </p>
+ *
+ * @param style the style of control to construct
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT#BORDER
+ * @see SWT#CLOSE
+ * @see SWT#MIN
+ * @see SWT#MAX
+ * @see SWT#RESIZE
+ * @see SWT#TITLE
+ * @see SWT#NO_TRIM
+ * @see SWT#SHELL_TRIM
+ * @see SWT#DIALOG_TRIM
+ * @see SWT#MODELESS
+ * @see SWT#PRIMARY_MODAL
+ * @see SWT#APPLICATION_MODAL
+ * @see SWT#SYSTEM_MODAL
+ */
+public Shell (int style) {
+	this ((Display) null, style);
+}
+
+/**
+ * Constructs a new instance of this class given only the display
+ * to create it on. It is created with style <code>SWT.SHELL_TRIM</code>.
+ * <p>
+ * Note: Currently, null can be passed in for the display argument.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the display argument is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param display the display to create the shell on
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (Display display) {
+	this (display, SWT.SHELL_TRIM);
+}
+/**
+ * Constructs a new instance of this class given the display
+ * to create it on and a style value describing its behavior
+ * and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * lists the style constants that are applicable to the class.
+ * Style bits are also inherited from superclasses.
+ * </p><p>
+ * Note: Currently, null can be passed in for the display argument.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the display argument is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param display the display to create the shell on
+ * @param style the style of control to construct
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT#BORDER
+ * @see SWT#CLOSE
+ * @see SWT#MIN
+ * @see SWT#MAX
+ * @see SWT#RESIZE
+ * @see SWT#TITLE
+ * @see SWT#NO_TRIM
+ * @see SWT#SHELL_TRIM
+ * @see SWT#DIALOG_TRIM
+ * @see SWT#MODELESS
+ * @see SWT#PRIMARY_MODAL
+ * @see SWT#APPLICATION_MODAL
+ * @see SWT#SYSTEM_MODAL
+ */
+public Shell (Display display, int style) {
+	this (display, null, style, 0, false);
+}
+
+Shell (Display display, Shell parent, int style, int /*long*/ handle, boolean embedded) {
+	super ();
+	checkSubclass ();
+	if (display == null) display = Display.getCurrent ();
+	if (display == null) display = Display.getDefault ();
+	if (!display.isValidThread ()) {
+		error (SWT.ERROR_THREAD_INVALID_ACCESS);
+	}
+	if (parent != null && parent.isDisposed ()) {
+		error (SWT.ERROR_INVALID_ARGUMENT);
+	}
+	this.style = checkStyle (style);
+	this.parent = parent;
+	this.display = display;
+	if (handle != 0) {
+		if (embedded) {
+			this.handle = handle;
+		} else {
+			shellHandle = handle;
+			state |= FOREIGN_HANDLE;
+		}
+	}
+	createWidget (0);
+}
+
+/**
+ * Constructs a new instance of this class given only its
+ * parent. It is created with style <code>SWT.DIALOG_TRIM</code>.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (Shell parent) {
+	this (parent, SWT.DIALOG_TRIM);
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * lists the style constants that are applicable to the class.
+ * Style bits are also inherited from superclasses.
+ * </p><p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT#BORDER
+ * @see SWT#CLOSE
+ * @see SWT#MIN
+ * @see SWT#MAX
+ * @see SWT#RESIZE
+ * @see SWT#TITLE
+ * @see SWT#NO_TRIM
+ * @see SWT#SHELL_TRIM
+ * @see SWT#DIALOG_TRIM
+ * @see SWT#ON_TOP
+ * @see SWT#TOOL
+ * @see SWT#MODELESS
+ * @see SWT#PRIMARY_MODAL
+ * @see SWT#APPLICATION_MODAL
+ * @see SWT#SYSTEM_MODAL
+ */
+public Shell (Shell parent, int style) {
+	this (parent != null ? parent.display : null, parent, style, 0, false);
+}
+
+public static Shell gtk_new (Display display, int /*long*/ handle) {
+	return new Shell (display, null, SWT.NO_TRIM, handle, true);
+}
+
+public static Shell internal_new (Display display, int /*long*/ handle) {
+	return new Shell (display, null, SWT.NO_TRIM, handle, false);
+}
+
+static int checkStyle (int style) {
+	style = Decorations.checkStyle (style);
+	if ((style & SWT.ON_TOP) != 0) style &= ~SWT.SHELL_TRIM;
+	int mask = SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL;
+	int bits = style & ~mask;
+	if ((style & SWT.SYSTEM_MODAL) != 0) return bits | SWT.SYSTEM_MODAL;
+	if ((style & SWT.APPLICATION_MODAL) != 0) return bits | SWT.APPLICATION_MODAL;
+	if ((style & SWT.PRIMARY_MODAL) != 0) return bits | SWT.PRIMARY_MODAL;
+	return bits;
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when operations are performed on the receiver,
+ * by sending the listener one of the messages defined in the
+ * <code>ShellListener</code> interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ShellListener
+ * @see #removeShellListener
+ */
+public void addShellListener (ShellListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener (SWT.Close,typedListener);
+	addListener (SWT.Iconify,typedListener);
+	addListener (SWT.Deiconify,typedListener);
+	addListener (SWT.Activate, typedListener);
+	addListener (SWT.Deactivate, typedListener);
+}
+
+void adjustTrim () {
+	if (display.ignoreTrim) return;
+	int width = OS.GTK_WIDGET_WIDTH (shellHandle);
+	int height = OS.GTK_WIDGET_HEIGHT (shellHandle);
+	int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle);
+	GdkRectangle rect = new GdkRectangle ();
+	OS.gdk_window_get_frame_extents (window, rect);
+	int trimWidth = Math.max (0, rect.width - width);
+	int trimHeight = Math.max (0, rect.height - height);
+	/*
+	* Bug in GTK.  gdk_window_get_frame_extents() fails for various window
+	* managers, causing a large incorrect value to be returned as the trim.
+	* The fix is to ignore the returned trim values if they are too large.
+	*/
+	if (trimWidth > MAXIMUM_TRIM || trimHeight > MAXIMUM_TRIM) {
+		display.ignoreTrim = true;
+		return;
+	}
+	boolean hasTitle = false, hasResize = false, hasBorder = false;
+	if ((style & SWT.NO_TRIM) == 0) {
+		hasTitle = (style & (SWT.MIN | SWT.MAX | SWT.TITLE | SWT.MENU)) != 0;
+		hasResize = (style & SWT.RESIZE) != 0;
+		hasBorder = (style & SWT.BORDER) != 0;
+	}
+	if (hasTitle) {
+		if (hasResize)  {
+			display.titleResizeTrimWidth = trimWidth;
+			display.titleResizeTrimHeight = trimHeight;
+			return;
+		}
+		if (hasBorder) {
+			display.titleBorderTrimWidth = trimWidth;
+			display.titleBorderTrimHeight = trimHeight;
+			return;
+		}
+		display.titleTrimWidth = trimWidth;
+		display.titleTrimHeight = trimHeight;
+		return;
+	}
+	if (hasResize) {
+		display.resizeTrimWidth = trimWidth;
+		display.resizeTrimHeight = trimHeight;
+		return;
+	}
+	if (hasBorder) {
+		display.borderTrimWidth = trimWidth;
+		display.borderTrimHeight = trimHeight;
+		return;
+	}
+}
+
+void bringToTop (boolean force) {
+	if (!OS.GTK_WIDGET_VISIBLE (shellHandle)) return;
+	Display display = this.display;
+	Shell activeShell = display.activeShell;
+	if (activeShell == this) return;
+	if (!force) {
+		if (activeShell == null) return;
+		if (!display.activePending) {
+			int /*long*/ focusHandle = OS.gtk_window_get_focus (activeShell.shellHandle);
+			if (focusHandle != 0 && !OS.GTK_WIDGET_HAS_FOCUS (focusHandle)) return;
+		}
+	}
+	/*
+	* Bug in GTK.  When a shell that is not managed by the window
+	* manage is given focus, GTK gets stuck in "focus follows pointer"
+	* mode when the pointer is within the shell and its parent when
+	* the shell is hidden or disposed. The fix is to use XSetInputFocus()
+	* to assign focus when ever the active shell has not managed by
+	* the window manager.
+	*
+	* NOTE: This bug is fixed in GTK+ 2.6.8 and above.
+	*/
+	boolean xFocus = false;
+	if (activeShell != null) {
+		if (OS.GTK_VERSION < OS.VERSION (2, 6, 8)) {
+			xFocus = activeShell.isUndecorated ();
+		}
+		display.activeShell = null;
+		display.activePending = true;
+	}
+	/*
+	* Feature in GTK.  When the shell is an override redirect
+	* window, gdk_window_focus() does not give focus to the
+	* window.  The fix is to use XSetInputFocus() to force
+	* the focus.
+	*/
+	int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle);
+	if ((xFocus || (style & SWT.ON_TOP) != 0) && OS.GDK_WINDOWING_X11 ()) {
+		int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window);
+		int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (window);
+		OS.gdk_error_trap_push ();
+		/* Use CurrentTime instead of the last event time to ensure that the shell becomes active */
+		OS.XSetInputFocus (xDisplay, xWindow, OS.RevertToParent, OS.CurrentTime);
+		OS.gdk_error_trap_pop ();
+	} else {
+		/*
+		* Bug in metacity.  Calling gdk_window_focus() with a timestamp more
+		* recent than the last user interaction time can cause windows not
+		* to come forward in versions > 2.10.0.  The fix is to use the last
+		* user event time.
+		*/
+		if (display.windowManager.toLowerCase ().equals ("metacity")) {
+			OS.gdk_window_focus (window, display.lastUserEventTime);
+		} else {
+			OS.gdk_window_focus (window, OS.GDK_CURRENT_TIME);
+		}
+	}
+	display.activeShell = this;
+	display.activePending = true;
+}
+
+void checkBorder () {
+	/* Do nothing */
+}
+
+void checkOpen () {
+	if (!opened) resized = false;
+}
+
+int /*long*/ childStyle () {
+	return 0;
+}
+
+/**
+ * Requests that the window manager close the receiver in
+ * the same way it would be closed when the user clicks on
+ * the "close box" or performs some other platform specific
+ * key or mouse combination that indicates the window
+ * should be removed.
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SWT#Close
+ * @see #dispose
+ */
+public void close () {
+	checkWidget ();
+	closeWidget ();
+}
+void closeWidget () {
+	Event event = new Event ();
+	sendEvent (SWT.Close, event);
+	if (event.doit && !isDisposed ()) dispose ();
+}
+
+public Rectangle computeTrim (int x, int y, int width, int height) {
+	checkWidget();
+	Rectangle trim = super.computeTrim (x, y, width, height);
+	int border = 0;
+	if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) == 0) {
+		border = OS.gtk_container_get_border_width (shellHandle);
+	}
+	int trimWidth = trimWidth (), trimHeight = trimHeight ();
+	trim.x -= (trimWidth / 2) + border;
+	trim.y -= trimHeight - (trimWidth / 2) + border;
+	trim.width += trimWidth + border * 2;
+	trim.height += trimHeight + border * 2;
+	if (menuBar != null) {
+		forceResize ();
+		int menuBarHeight = OS.GTK_WIDGET_HEIGHT (menuBar.handle);
+		trim.y -= menuBarHeight;
+		trim.height += menuBarHeight;
+	}
+	return trim;
+}
+
+void createHandle (int index) {
+	state |= HANDLE | CANVAS;
+	if (shellHandle == 0) {
+		if (handle == 0) {
+			int type = OS.GTK_WINDOW_TOPLEVEL;
+			if ((style & SWT.ON_TOP) != 0) type = OS.GTK_WINDOW_POPUP;
+			shellHandle = OS.gtk_window_new (type);
+		} else {
+			shellHandle = OS.gtk_plug_new (handle);
+		}
+		if (shellHandle == 0) error (SWT.ERROR_NO_HANDLES);
+		if (parent != null) {
+			OS.gtk_window_set_transient_for (shellHandle, parent.topHandle ());
+			OS.gtk_window_set_destroy_with_parent (shellHandle, true);
+			if (!isUndecorated ()) {
+				OS.gtk_window_set_type_hint (shellHandle, OS.GDK_WINDOW_TYPE_HINT_DIALOG);
+			} else {
+				if (OS.GTK_VERSION >= OS.VERSION (2, 2, 0)) {
+					OS.gtk_window_set_skip_taskbar_hint (shellHandle, true);
+				}
+			}
+		}
+		/*
+		* Feature in GTK.  The window size must be set when the window
+		* is created or it will not be allowed to be resized smaller that the
+		* initial size by the user.  The fix is to set the size to zero.
+		*/
+		if ((style & SWT.RESIZE) != 0) {
+			OS.gtk_widget_set_size_request (shellHandle, 0, 0);
+			OS.gtk_window_set_resizable (shellHandle, true);
+		} else {
+			OS.gtk_window_set_resizable (shellHandle, false);
+		}
+		vboxHandle = OS.gtk_vbox_new (false, 0);
+		if (vboxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+		createHandle (index, false, true);
+		OS.gtk_container_add (vboxHandle, scrolledHandle);
+		OS.gtk_box_set_child_packing (vboxHandle, scrolledHandle, true, true, 0, OS.GTK_PACK_END);
+		OS.gtk_window_set_title (shellHandle, new byte [1]);
+		if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) == 0) {
+			OS.gtk_container_set_border_width (shellHandle, 1);
+			GdkColor color = new GdkColor ();
+			OS.gtk_style_get_black (OS.gtk_widget_get_style (shellHandle), color);
+			OS.gtk_widget_modify_bg (shellHandle,  OS.GTK_STATE_NORMAL, color);
+		}
+		int bits = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
+		boolean modal = (style & bits) != 0;
+		//TEMPORARY CODE
+		if ((style & SWT.ON_TOP) == 0) modal |= (parent != null && (parent.style & bits) != 0);
+		OS.gtk_window_set_modal (shellHandle, modal);
+	} else {
+		vboxHandle = OS.gtk_bin_get_child (shellHandle);
+		if (vboxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+		int /*long*/ children = OS.gtk_container_get_children (vboxHandle);
+		if (OS.g_list_length (children) > 0) {
+			scrolledHandle = OS.g_list_data (children);
+		}
+		OS.g_list_free (children);
+		if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
+		handle = OS.gtk_bin_get_child (scrolledHandle);
+		if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+	}
+	/*
+	* Feature in GTK.  Realizing the shell triggers a size allocate event,
+	* which may be confused for a resize event from the window manager if
+	* received too late.  The fix is to realize the window during creation
+	* to avoid confusion.
+	*/
+	OS.gtk_widget_realize (shellHandle);
+}
+
+int /*long*/ filterProc (int /*long*/ xEvent, int /*long*/ gdkEvent, int /*long*/ data2) {
+	int eventType = OS.X_EVENT_TYPE (xEvent);
+	if (eventType != OS.FocusOut && eventType != OS.FocusIn) return 0;
+	XFocusChangeEvent xFocusEvent = new XFocusChangeEvent();
+	OS.memmove (xFocusEvent, xEvent, XFocusChangeEvent.sizeof);
+	switch (eventType) {
+		case OS.FocusIn:
+			if (xFocusEvent.mode == OS.NotifyNormal || xFocusEvent.mode == OS.NotifyWhileGrabbed) {
+				switch (xFocusEvent.detail) {
+					case OS.NotifyNonlinear:
+					case OS.NotifyNonlinearVirtual:
+					case OS.NotifyAncestor:
+						if (tooltipsHandle != 0) OS.gtk_tooltips_enable (tooltipsHandle);
+						display.activeShell = this;
+						display.activePending = false;
+						sendEvent (SWT.Activate);
+						break;
+				}
+			}
+			break;
+		case OS.FocusOut:
+			if (xFocusEvent.mode == OS.NotifyNormal || xFocusEvent.mode == OS.NotifyWhileGrabbed) {
+				switch (xFocusEvent.detail) {
+					case OS.NotifyNonlinear:
+					case OS.NotifyNonlinearVirtual:
+					case OS.NotifyVirtual:
+						if (tooltipsHandle != 0) OS.gtk_tooltips_disable (tooltipsHandle);
+						Display display = this.display;
+						sendEvent (SWT.Deactivate);
+						setActiveControl (null);
+						if (display.activeShell == this) {
+							display.activeShell = null;
+							display.activePending = false;
+						}
+						break;
+				}
+			}
+			break;
+	}
+	return 0;
+}
+
+Control findBackgroundControl () {
+	return (state & BACKGROUND) != 0 || backgroundImage != null ? this : null;
+}
+
+Composite findDeferredControl () {
+	return layoutCount > 0 ? this : null;
+}
+
+boolean hasBorder () {
+	return false;
+}
+
+void hookEvents () {
+	super.hookEvents ();
+	OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [KEY_PRESS_EVENT], 0, display.closures [KEY_PRESS_EVENT], false);
+	OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [MAP_EVENT], 0, display.closures [MAP_EVENT], false);
+	OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [UNMAP_EVENT], 0, display.closures [UNMAP_EVENT], false);
+	OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [WINDOW_STATE_EVENT], 0, display.closures [WINDOW_STATE_EVENT], false);
+	OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [SIZE_ALLOCATE], 0, display.closures [SIZE_ALLOCATE], false);
+	OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [CONFIGURE_EVENT], 0, display.closures [CONFIGURE_EVENT], false);
+	OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [DELETE_EVENT], 0, display.closures [DELETE_EVENT], false);
+	OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [MAP_EVENT], 0, display.shellMapProcClosure, false);
+	OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [ENTER_NOTIFY_EVENT], 0, display.closures [ENTER_NOTIFY_EVENT], false);
+	OS.g_signal_connect_closure (shellHandle, OS.move_focus, display.closures [MOVE_FOCUS], false);
+	int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle);
+	OS.gdk_window_add_filter  (window, display.filterProc, shellHandle);
+}
+
+public boolean isEnabled () {
+	checkWidget ();
+	return getEnabled ();
+}
+
+boolean isUndecorated () {
+	return
+		(style & (SWT.SHELL_TRIM | SWT.BORDER)) == SWT.NONE ||
+		(style & (SWT.NO_TRIM | SWT.ON_TOP)) != 0;
+}
+
+public boolean isVisible () {
+	checkWidget();
+	return getVisible ();
+}
+
+void register () {
+	super.register ();
+	display.addWidget (shellHandle, this);
+}
+
+void releaseParent () {
+	/* Do nothing */
+}
+
+int /*long*/ topHandle () {
+	return shellHandle;
+}
+
+void fixActiveShell () {
+	if (display.activeShell == this) {
+		Shell shell = null;
+		if (parent != null && parent.isVisible ()) shell = parent.getShell ();
+		if (shell == null && isUndecorated ()) {
+			Shell [] shells = display.getShells ();
+			for (int i = 0; i < shells.length; i++) {
+				if (shells [i] != null && shells [i].isVisible ()) {
+					shell = shells [i];
+					break;
+				}
+			}
+		}
+		if (shell != null) shell.bringToTop (false);
+	}
+}
+
+void fixShell (Shell newShell, Control control) {
+	if (this == newShell) return;
+	if (control == lastActive) setActiveControl (null);
+	String toolTipText = control.toolTipText;
+	if (toolTipText != null) {
+		control.setToolTipText (this, null);
+		control.setToolTipText (newShell, toolTipText);
+	}
+}
+
+void fixStyle (int /*long*/ handle) {
+}
+
+void forceResize () {
+	forceResize (OS.GTK_WIDGET_WIDTH (vboxHandle), OS.GTK_WIDGET_HEIGHT (vboxHandle));
+}
+
+void forceResize (int width, int height) {
+	GtkRequisition requisition = new GtkRequisition ();
+	OS.gtk_widget_size_request (vboxHandle, requisition);
+	GtkAllocation allocation = new GtkAllocation ();
+	int border = OS.gtk_container_get_border_width (shellHandle);
+	allocation.x = border;
+	allocation.y = border;
+	allocation.width = width;
+	allocation.height = height;
+	OS.gtk_widget_size_allocate (vboxHandle, allocation);
+}
+
+public Point getLocation () {
+	checkWidget ();
+	int [] x = new int [1], y = new int [1];
+	OS.gtk_window_get_position (shellHandle, x,y);
+	return new Point (x [0], y [0]);
+}
+
+/**
+ * Returns a point describing the minimum receiver's size. The
+ * x coordinate of the result is the minimum width of the receiver.
+ * The y coordinate of the result is the minimum height of the
+ * receiver.
+ *
+ * @return the receiver's size
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.1
+ */
+public Point getMinimumSize () {
+	checkWidget ();
+	int width = Math.max (1, minWidth + trimWidth ());
+	int height = Math.max (1, minHeight + trimHeight ());
+	return new Point (width, height);
+}
+
+public Point getSize () {
+	checkWidget ();
+	int width = OS.GTK_WIDGET_WIDTH (vboxHandle);
+	int height = OS.GTK_WIDGET_HEIGHT (vboxHandle);
+	int border = 0;
+	if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) == 0) {
+		border = OS.gtk_container_get_border_width (shellHandle);
+	}
+	return new Point (width + trimWidth () + 2*border, height + trimHeight () + 2*border);
+}
+
+public boolean getVisible () {
+	checkWidget();
+	return OS.GTK_WIDGET_VISIBLE (shellHandle);
+}
+
+/**
+ * Returns the region that defines the shape of the shell,
+ * or null if the shell has the default shape.
+ *
+ * @return the region that defines the shape of the shell (or null)
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.0
+ *
+ */
+public Region getRegion () {
+	checkWidget ();
+	return region;
+}
+
+/**
+ * Returns the receiver's input method editor mode. This
+ * will be the result of bitwise OR'ing together one or
+ * more of the following constants defined in class
+ * <code>SWT</code>:
+ * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
+ * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
+ *
+ * @return the IME mode
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SWT
+ */
+public int getImeInputMode () {
+	checkWidget();
+	return SWT.NONE;
+}
+
+Shell _getShell () {
+	return this;
+}
+/**
+ * Returns an array containing all shells which are
+ * descendants of the receiver.
+ * <p>
+ * @return the dialog shells
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Shell [] getShells () {
+	checkWidget();
+	int count = 0;
+	Shell [] shells = display.getShells ();
+	for (int i=0; i<shells.length; i++) {
+		Control shell = shells [i];
+		do {
+			shell = shell.getParent ();
+		} while (shell != null && shell != this);
+		if (shell == this) count++;
+	}
+	int index = 0;
+	Shell [] result = new Shell [count];
+	for (int i=0; i<shells.length; i++) {
+		Control shell = shells [i];
+		do {
+			shell = shell.getParent ();
+		} while (shell != null && shell != this);
+		if (shell == this) {
+			result [index++] = shells [i];
+		}
+	}
+	return result;
+}
+
+int /*long*/ gtk_configure_event (int /*long*/ widget, int /*long*/ event) {
+	int [] x = new int [1], y = new int [1];
+	OS.gtk_window_get_position (shellHandle, x, y);
+	if (!moved || oldX != x [0] || oldY != y [0]) {
+		moved = true;
+		oldX = x [0];
+		oldY = y [0];
+		sendEvent (SWT.Move);
+		// widget could be disposed at this point
+	}
+	return 0;
+}
+
+int /*long*/ gtk_delete_event (int /*long*/ widget, int /*long*/ event) {
+	if (isEnabled()) closeWidget ();
+	return 1;
+}
+
+int /*long*/ gtk_enter_notify_event (int /*long*/ widget, int /*long*/ event) {
+	if (widget != shellHandle) {
+		return super.gtk_enter_notify_event (widget, event);
+	}
+	return 0;
+}
+
+int /*long*/ gtk_focus (int /*long*/ widget, int /*long*/ directionType) {
+	switch ((int)/*64*/directionType) {
+		case OS.GTK_DIR_TAB_FORWARD:
+		case OS.GTK_DIR_TAB_BACKWARD:
+			Control control = display.getFocusControl ();
+			if (control != null) {
+				if ((control.state & CANVAS) != 0 && (control.style & SWT.EMBEDDED) != 0) {
+					int traversal = directionType == OS.GTK_DIR_TAB_FORWARD ? SWT.TRAVERSE_TAB_NEXT : SWT.TRAVERSE_TAB_PREVIOUS;
+					control.traverse (traversal);
+					return 1;
+				}
+			}
+			break;
+	}
+	return super.gtk_focus (widget, directionType);
+}
+
+int /*long*/ gtk_move_focus (int /*long*/ widget, int /*long*/ directionType) {
+	Control control = display.getFocusControl ();
+	if (control != null) {
+		int /*long*/ focusHandle = control.focusHandle ();
+		OS.gtk_widget_child_focus (focusHandle, (int)/*64*/directionType);
+	}
+	OS.g_signal_stop_emission_by_name (shellHandle, OS.move_focus);
+	return 1;
+}
+
+int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) {
+	/* Stop menu mnemonics when the shell is disabled */
+	if (widget == shellHandle) {
+		return (state & DISABLED) != 0 ? 1 : 0;
+	}
+	return super.gtk_key_press_event (widget, event);
+}
+
+int /*long*/ gtk_map_event (int /*long*/ widget, int /*long*/ event) {
+	minimized = false;
+	sendEvent (SWT.Deiconify);
+	return 0;
+}
+
+int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) {
+	int width = OS.GTK_WIDGET_WIDTH (shellHandle);
+	int height = OS.GTK_WIDGET_HEIGHT (shellHandle);
+	if (!resized || oldWidth != width || oldHeight != height) {
+		oldWidth = width;
+		oldHeight = height;
+		resizeBounds (width, height, true);
+	}
+	return 0;
+}
+
+int /*long*/ gtk_realize (int /*long*/ widget) {
+	int /*long*/ result = super.gtk_realize (widget);
+	int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle);
+	if ((style & SWT.SHELL_TRIM) != SWT.SHELL_TRIM) {
+		int decorations = 0;
+		if ((style & SWT.NO_TRIM) == 0) {
+			if ((style & SWT.MIN) != 0) decorations |= OS.GDK_DECOR_MINIMIZE;
+			if ((style & SWT.MAX) != 0) decorations |= OS.GDK_DECOR_MAXIMIZE;
+			if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_RESIZEH;
+			if ((style & SWT.BORDER) != 0) decorations |= OS.GDK_DECOR_BORDER;
+			if ((style & SWT.MENU) != 0) decorations |= OS.GDK_DECOR_MENU;
+			if ((style & SWT.TITLE) != 0) decorations |= OS.GDK_DECOR_TITLE;
+			/*
+			* Feature in GTK.  Under some Window Managers (Sawmill), in order
+			* to get any border at all from the window manager it is necessary to
+			* set GDK_DECOR_BORDER.  The fix is to force these bits when any
+			* kind of border is requested.
+			*/
+			if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_BORDER;
+		}
+		OS.gdk_window_set_decorations (window, decorations);
+	}
+	if ((style & SWT.ON_TOP) != 0) {
+		OS.gdk_window_set_override_redirect (window, true);
+	}
+	return result;
+}
+
+int /*long*/ gtk_unmap_event (int /*long*/ widget, int /*long*/ event) {
+	minimized = true;
+	sendEvent (SWT.Iconify);
+	return 0;
+}
+
+int /*long*/ gtk_window_state_event (int /*long*/ widget, int /*long*/ event) {
+	GdkEventWindowState gdkEvent = new GdkEventWindowState ();
+	OS.memmove (gdkEvent, event, GdkEventWindowState.sizeof);
+	minimized = (gdkEvent.new_window_state & OS.GDK_WINDOW_STATE_ICONIFIED) != 0;
+	maximized = (gdkEvent.new_window_state & OS.GDK_WINDOW_STATE_MAXIMIZED) != 0;
+	return 0;
+}
+
+/**
+ * Moves the receiver to the top of the drawing order for
+ * the display on which it was created (so that all other
+ * shells on that display, which are not the receiver's
+ * children will be drawn behind it), marks it visible,
+ * sets the focus and asks the window manager to make the
+ * shell active.
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Control#moveAbove
+ * @see Control#setFocus
+ * @see Control#setVisible
+ * @see Display#getActiveShell
+ * @see Decorations#setDefaultButton(Button)
+ * @see Shell#setActive
+ * @see Shell#forceActive
+ */
+public void open () {
+	checkWidget ();
+	bringToTop (false);
+	setVisible (true);
+	if (isDisposed ()) return;
+	if (!restoreFocus () && !traverseGroup (true)) setFocus ();
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when operations are performed on the receiver.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ShellListener
+ * @see #addShellListener
+ */
+public void removeShellListener (ShellListener listener) {
+	checkWidget();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.Close, listener);
+	eventTable.unhook (SWT.Iconify,listener);
+	eventTable.unhook (SWT.Deiconify,listener);
+	eventTable.unhook (SWT.Activate, listener);
+	eventTable.unhook (SWT.Deactivate, listener);
+}
+
+/**
+ * If the receiver is visible, moves it to the top of the
+ * drawing order for the display on which it was created
+ * (so that all other shells on that display, which are not
+ * the receiver's children will be drawn behind it) and asks
+ * the window manager to make the shell active
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 2.0
+ * @see Control#moveAbove
+ * @see Control#setFocus
+ * @see Control#setVisible
+ * @see Display#getActiveShell
+ * @see Decorations#setDefaultButton(Button)
+ * @see Shell#open
+ * @see Shell#setActive
+ */
+public void setActive () {
+	checkWidget ();
+	bringToTop (false);
+}
+
+void setActiveControl (Control control) {
+	if (control != null && control.isDisposed ()) control = null;
+	if (lastActive != null && lastActive.isDisposed ()) lastActive = null;
+	if (lastActive == control) return;
+
+	/*
+	* Compute the list of controls to be activated and
+	* deactivated by finding the first common parent
+	* control.
+	*/
+	Control [] activate = (control == null) ? new Control[0] : control.getPath ();
+	Control [] deactivate = (lastActive == null) ? new Control[0] : lastActive.getPath ();
+	lastActive = control;
+	int index = 0, length = Math.min (activate.length, deactivate.length);
+	while (index < length) {
+		if (activate [index] != deactivate [index]) break;
+		index++;
+	}
+
+	/*
+	* It is possible (but unlikely), that application
+	* code could have destroyed some of the widgets. If
+	* this happens, keep processing those widgets that
+	* are not disposed.
+	*/
+	for (int i=deactivate.length-1; i>=index; --i) {
+		if (!deactivate [i].isDisposed ()) {
+			deactivate [i].sendEvent (SWT.Deactivate);
+		}
+	}
+	for (int i=activate.length-1; i>=index; --i) {
+		if (!activate [i].isDisposed ()) {
+			activate [i].sendEvent (SWT.Activate);
+		}
+	}
+}
+
+void resizeBounds (int width, int height, boolean notify) {
+	if (redrawWindow != 0) {
+		OS.gdk_window_resize (redrawWindow, width, height);
+	}
+	if (enableWindow != 0) {
+		OS.gdk_window_resize (enableWindow, width, height);
+	}
+	int border = OS.gtk_container_get_border_width (shellHandle);
+	int boxWidth = width - 2*border;
+	int boxHeight = height - 2*border;
+	OS.gtk_widget_set_size_request (vboxHandle, boxWidth, boxHeight);
+	forceResize (boxWidth, boxHeight);
+	if (notify) {
+		resized = true;
+		sendEvent (SWT.Resize);
+		if (isDisposed ()) return;
+		if (layout != null) {
+			markLayout (false, false);
+			updateLayout (false);
+		}
+	}
+}
+
+int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
+	/*
+	* Bug in GTK.  When either of the location or size of
+	* a shell is changed while the shell is maximized, the
+	* shell is moved to (0, 0).  The fix is to explicitly
+	* unmaximize the shell before setting the bounds to
+	* anything different from the current bounds.
+	*/
+	if (getMaximized ()) {
+		Rectangle rect = getBounds ();
+		boolean sameOrigin = !move || (rect.x == x && rect.y == y);
+		boolean sameExtent = !resize || (rect.width == width && rect.height == height);
+		if (sameOrigin && sameExtent) return 0;
+		setMaximized (false);
+	}
+	int result = 0;
+	if (move) {
+		int [] x_pos = new int [1], y_pos = new int [1];
+		OS.gtk_window_get_position (shellHandle, x_pos, y_pos);
+		OS.gtk_window_move (shellHandle, x, y);
+		if (x_pos [0] != x || y_pos [0] != y) {
+			moved = true;
+			oldX = x;
+			oldY = y;
+			sendEvent (SWT.Move);
+			if (isDisposed ()) return 0;
+			result |= MOVED;
+		}
+	}
+	if (resize) {
+		width = Math.max (1, Math.max (minWidth, width - trimWidth ()));
+		height = Math.max (1, Math.max (minHeight, height - trimHeight ()));
+		if ((style & SWT.RESIZE) != 0) OS.gtk_window_resize (shellHandle, width, height);
+		boolean changed = width != oldWidth || height != oldHeight;
+		if (changed) {
+			oldWidth = width;
+			oldHeight = height;
+			result |= RESIZED;
+		}
+		resizeBounds (width, height, changed);
+	}
+	return result;
+}
+
+void setCursor (int /*long*/ cursor) {
+	if (enableWindow != 0) {
+		OS.gdk_window_set_cursor (enableWindow, cursor);
+		if (!OS.GDK_WINDOWING_X11 ()) {
+			OS.gdk_flush ();
+		} else {
+			int /*long*/ xDisplay = OS.GDK_DISPLAY ();
+			OS.XFlush (xDisplay);
+		}
+	}
+	super.setCursor (cursor);
+}
+
+public void setEnabled (boolean enabled) {
+	checkWidget();
+	if (((state & DISABLED) == 0) == enabled) return;
+	Display display = this.display;
+	Control control = null;
+	boolean fixFocus = false;
+	if (!enabled) {
+		if (display.focusEvent != SWT.FocusOut) {
+			control = display.getFocusControl ();
+			fixFocus = isFocusAncestor (control);
+		}
+	}
+	if (enabled) {
+		state &= ~DISABLED;
+	} else {
+		state |= DISABLED;
+	}
+	enableWidget (enabled);
+	if (isDisposed ()) return;
+	if (enabled) {
+		if (enableWindow != 0) {
+			OS.gdk_window_set_user_data (enableWindow, 0);
+			OS.gdk_window_destroy (enableWindow);
+			enableWindow = 0;
+		}
+	} else {
+		int /*long*/ parentHandle = shellHandle;
+		OS.gtk_widget_realize (parentHandle);
+		int /*long*/ window = OS.GTK_WIDGET_WINDOW (parentHandle);
+		Rectangle rect = getBounds ();
+		GdkWindowAttr attributes = new GdkWindowAttr ();
+		attributes.width = rect.width;
+		attributes.height = rect.height;
+		attributes.event_mask = (0xFFFFFFFF & ~OS.ExposureMask);
+		attributes.wclass = OS.GDK_INPUT_ONLY;
+		attributes.window_type = OS.GDK_WINDOW_CHILD;
+		enableWindow = OS.gdk_window_new (window, attributes, 0);
+		if (enableWindow != 0) {
+			if (cursor != null) {
+				OS.gdk_window_set_cursor (enableWindow, cursor.handle);
+				if (!OS.GDK_WINDOWING_X11 ()) {
+					OS.gdk_flush ();
+				} else {
+					int /*long*/ xDisplay = OS.GDK_DISPLAY ();
+					OS.XFlush (xDisplay);
+				}
+			}
+			OS.gdk_window_set_user_data (enableWindow, parentHandle);
+			OS.gdk_window_show (enableWindow);
+		}
+	}
+	if (fixFocus) fixFocus (control);
+	if (enabled && display.activeShell == this) {
+		if (!restoreFocus ()) traverseGroup (false);
+	}
+}
+
+/**
+ * Sets the input method editor mode to the argument which
+ * should be the result of bitwise OR'ing together one or more
+ * of the following constants defined in class <code>SWT</code>:
+ * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
+ * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
+ *
+ * @param mode the new IME mode
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SWT
+ */
+public void setImeInputMode (int mode) {
+	checkWidget();
+}
+
+void setInitialBounds () {
+	if ((state & FOREIGN_HANDLE) != 0) return;
+	Monitor monitor = getMonitor ();
+	Rectangle rect = monitor.getClientArea ();
+	int width = rect.width * 5 / 8;
+	int height = rect.height * 5 / 8;
+	if ((style & SWT.RESIZE) != 0) {
+		OS.gtk_window_resize (shellHandle, width, height);
+	}
+	resizeBounds (width, height, false);
+}
+
+public void setMaximized (boolean maximized) {
+	checkWidget();
+	super.setMaximized (maximized);
+	if (maximized) {
+		OS.gtk_window_maximize (shellHandle);
+	} else {
+		OS.gtk_window_unmaximize (shellHandle);
+	}
+}
+
+public void setMenuBar (Menu menu) {
+	checkWidget();
+	if (menuBar == menu) return;
+	boolean both = menu != null && menuBar != null;
+	if (menu != null) {
+		if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
+		if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
+	}
+	if (menuBar != null) {
+		int /*long*/ menuHandle = menuBar.handle;
+		OS.gtk_widget_hide (menuHandle);
+		destroyAccelGroup ();
+	}
+	menuBar = menu;
+	if (menuBar != null) {
+		int /*long*/ menuHandle = menu.handle;
+		OS.gtk_widget_show (menuHandle);
+		createAccelGroup ();
+		menuBar.addAccelerators (accelGroup);
+	}
+	int width = OS.GTK_WIDGET_WIDTH (vboxHandle);
+	int height = OS.GTK_WIDGET_HEIGHT (vboxHandle);
+	resizeBounds (width, height, !both);
+}
+
+public void setMinimized (boolean minimized) {
+	checkWidget();
+	if (this.minimized == minimized) return;
+	super.setMinimized (minimized);
+	if (minimized) {
+		OS.gtk_window_iconify (shellHandle);
+	} else {
+		OS.gtk_window_deiconify (shellHandle);
+		bringToTop (false);
+	}
+}
+
+/**
+ * Sets the receiver's minimum size to the size specified by the arguments.
+ * If the new minimum size is larger than the current size of the receiver,
+ * the receiver is resized to the new minimum size.
+ *
+ * @param width the new minimum width for the receiver
+ * @param height the new minimum height for the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.1
+ */
+public void setMinimumSize (int width, int height) {
+	checkWidget ();
+	GdkGeometry geometry = new GdkGeometry ();
+	minWidth = geometry.min_width = Math.max (width, trimWidth ()) - trimWidth ();
+	minHeight = geometry.min_height = Math.max (height, trimHeight ()) - trimHeight ();
+	OS.gtk_window_set_geometry_hints (shellHandle, 0, geometry, OS.GDK_HINT_MIN_SIZE);
+}
+
+/**
+ * Sets the receiver's minimum size to the size specified by the argument.
+ * If the new minimum size is larger than the current size of the receiver,
+ * the receiver is resized to the new minimum size.
+ *
+ * @param size the new minimum size for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.1
+ */
+public void setMinimumSize (Point size) {
+	checkWidget ();
+	if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
+	setMinimumSize (size.x, size.y);
+}
+
+/**
+ * Sets the shape of the shell to the region specified
+ * by the argument.  When the argument is null, the
+ * default shape of the shell is restored.  The shell
+ * must be created with the style SWT.NO_TRIM in order
+ * to specify a region.
+ *
+ * @param region the region that defines the shape of the shell (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_ARGUMENT - if the region has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.0
+ *
+ */
+public void setRegion (Region region) {
+	checkWidget ();
+	if ((style & SWT.NO_TRIM) == 0) return;
+	if (region != null && region.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
+	int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle);
+	int /*long*/ shape_region = (region == null) ? 0 : region.handle;
+	OS.gdk_window_shape_combine_region (window, shape_region, 0, 0);
+	this.region = region;
+}
+
+/*
+ * Shells are never labelled by other widgets, so no initialization is needed.
+ */
+void setRelations() {
+}
+
+public void setText (String string) {
+	super.setText (string);
+
+	/*
+	* GTK bug 82013.  For some reason, if the title string
+	* is less than 7 bytes long and is not terminated by
+	* a space, some window managers occasionally draw
+	* garbage after the last character in  the title.
+	* The fix is to pad the title.
+	*/
+	int length = string.length ();
+	char [] chars = new char [Math.max (6, length) + 1];
+	string.getChars (0, length , chars, 0);
+	for (int i=length; i<chars.length; i++)  chars [i] = ' ';
+	byte [] buffer = Converter.wcsToMbcs (null, chars, true);
+	OS.gtk_window_set_title (shellHandle, buffer);
+}
+
+public void setVisible (boolean visible) {
+	checkWidget();
+	if ((OS.GTK_WIDGET_MAPPED (shellHandle) == visible)) return;
+	if (visible) {
+		sendEvent (SWT.Show);
+		if (isDisposed ()) return;
+
+		/*
+		* In order to ensure that the shell is visible
+		* and fully painted, dispatch events such as
+		* GDK_MAP and GDK_CONFIGURE, until the GDK_MAP
+		* event for the shell is received.
+		*
+		* Note that if the parent is minimized or withdrawn
+		* from the desktop, this should not be done since
+		* the shell not will be mapped until the parent is
+		* unminimized or shown on the desktop.
+		*/
+		OS.gtk_widget_show (shellHandle);
+		if (!OS.GTK_IS_PLUG (shellHandle)) {
+			mapped = false;
+			if (isDisposed ()) return;
+			display.dispatchEvents = new int [] {
+				OS.GDK_EXPOSE,
+				OS.GDK_FOCUS_CHANGE,
+				OS.GDK_CONFIGURE,
+				OS.GDK_MAP,
+				OS.GDK_UNMAP,
+				OS.GDK_NO_EXPOSE,
+			};
+			Display display = this.display;
+			display.putGdkEvents();
+			boolean iconic = false;
+			Shell shell = parent != null ? parent.getShell() : null;
+			do {
+				OS.g_main_context_iteration (0, false);
+				if (isDisposed ()) break;
+				iconic = minimized || (shell != null && shell.minimized);
+			} while (!mapped && !iconic);
+			display.dispatchEvents = null;
+			if (isDisposed ()) return;
+			if (!iconic) {
+				update (true, true);
+				if (isDisposed ()) return;
+				adjustTrim ();
+			}
+		}
+		mapped = true;
+
+		int mask = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
+		if ((style & mask) != 0) {
+			OS.gdk_pointer_ungrab (OS.GDK_CURRENT_TIME);
+		}
+		opened = true;
+		if (!moved) {
+			moved = true;
+			Point location = getLocation();
+			oldX = location.x;
+			oldY = location.y;
+			sendEvent (SWT.Move);
+			if (isDisposed ()) return;
+		}
+		if (!resized) {
+			resized = true;
+			Point size = getSize ();
+			oldWidth = size.x - trimWidth ();
+			oldHeight = size.y - trimHeight ();
+			sendEvent (SWT.Resize);
+			if (isDisposed ()) return;
+			if (layout != null) {
+				markLayout (false, false);
+				updateLayout (false);
+			}
+		}
+	} else {
+		fixActiveShell ();
+		OS.gtk_widget_hide (shellHandle);
+		sendEvent (SWT.Hide);
+	}
+}
+
+void setZOrder (Control sibling, boolean above, boolean fixRelations) {
+	/*
+	* Bug in GTK+.  Changing the toplevel window Z-order causes
+	* X to send a resize event.  Before the shell is mapped, these
+	* resize events always have a size of 200x200, causing extra
+	* layout work to occur.  The fix is to modify the Z-order only
+	* if the shell has already been mapped at least once.
+	*/
+	/* Shells are never included in labelled-by relations */
+	if (mapped) setZOrder (sibling, above, false, false);
+}
+
+int /*long*/ shellMapProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
+	mapped = true;
+	display.dispatchEvents = null;
+	return 0;
+}
+
+void showWidget () {
+	if ((state & FOREIGN_HANDLE) != 0) return;
+	OS.gtk_container_add (shellHandle, vboxHandle);
+	if (scrolledHandle != 0) OS.gtk_widget_show (scrolledHandle);
+	if (handle != 0) OS.gtk_widget_show (handle);
+	if (vboxHandle != 0) OS.gtk_widget_show (vboxHandle);
+}
+
+int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
+	int offset = 16;
+	int [] x = new int [1], y = new int [1];
+	OS.gdk_window_get_pointer (0, x, y, null);
+	y [0] += offset;
+	int /*long*/ screen = OS.gdk_screen_get_default ();
+	if (screen != 0) {
+		int monitorNumber = OS.gdk_screen_get_monitor_at_point (screen, x[0], y[0]);
+		GdkRectangle dest = new GdkRectangle ();
+		OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest);
+		int width = OS.GTK_WIDGET_WIDTH (handle);
+		int height = OS.GTK_WIDGET_HEIGHT (handle);
+		if (x[0] + width > dest.x + dest.width) {
+			x [0] = (dest.x + dest.width) - width;
+		}
+		if (y[0] + height > dest.y + dest.height) {
+			y[0] = (dest.y + dest.height) - height;
+		}
+	}
+	OS.gtk_window_move (handle, x [0], y [0]);
+	return 0;
+}
+
+int /*long*/ sizeRequestProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
+	OS.gtk_widget_hide (handle);
+	return 0;
+}
+
+boolean traverseEscape () {
+	if (parent == null) return false;
+	if (!isVisible () || !isEnabled ()) return false;
+	close ();
+	return true;
+}
+int trimHeight () {
+	if ((style & SWT.NO_TRIM) != 0) return 0;
+	boolean hasTitle = false, hasResize = false, hasBorder = false;
+	hasTitle = (style & (SWT.MIN | SWT.MAX | SWT.TITLE | SWT.MENU)) != 0;
+	hasResize = (style & SWT.RESIZE) != 0;
+	hasBorder = (style & SWT.BORDER) != 0;
+	if (hasTitle) {
+		if (hasResize) return display.titleResizeTrimHeight;
+		if (hasBorder) return display.titleBorderTrimHeight;
+		return display.titleTrimHeight;
+	}
+	if (hasResize) return display.resizeTrimHeight;
+	if (hasBorder) return display.borderTrimHeight;
+	return 0;
+}
+
+int trimWidth () {
+	if ((style & SWT.NO_TRIM) != 0) return 0;
+	boolean hasTitle = false, hasResize = false, hasBorder = false;
+	hasTitle = (style & (SWT.MIN | SWT.MAX | SWT.TITLE | SWT.MENU)) != 0;
+	hasResize = (style & SWT.RESIZE) != 0;
+	hasBorder = (style & SWT.BORDER) != 0;
+	if (hasTitle) {
+		if (hasResize) return display.titleResizeTrimWidth;
+		if (hasBorder) return display.titleBorderTrimWidth;
+		return display.titleTrimWidth;
+	}
+	if (hasResize) return display.resizeTrimWidth;
+	if (hasBorder) return display.borderTrimWidth;
+	return 0;
+}
+
+void deregister () {
+	super.deregister ();
+	display.removeWidget (shellHandle);
+}
+
+public void dispose () {
+	/*
+	* Note:  It is valid to attempt to dispose a widget
+	* more than once.  If this happens, fail silently.
+	*/
+	if (isDisposed()) return;
+	fixActiveShell ();
+	OS.gtk_widget_hide (shellHandle);
+	super.dispose ();
+}
+
+/**
+ * If the receiver is visible, moves it to the top of the
+ * drawing order for the display on which it was created
+ * (so that all other shells on that display, which are not
+ * the receiver's children will be drawn behind it) and forces
+ * the window manager to make the shell active.
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 2.0
+ * @see Control#moveAbove
+ * @see Control#setFocus
+ * @see Control#setVisible
+ * @see Display#getActiveShell
+ * @see Decorations#setDefaultButton(Button)
+ * @see Shell#open
+ * @see Shell#setActive
+ */
+public void forceActive () {
+	checkWidget ();
+	bringToTop (true);
+}
+
+public Rectangle getBounds () {
+	checkWidget ();
+	int [] x = new int [1], y = new int [1];
+	OS.gtk_window_get_position (shellHandle, x, y);
+	int width = OS.GTK_WIDGET_WIDTH (vboxHandle);
+	int height = OS.GTK_WIDGET_HEIGHT (vboxHandle);
+	int border = 0;
+	if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) == 0) {
+		border = OS.gtk_container_get_border_width (shellHandle);
+	}
+	return new Rectangle (x [0], y [0], width + trimWidth () + 2*border, height + trimHeight () + 2*border);
+}
+
+void releaseHandle () {
+	super.releaseHandle ();
+	shellHandle = 0;
+}
+
+void releaseChildren (boolean destroy) {
+	Shell [] shells = getShells ();
+	for (int i=0; i<shells.length; i++) {
+		Shell shell = shells [i];
+		if (shell != null && !shell.isDisposed ()) {
+			shell.release (false);
+		}
+	}
+	super.releaseChildren (destroy);
+}
+
+void releaseWidget () {
+	super.releaseWidget ();
+	destroyAccelGroup ();
+	if (display.activeShell == this) display.activeShell = null;
+	if (tooltipsHandle != 0) OS.g_object_unref (tooltipsHandle);
+	tooltipsHandle = 0;
+	int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle);
+	OS.gdk_window_remove_filter(window, display.filterProc, shellHandle);
+	region = null;
+	lastActive = null;
+}
+
+void setToolTipText (int /*long*/ widget, String string) {
+	byte [] buffer = null;
+	if (string != null && string.length () > 0) {
+		buffer = Converter.wcsToMbcs (null, string, true);
+	}
+	if (tooltipsHandle == 0) {
+		tooltipsHandle = OS.gtk_tooltips_new ();
+		if (tooltipsHandle == 0) error (SWT.ERROR_NO_HANDLES);
+		OS.g_object_ref (tooltipsHandle);
+		OS.gtk_object_sink (tooltipsHandle);
+	}
+
+	/*
+	* Feature in GTK.  There is no API to position a tooltip.
+	* The fix is to connect to the size_allocate signal for
+	* the tooltip window and position it before it is mapped.
+	*
+	* Bug in Solaris-GTK.  Invoking gtk_tooltips_force_window()
+	* can cause a crash in older versions of GTK.  The fix is
+	* to avoid this call if the GTK version is older than 2.2.x.
+	*/
+	if (OS.GTK_VERSION >= OS.VERSION (2, 2, 1)) {
+		OS.gtk_tooltips_force_window (tooltipsHandle);
+	}
+	int /*long*/ tipWindow = OS.GTK_TOOLTIPS_TIP_WINDOW (tooltipsHandle);
+	if (tipWindow != 0 && tipWindow != tooltipWindow) {
+		OS.g_signal_connect (tipWindow, OS.size_allocate, display.sizeAllocateProc, shellHandle);
+		tooltipWindow = tipWindow;
+	}
+
+	/*
+	* Bug in GTK.  If the cursor is inside the window when a new
+	* tooltip is set and the old tooltip is hidden, the new tooltip
+	* is not displayed until the mouse re-enters the window.  The
+	* fix is force the new tooltip to be active.
+	*/
+	boolean set = true;
+	if (tipWindow != 0) {
+		if ((OS.GTK_WIDGET_FLAGS (widget) & (OS.GTK_REALIZED | OS.GTK_VISIBLE)) != 0) {
+			int [] x = new int [1], y = new int [1];
+			int /*long*/ window = OS.gdk_window_at_pointer (x, y);
+			if (window != 0) {
+				int /*long*/ [] user_data = new int /*long*/ [1];
+				OS.gdk_window_get_user_data (window, user_data);
+				if (widget == user_data [0]) {
+					/*
+					* Feature in GTK.  Calling gtk_tooltips_set_tip() positions and
+					* shows the tooltip.  If the tooltip is already visible, moving
+					* it to a new location in the size_allocate signal causes flashing.
+					* The fix is to hide the tip window in the size_request signal
+					* and before the new tooltip is forced to be active.
+					*/
+					set = false;
+					int handler_id = OS.g_signal_connect (tipWindow, OS.size_request, display.sizeRequestProc, shellHandle);
+					OS.gtk_tooltips_set_tip (tooltipsHandle, widget, buffer, null);
+					OS.gtk_widget_hide (tipWindow);
+					int /*long*/ data = OS.gtk_tooltips_data_get (widget);
+					OS.GTK_TOOLTIPS_SET_ACTIVE (tooltipsHandle, data);
+					OS.gtk_tooltips_set_tip (tooltipsHandle, widget, buffer, null);
+					if (handler_id != 0) OS.g_signal_handler_disconnect (tipWindow, handler_id);
+				}
+			}
+		}
+	}
+	if (set) OS.gtk_tooltips_set_tip (tooltipsHandle, widget, buffer, null);
+}
+}
+++/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/Synchronizer.d	Tue Jan 08 01:23:25 2008 +0100
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.Synchronizer;
+
+class Synchronizer{}
+/++
+import dwt.*;
+import dwt.internal.Compatibility;
+
+/**
+ * Instances of this class provide synchronization support
+ * for displays. A default instance is created automatically
+ * for each display, and this instance is sufficient for almost
+ * all applications.
+ * <p>
+ * <b>IMPORTANT:</b> Typical application code <em>never</em>
+ * needs to deal with this class. It is provided only to
+ * allow applications which require non-standard
+ * synchronization behavior to plug in the support they
+ * require. <em>Subclasses which override the methods in
+ * this class must ensure that the superclass methods are
+ * invoked in their implementations</em>
+ * </p>
+ *
+ * @see Display#setSynchronizer
+ */
+public class Synchronizer {
+	Display display;
+	int messageCount;
+	RunnableLock [] messages;
+	Object messageLock = new Object ();
+	Thread syncThread;
+
+/**
+ * Constructs a new instance of this class.
+ *
+ * @param display the display to create the synchronizer on
+ */
+public Synchronizer (Display display) {
+	this.display = display;
+}
+
+void addLast (RunnableLock lock) {
+	boolean wake = false;
+	synchronized (messageLock) {
+		if (messages == null) messages = new RunnableLock [4];
+		if (messageCount == messages.length) {
+			RunnableLock[] newMessages = new RunnableLock [messageCount + 4];
+			System.arraycopy (messages, 0, newMessages, 0, messageCount);
+			messages = newMessages;
+		}
+		messages [messageCount++] = lock;
+		wake = messageCount == 1;
+	}
+	if (wake) display.wakeThread ();
+}
+
+/**
+ * Causes the <code>run()</code> method of the runnable to
+ * be invoked by the user-interface thread at the next
+ * reasonable opportunity. The caller of this method continues
+ * to run in parallel, and is not notified when the
+ * runnable has completed.
+ *
+ * @param runnable code to run on the user-interface thread.
+ *
+ * @see #syncExec
+ */
+protected void asyncExec (Runnable runnable) {
+	if (runnable == null) {
+		display.wake ();
+		return;
+	}
+	addLast (new RunnableLock (runnable));
+}
+
+int getMessageCount () {
+	synchronized (messageLock) {
+		return messageCount;
+	}
+}
+
+void releaseSynchronizer () {
+	display = null;
+	messages = null;
+	messageLock = null;
+	syncThread = null;
+}
+
+RunnableLock removeFirst () {
+	synchronized (messageLock) {
+		if (messageCount == 0) return null;
+		RunnableLock lock = messages [0];
+		System.arraycopy (messages, 1, messages, 0, --messageCount);
+		messages [messageCount] = null;
+		if (messageCount == 0) {
+			if (messages.length > 64) messages = null;
+		}
+		return lock;
+	}
+}
+
+boolean runAsyncMessages () {
+	return runAsyncMessages (false);
+}
+
+boolean runAsyncMessages (boolean all) {
+	boolean run = false;
+	do {
+		RunnableLock lock = removeFirst ();
+		if (lock == null) return run;
+		run = true;
+		synchronized (lock) {
+			syncThread = lock.thread;
+			try {
+				lock.run ();
+			} catch (Throwable t) {
+				lock.throwable = t;
+				SWT.error (SWT.ERROR_FAILED_EXEC, t);
+			} finally {
+				syncThread = null;
+				lock.notifyAll ();
+			}
+		}
+	} while (all);
+	return run;
+}
+
+/**
+ * Causes the <code>run()</code> method of the runnable to
+ * be invoked by the user-interface thread at the next
+ * reasonable opportunity. The thread which calls this method
+ * is suspended until the runnable completes.
+ *
+ * @param runnable code to run on the user-interface thread.
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_FAILED_EXEC - if an exception occurred when executing the runnable</li>
+ * </ul>
+ *
+ * @see #asyncExec
+ */
+protected void syncExec (Runnable runnable) {
+	if (display.isValidThread ()) {
+		if (runnable != null) runnable.run ();
+		return;
+	}
+	if (runnable == null) {
+		display.wake ();
+		return;
+	}
+	RunnableLock lock = new RunnableLock (runnable);
+	/*
+	 * Only remember the syncThread for syncExec.
+	 */
+	lock.thread = Thread.currentThread();
+	synchronized (lock) {
+		addLast (lock);
+		boolean interrupted = false;
+		while (!lock.done ()) {
+			try {
+				lock.wait ();
+			} catch (InterruptedException e) {
+				interrupted = true;
+			}
+		}
+		if (interrupted) {
+			Compatibility.interrupt();
+		}
+		if (lock.throwable != null) {
+			SWT.error (SWT.ERROR_FAILED_EXEC, lock.throwable);
+		}
+	}
+}
+
+}
+++/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/Tray.d	Tue Jan 08 01:23:25 2008 +0100
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.Tray;
+
+class Tray{}
+
+/++
+import dwt.*;
+
+/**
+ * Instances of this class represent the system tray that is part
+ * of the task bar status area on some operating systems.
+ *
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ *
+ * @see Display#getSystemTray
+ *
+ * @since 3.0
+ */
+public class Tray extends Widget {
+	int itemCount;
+	TrayItem [] items = new TrayItem [4];
+
+Tray (Display display, int style) {
+	if (display == null) display = Display.getCurrent ();
+	if (display == null) display = Display.getDefault ();
+	if (!display.isValidThread ()) {
+		error (SWT.ERROR_THREAD_INVALID_ACCESS);
+	}
+	this.display = display;
+}
+
+void createItem (TrayItem item, int index) {
+	if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_INVALID_RANGE);
+	if (itemCount == items.length) {
+		TrayItem [] newItems = new TrayItem [items.length + 4];
+		System.arraycopy (items, 0, newItems, 0, items.length);
+		items = newItems;
+	}
+	System.arraycopy (items, index, items, index + 1, itemCount++ - index);
+	items [index] = item;
+}
+
+void destroyItem (TrayItem item) {
+	int index = 0;
+	while (index < itemCount) {
+		if (items [index] == item) break;
+		index++;
+	}
+	if (index == itemCount) return;
+	System.arraycopy (items, index + 1, items, index, --itemCount - index);
+	items [itemCount] = null;
+}
+
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TrayItem getItem (int index) {
+	checkWidget ();
+	if (!(0 <= index && index < itemCount)) error (SWT.ERROR_INVALID_RANGE);
+	return items [index];
+}
+
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+	checkWidget ();
+	return itemCount;
+}
+
+/**
+ * Returns an array of <code>TrayItem</code>s which are the items
+ * in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TrayItem [] getItems () {
+	checkWidget ();
+	TrayItem [] result = new TrayItem [itemCount];
+	System.arraycopy (items, 0, result, 0, result.length);
+	return result;
+}
+
+void releaseChildren (boolean destroy) {
+	if (items != null) {
+		for (int i=0; i<items.length; i++) {
+			TrayItem item = items [i];
+			if (item != null && !item.isDisposed ()) {
+				item.release (false);
+			}
+		}
+		items = null;
+	}
+	super.releaseChildren (destroy);
+}
+
+void releaseParent () {
+	super.releaseParent ();
+	if (display.tray == this) display.tray = null;
+}
+
+}
+++/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/widgets/Widget.d	Tue Jan 08 01:23:25 2008 +0100
@@ -0,0 +1,1532 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module dwt.widgets.Widget;
+
+class Widget{
+}
+/++
+import dwt.SWT;
+import dwt.internal.*;
+import dwt.internal.gtk.*;
+import dwt.events.*;
+
+/**
+ * This class is the abstract superclass of all user interface objects.
+ * Widgets are created, disposed and issue notification to listeners
+ * when events occur which affect them.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Dispose</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation. However, it has not been marked
+ * final to allow those outside of the SWT development team to implement
+ * patched versions of the class in order to get around specific
+ * limitations in advance of when those limitations can be addressed
+ * by the team.  Any class built using subclassing to access the internals
+ * of this class will likely fail to compile or run between releases and
+ * may be strongly platform specific. Subclassing should not be attempted
+ * without an intimate and detailed understanding of the workings of the
+ * hierarchy. No support is provided for user-written classes which are
+ * implemented as subclasses of this class.
+ * </p>
+ *
+ * @see #checkSubclass
+ */
+public abstract class Widget {
+	/**
+	 * the handle to the OS resource
+	 * (Warning: This field is platform dependent)
+	 * <p>
+	 * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT
+	 * public API. It is marked public only so that it can be shared
+	 * within the packages provided by SWT. It is not available on all
+	 * platforms and should never be accessed from application code.
+	 * </p>
+	 */
+	public int /*long*/ handle;
+	int style, state;
+	Display display;
+	EventTable eventTable;
+	Object data;
+
+	/* Global state flags */
+	static final int DISPOSED = 1<<0;
+	static final int CANVAS = 1<<1;
+	static final int KEYED_DATA = 1<<2;
+	static final int HANDLE = 1<<3;
+	static final int DISABLED = 1<<4;
+	static final int MENU = 1<<5;
+	static final int OBSCURED = 1<<6;
+	static final int MOVED = 1<<7;
+	static final int RESIZED = 1<<8;
+	static final int ZERO_WIDTH = 1<<9;
+	static final int ZERO_HEIGHT = 1<<10;
+	static final int HIDDEN = 1<<11;
+	static final int FOREGROUND = 1<<12;
+	static final int BACKGROUND = 1<<13;
+	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<<17;
+
+	/* The preferred size of a child has changed */
+	static final int LAYOUT_CHANGED = 1<<18;
+
+	/* A layout was requested in this widget hierachy */
+	static final int LAYOUT_CHILD = 1<<19;
+
+	/* More global state flags */
+	static final int RELEASED = 1<<20;
+	static final int DISPOSE_SENT = 1<<21;
+	static final int FOREIGN_HANDLE = 1<<22;
+	static final int DRAG_DETECT = 1<<23;
+
+	/* Default size for widgets */
+	static final int DEFAULT_WIDTH	= 64;
+	static final int DEFAULT_HEIGHT	= 64;
+
+	/* GTK signals data */
+	static final int ACTIVATE = 1;
+	static final int BUTTON_PRESS_EVENT = 2;
+	static final int BUTTON_PRESS_EVENT_INVERSE = 3;
+	static final int BUTTON_RELEASE_EVENT = 4;
+	static final int BUTTON_RELEASE_EVENT_INVERSE = 5;
+	static final int CHANGED = 6;
+	static final int CHANGE_VALUE = 7;
+	static final int CLICKED = 8;
+	static final int COMMIT = 9;
+	static final int CONFIGURE_EVENT = 10;
+	static final int DELETE_EVENT = 11;
+	static final int DELETE_RANGE = 12;
+	static final int DELETE_TEXT = 13;
+	static final int ENTER_NOTIFY_EVENT = 14;
+	static final int EVENT = 15;
+	static final int EVENT_AFTER = 16;
+	static final int EXPAND_COLLAPSE_CURSOR_ROW = 17;
+	static final int EXPOSE_EVENT = 18;
+	static final int EXPOSE_EVENT_INVERSE = 19;
+	static final int FOCUS = 20;
+	static final int FOCUS_IN_EVENT = 21;
+	static final int FOCUS_OUT_EVENT = 22;
+	static final int GRAB_FOCUS = 23;
+	static final int HIDE = 24;
+	static final int INPUT = 25;
+	static final int INSERT_TEXT = 26;
+	static final int KEY_PRESS_EVENT = 27;
+	static final int KEY_RELEASE_EVENT = 28;
+	static final int LEAVE_NOTIFY_EVENT = 29;
+	static final int MAP = 30;
+	static final int MAP_EVENT = 31;
+	static final int MNEMONIC_ACTIVATE = 32;
+	static final int MOTION_NOTIFY_EVENT = 33;
+	static final int MOTION_NOTIFY_EVENT_INVERSE = 34;
+	static final int MOVE_FOCUS = 35;
+	static final int OUTPUT = 36;
+	static final int POPUP_MENU = 37;
+	static final int PREEDIT_CHANGED = 38;
+	static final int REALIZE = 39;
+	static final int ROW_ACTIVATED = 40;
+	static final int SCROLL_CHILD = 41;
+	static final int SCROLL_EVENT = 42;
+	static final int SELECT = 43;
+	static final int SHOW = 44;
+	static final int SHOW_HELP = 45;
+	static final int SIZE_ALLOCATE = 46;
+	static final int STYLE_SET = 47;
+	static final int SWITCH_PAGE = 48;
+	static final int TEST_COLLAPSE_ROW = 49;
+	static final int TEST_EXPAND_ROW = 50;
+	static final int TEXT_BUFFER_INSERT_TEXT = 51;
+	static final int TOGGLED = 52;
+	static final int UNMAP = 53;
+	static final int UNMAP_EVENT = 54;
+	static final int UNREALIZE = 55;
+	static final int VALUE_CHANGED = 56;
+	static final int VISIBILITY_NOTIFY_EVENT = 57;
+	static final int WINDOW_STATE_EVENT = 58;
+	static final int ACTIVATE_INVERSE = 59;
+	static final int DAY_SELECTED = 60;
+	static final int MONTH_CHANGED = 61;
+	static final int LAST_SIGNAL = 62;
+
+/**
+ * Prevents uninitialized instances from being created outside the package.
+ */
+Widget () {}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * lists the style constants that are applicable to the class.
+ * Style bits are also inherited from superclasses.
+ * </p>
+ *
+ * @param parent a widget which will be the parent of the new instance (cannot be null)
+ * @param style the style of widget to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ *    <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see #checkSubclass
+ * @see #getStyle
+ */
+public Widget (Widget parent, int style) {
+	checkSubclass ();
+	checkParent (parent);
+	this.style = style;
+	display = parent.display;
+}
+
+void _addListener (int eventType, Listener listener) {
+	if (eventTable == null) eventTable = new EventTable ();
+	eventTable.hook (eventType, listener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when an event of the given type occurs. When the
+ * event does occur in the widget, the listener is notified by
+ * sending it the <code>handleEvent()</code> message. The event
+ * type is one of the event constants defined in class <code>SWT</code>.
+ *
+ * @param eventType the type of event to listen for
+ * @param listener the listener which should be notified when the event occurs
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Listener
+ * @see SWT
+ * @see #removeListener(int, Listener)
+ * @see #notifyListeners
+ */
+public void addListener (int eventType, Listener listener) {
+	checkWidget ();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	_addListener (eventType, listener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the widget is disposed. When the widget is
+ * disposed, the listener is notified by sending it the
+ * <code>widgetDisposed()</code> message.
+ *
+ * @param listener the listener which should be notified when the receiver is disposed
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see DisposeListener
+ * @see #removeDisposeListener
+ */
+public void addDisposeListener (DisposeListener listener) {
+	checkWidget ();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	TypedListener typedListener = new TypedListener (listener);
+	addListener (SWT.Dispose, typedListener);
+}
+
+int /*long*/ paintWindow () {
+	return 0;
+}
+
+static int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) {
+	int mask = int0 | int1 | int2 | int3 | int4 | int5;
+	if ((style & mask) == 0) style |= int0;
+	if ((style & int0) != 0) style = (style & ~mask) | int0;
+	if ((style & int1) != 0) style = (style & ~mask) | int1;
+	if ((style & int2) != 0) style = (style & ~mask) | int2;
+	if ((style & int3) != 0) style = (style & ~mask) | int3;
+	if ((style & int4) != 0) style = (style & ~mask) | int4;
+	if ((style & int5) != 0) style = (style & ~mask) | int5;
+	return style;
+}
+
+int /*long*/ cellDataProc (int /*long*/ tree_column, int /*long*/ cell, int /*long*/ tree_model, int /*long*/ iter, int /*long*/ data) {
+	return 0;
+}
+
+void checkOpen () {
+	/* Do nothing */
+}
+
+void checkOrientation (Widget parent) {
+	style &= ~SWT.MIRRORED;
+	if ((style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT)) == 0) {
+		if (parent != null) {
+			if ((parent.style & SWT.LEFT_TO_RIGHT) != 0) style |= SWT.LEFT_TO_RIGHT;
+			if ((parent.style & SWT.RIGHT_TO_LEFT) != 0) style |= SWT.RIGHT_TO_LEFT;
+		}
+	}
+	style = checkBits (style, SWT.LEFT_TO_RIGHT, SWT.RIGHT_TO_LEFT, 0, 0, 0, 0);
+}
+
+/**
+ * Throws an exception if the specified widget can not be
+ * used as a parent for the receiver.
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ *    <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * </ul>
+ */
+void checkParent (Widget parent) {
+	if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (parent.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
+	parent.checkWidget ();
+	parent.checkOpen ();
+}
+
+/**
+ * Checks that this class can be subclassed.
+ * <p>
+ * The SWT class library is intended to be subclassed
+ * only at specific, controlled points (most notably,
+ * <code>Composite</code> and <code>Canvas</code> when
+ * implementing new widgets). This method enforces this
+ * rule unless it is overridden.
+ * </p><p>
+ * <em>IMPORTANT:</em> By providing an implementation of this
+ * method that allows a subclass of a class which does not
+ * normally allow subclassing to be created, the implementer
+ * agrees to be fully responsible for the fact that any such
+ * subclass will likely fail between SWT releases and will be
+ * strongly platform specific. No support is provided for
+ * user-written classes which are implemented in this fashion.
+ * </p><p>
+ * The ability to subclass outside of the allowed SWT classes
+ * is intended purely to enable those not on the SWT development
+ * team to implement patches in order to get around specific
+ * limitations in advance of when those limitations can be
+ * addressed by the team. Subclassing should not be attempted
+ * without an intimate and detailed understanding of the hierarchy.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+protected void checkSubclass () {
+	if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
+}
+
+/**
+ * Throws an <code>SWTException</code> if the receiver can not
+ * be accessed by the caller. This may include both checks on
+ * the state of the receiver and more generally on the entire
+ * execution context. This method <em>should</em> be called by
+ * widget implementors to enforce the standard SWT invariants.
+ * <p>
+ * Currently, it is an error to invoke any method (other than
+ * <code>isDisposed()</code>) on a widget that has had its
+ * <code>dispose()</code> method called. It is also an error
+ * to call widget methods from any thread that is different
+ * from the thread that created the widget.
+ * </p><p>
+ * In future releases of SWT, there may be more or fewer error
+ * checks and exceptions may be thrown for different reasons.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+protected void checkWidget () {
+	Display display = this.display;
+	if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
+	if (display.thread != Thread.currentThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+	if ((state & DISPOSED) != 0) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+
+void createHandle (int index) {
+}
+
+void createWidget (int index) {
+	createHandle (index);
+	setOrientation ();
+	hookEvents ();
+	register ();
+}
+
+void deregister () {
+	if (handle == 0) return;
+	if ((state & HANDLE) != 0) display.removeWidget (handle);
+}
+
+void destroyWidget () {
+	int /*long*/ topHandle = topHandle ();
+	releaseHandle ();
+	if (topHandle != 0 && (state & HANDLE) != 0) {
+		OS.gtk_widget_destroy (topHandle);
+	}
+}
+
+/**
+ * Disposes of the operating system resources associated with
+ * the receiver and all its descendants. After this method has
+ * been invoked, the receiver and all descendants will answer
+ * <code>true</code> when sent the message <code>isDisposed()</code>.
+ * Any internal connections between the widgets in the tree will
+ * have been removed to facilitate garbage collection.
+ * <p>
+ * NOTE: This method is not called recursively on the descendants
+ * of the receiver. This means that, widget implementers can not
+ * detect when a widget is being disposed of by re-implementing
+ * this method, but should instead listen for the <code>Dispose</code>
+ * event.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #addDisposeListener
+ * @see #removeDisposeListener
+ * @see #checkWidget
+ */
+public void dispose () {
+	/*
+	* Note:  It is valid to attempt to dispose a widget
+	* more than once.  If this happens, fail silently.
+	*/
+	if (isDisposed ()) return;
+	if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+	release (true);
+}
+
+void error (int code) {
+	SWT.error (code);
+}
+
+/**
+ * Returns the application defined widget data associated
+ * with the receiver, or null if it has not been set. The
+ * <em>widget data</em> is a single, unnamed field that is
+ * stored with every widget.
+ * <p>
+ * Applications may put arbitrary objects in this field. If
+ * the object stored in the widget data needs to be notified
+ * when the widget is disposed of, it is the application's
+ * responsibility to hook the Dispose event on the widget and
+ * do so.
+ * </p>
+ *
+ * @return the widget data
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
+ * </ul>
+ *
+ * @see #setData(Object)
+ */
+public Object getData () {
+	checkWidget();
+	return (state & KEYED_DATA) != 0 ? ((Object []) data) [0] : data;
+}
+/**
+ * Returns the application defined property of the receiver
+ * with the specified name, or null if it has not been set.
+ * <p>
+ * Applications may have associated arbitrary objects with the
+ * receiver in this fashion. If the objects stored in the
+ * properties need to be notified when the widget is disposed
+ * of, it is the application's responsibility to hook the
+ * Dispose event on the widget and do so.
+ * </p>
+ *
+ * @param	key the name of the property
+ * @return the value of the property or null if it has not been set
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setData(String, Object)
+ */
+public Object getData (String key) {
+	checkWidget();
+	if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if ((state & KEYED_DATA) != 0) {
+		Object [] table = (Object []) data;
+		for (int i=1; i<table.length; i+=2) {
+			if (key.equals (table [i])) return table [i+1];
+		}
+	}
+	return null;
+}
+
+/**
+ * Returns the <code>Display</code> that is associated with
+ * the receiver.
+ * <p>
+ * A widget's display is either provided when it is created
+ * (for example, top level <code>Shell</code>s) or is the
+ * same as its parent's display.
+ * </p>
+ *
+ * @return the receiver's display
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Display getDisplay () {
+	Display display = this.display;
+	if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
+	return display;
+}
+
+String getName () {
+//	String string = getClass ().getName ();
+//	int index = string.lastIndexOf ('.');
+//	if (index == -1) return string;
+	String string = getClass ().getName ();
+	int index = string.length ();
+	while ((--index > 0) && (string.charAt (index) != '.')) {}
+	return string.substring (index + 1, string.length ());
+}
+
+String getNameText () {
+	return "";
+}
+
+/**
+ * Returns the receiver's style information.
+ * <p>
+ * Note that the value which is returned by this method <em>may
+ * not match</em> the value which was provided to the constructor
+ * when the receiver was created. This can occur when the underlying
+ * operating system does not support a particular combination of
+ * requested styles. For example, if the platform widget used to
+ * implement a particular SWT widget always has scroll bars, the
+ * result of calling this method would always have the
+ * <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set.
+ * </p>
+ *
+ * @return the style bits
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getStyle () {
+	checkWidget ();
+	return style;
+}
+
+
+int /*long*/ gtk_activate (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_button_release_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_changed (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_change_value (int /*long*/ widget, int /*long*/ scroll, int /*long*/ value1, int /*long*/ value2) {
+	return 0;
+}
+
+int /*long*/ gtk_clicked (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_commit (int /*long*/ imcontext, int /*long*/ text) {
+	return 0;
+}
+
+int /*long*/ gtk_configure_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_day_selected (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_delete_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_delete_range (int /*long*/ widget, int /*long*/ iter1, int /*long*/ iter2) {
+	return 0;
+}
+
+int /*long*/ gtk_delete_text (int /*long*/ widget, int /*long*/ start_pos, int /*long*/ end_pos) {
+	return 0;
+}
+
+int /*long*/ gtk_enter_notify_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_event_after (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_expand_collapse_cursor_row (int /*long*/ widget, int /*long*/ logical, int /*long*/ expand, int /*long*/ open_all) {
+	return 0;
+}
+
+int /*long*/ gtk_expose_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_focus (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_focus_in_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_focus_out_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_grab_focus (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_hide (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_input (int /*long*/ widget, int /*long*/ arg1) {
+	return 0;
+}
+
+int /*long*/ gtk_insert_text (int /*long*/ widget, int /*long*/ new_text, int /*long*/ new_text_length, int /*long*/ position) {
+	return 0;
+}
+
+int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) {
+	GdkEventKey gdkEvent = new GdkEventKey ();
+	OS.memmove (gdkEvent, event, GdkEventKey.sizeof);
+	return sendKeyEvent (SWT.KeyDown, gdkEvent) ? 0 : 1;
+}
+
+int /*long*/ gtk_key_release_event (int /*long*/ widget, int /*long*/ event) {
+	GdkEventKey gdkEvent = new GdkEventKey ();
+	OS.memmove (gdkEvent, event, GdkEventKey.sizeof);
+	return sendKeyEvent (SWT.KeyUp, gdkEvent) ? 0 : 1;
+}
+
+int /*long*/ gtk_leave_notify_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_map (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_map_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_mnemonic_activate (int /*long*/ widget, int /*long*/ arg1) {
+	return 0;
+}
+
+int /*long*/ gtk_month_changed (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_move_focus (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_output (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_popup_menu (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_preedit_changed (int /*long*/ imcontext) {
+	return 0;
+}
+
+int /*long*/ gtk_realize (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_row_activated (int /*long*/ tree, int /*long*/ path, int /*long*/ column) {
+	return 0;
+}
+
+int /*long*/ gtk_scroll_child (int /*long*/ widget, int /*long*/ scrollType, int /*long*/ horizontal) {
+	return 0;
+}
+
+int /*long*/ gtk_scroll_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_select (int /*long*/ item) {
+	return 0;
+}
+
+int /*long*/ gtk_show (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_show_help (int /*long*/ widget, int /*long*/ helpType) {
+	return 0;
+}
+
+int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) {
+	return 0;
+}
+
+int /*long*/ gtk_style_set (int /*long*/ widget, int /*long*/ previousStyle) {
+	return 0;
+}
+
+int /*long*/ gtk_switch_page (int /*long*/ widget, int /*long*/ page, int /*long*/ page_num) {
+	return 0;
+}
+
+int /*long*/ gtk_test_collapse_row (int /*long*/ tree, int /*long*/ iter, int /*long*/ path) {
+	return 0;
+}
+
+int /*long*/ gtk_test_expand_row (int /*long*/ tree, int /*long*/ iter, int /*long*/ path) {
+	return 0;
+}
+
+int /*long*/ gtk_text_buffer_insert_text (int /*long*/ widget, int /*long*/ iter, int /*long*/ text, int /*long*/ length) {
+	return 0;
+}
+
+int /*long*/ gtk_timer () {
+	return 0;
+}
+
+int /*long*/ gtk_toggled (int /*long*/ renderer, int /*long*/ pathStr) {
+	return 0;
+}
+
+int /*long*/ gtk_unmap (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_unmap_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_unrealize (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ gtk_value_changed (int /*long*/ adjustment) {
+	return 0;
+}
+
+int /*long*/ gtk_visibility_notify_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int /*long*/ gtk_window_state_event (int /*long*/ widget, int /*long*/ event) {
+	return 0;
+}
+
+int fontHeight (int /*long*/ font, int /*long*/ widgetHandle) {
+	int /*long*/ context = OS.gtk_widget_get_pango_context (widgetHandle);
+	int /*long*/ lang = OS.pango_context_get_language (context);
+	int /*long*/ metrics = OS.pango_context_get_metrics (context, font, lang);
+	int ascent = OS.pango_font_metrics_get_ascent (metrics);
+	int descent = OS.pango_font_metrics_get_descent (metrics);
+	OS.pango_font_metrics_unref (metrics);
+	return OS.PANGO_PIXELS (ascent + descent);
+}
+
+int /*long*/ filterProc(int /*long*/ xEvent, int /*long*/ gdkEvent, int /*long*/ data2) {
+	return 0;
+}
+
+boolean filters (int eventType) {
+	return display.filters (eventType);
+}
+
+int /*long*/ fixedMapProc (int /*long*/ widget) {
+	return 0;
+}
+
+char [] fixMnemonic (String string) {
+	int length = string.length ();
+	char [] text = new char [length];
+	string.getChars (0, length, text, 0);
+	int i = 0, j = 0;
+	char [] result = new char [length * 2];
+	while (i < length) {
+		switch (text [i]) {
+			case '&':
+				if (i + 1 < length && text [i + 1] == '&') {
+					i++;
+				} else {
+					text [i] = '_';
+				}
+				break;
+			case '_':
+				result [j++] = '_';
+				break;
+		}
+		result [j++] = text [i++];
+	}
+	return result;
+}
+
+/**
+ * Returns <code>true</code> if the widget has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the widget.
+ * When a widget has been disposed, it is an error to
+ * invoke any other method using the widget.
+ * </p>
+ *
+ * @return <code>true</code> when the widget is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed () {
+	return (state & DISPOSED) != 0;
+}
+
+/**
+ * Returns <code>true</code> if there are any listeners
+ * for the specified event type associated with the receiver,
+ * and <code>false</code> otherwise. The event type is one of
+ * the event constants defined in class <code>SWT</code>.
+ *
+ * @param eventType the type of event
+ * @return true if the event is hooked
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SWT
+ */
+public boolean isListening (int eventType) {
+	checkWidget ();
+	return hooks (eventType);
+}
+
+boolean isValidThread () {
+	return getDisplay ().isValidThread ();
+}
+
+boolean isValidSubclass() {
+	return Display.isValidClass(getClass());
+}
+
+void hookEvents () {
+}
+
+/*
+ * Returns <code>true</code> if the specified eventType is
+ * hooked, and <code>false</code> otherwise. Implementations
+ * of SWT can avoid creating objects and sending events
+ * when an event happens in the operating system but
+ * there are no listeners hooked for the event.
+ *
+ * @param eventType the event to be checked
+ *
+ * @return <code>true</code> when the eventType is hooked and <code>false</code> otherwise
+ *
+ * @see #isListening
+ */
+boolean hooks (int eventType) {
+	if (eventTable == null) return false;
+	return eventTable.hooks (eventType);
+}
+
+int /*long*/ hoverProc (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ menuPositionProc (int /*long*/ menu, int /*long*/ x, int /*long*/ y, int /*long*/ push_in, int /*long*/ user_data) {
+	return 0;
+}
+
+boolean mnemonicHit (int /*long*/ mnemonicHandle, char key) {
+	if (!mnemonicMatch (mnemonicHandle, key)) return false;
+	OS.g_signal_handlers_block_matched (mnemonicHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, MNEMONIC_ACTIVATE);
+	boolean result = OS.gtk_widget_mnemonic_activate (mnemonicHandle, false);
+	OS.g_signal_handlers_unblock_matched (mnemonicHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, MNEMONIC_ACTIVATE);
+	return result;
+}
+
+boolean mnemonicMatch (int /*long*/ mnemonicHandle, char key) {
+	int keyval1 = OS.gdk_keyval_to_lower (OS.gdk_unicode_to_keyval (key));
+	int keyval2 = OS.gdk_keyval_to_lower (OS.gtk_label_get_mnemonic_keyval (mnemonicHandle));
+	return keyval1 == keyval2;
+}
+
+/**
+ * Notifies all of the receiver's listeners for events
+ * of the given type that one such event has occurred by
+ * invoking their <code>handleEvent()</code> method.  The
+ * event type is one of the event constants defined in class
+ * <code>SWT</code>.
+ *
+ * @param eventType the type of event which has occurred
+ * @param event the event data
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see #addListener
+ * @see #removeListener(int, Listener)
+ */
+public void notifyListeners (int eventType, Event event) {
+	checkWidget();
+	if (event == null) event = new Event ();
+	sendEvent (eventType, event);
+}
+
+void postEvent (int eventType) {
+	sendEvent (eventType, null, false);
+}
+
+void postEvent (int eventType, Event event) {
+	sendEvent (eventType, event, false);
+}
+
+void register () {
+	if (handle == 0) return;
+	if ((state & HANDLE) != 0) display.addWidget (handle, this);
+}
+
+void release (boolean destroy) {
+	if ((state & DISPOSE_SENT) == 0) {
+		state |= DISPOSE_SENT;
+		sendEvent (SWT.Dispose);
+	}
+	if ((state & DISPOSED) == 0) {
+		releaseChildren (destroy);
+	}
+	if ((state & RELEASED) == 0) {
+		state |= RELEASED;
+		if (destroy) {
+			releaseParent ();
+			releaseWidget ();
+			destroyWidget ();
+		} else {
+			releaseWidget ();
+			releaseHandle ();
+		}
+	}
+}
+
+void releaseChildren (boolean destroy) {
+}
+
+void releaseHandle () {
+	handle = 0;
+	state |= DISPOSED;
+	display = null;
+}
+
+void releaseParent () {
+	/* Do nothing */
+}
+
+void releaseWidget () {
+	deregister ();
+	eventTable = null;
+	data = null;
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when an event of the given type occurs. The event
+ * type is one of the event constants defined in class <code>SWT</code>.
+ *
+ * @param eventType the type of event to listen for
+ * @param listener the listener which should no longer be notified when the event occurs
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Listener
+ * @see SWT
+ * @see #addListener
+ * @see #notifyListeners
+ */
+public void removeListener (int eventType, Listener handler) {
+	checkWidget ();
+	if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (eventType, handler);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when an event of the given type occurs.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the SWT
+ * public API. It is marked public only so that it can be shared
+ * within the packages provided by SWT. It should never be
+ * referenced from application code.
+ * </p>
+ *
+ * @param eventType the type of event to listen for
+ * @param listener the listener which should no longer be notified when the event occurs
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Listener
+ * @see #addListener
+ */
+protected void removeListener (int eventType, SWTEventListener handler) {
+	checkWidget ();
+	if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (eventType, handler);
+}
+
+int /*long*/ rendererGetSizeProc (int /*long*/ cell, int /*long*/ handle, int /*long*/ cell_area, int /*long*/ x_offset, int /*long*/ y_offset, int /*long*/ width, int /*long*/ height) {
+	return 0;
+}
+
+int /*long*/ rendererRenderProc (int /*long*/ cell, int /*long*/ window, int /*long*/ handle, int /*long*/ background_area, int /*long*/ cell_area, int /*long*/ expose_area, int /*long*/ flags) {
+	return 0;
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the widget is disposed.
+ *
+ * @param listener the listener which should no longer be notified when the receiver is disposed
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see DisposeListener
+ * @see #addDisposeListener
+ */
+public void removeDisposeListener (DisposeListener listener) {
+	checkWidget ();
+	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+	if (eventTable == null) return;
+	eventTable.unhook (SWT.Dispose, listener);
+}
+
+void sendEvent (Event event) {
+	Display display = event.display;
+	if (!display.filterEvent (event)) {
+		if (eventTable != null) eventTable.sendEvent (event);
+	}
+}
+
+void sendEvent (int eventType) {
+	sendEvent (eventType, null, true);
+}
+
+void sendEvent (int eventType, Event event) {
+	sendEvent (eventType, event, true);
+}
+
+void sendEvent (int eventType, Event event, boolean send) {
+	if (eventTable == null && !display.filters (eventType)) {
+		return;
+	}
+	if (event == null) event = new Event ();
+	event.type = eventType;
+	event.display = display;
+	event.widget = this;
+	if (event.time == 0) {
+		event.time = display.getLastEventTime ();
+	}
+	if (send) {
+		sendEvent (event);
+	} else {
+		display.postEvent (event);
+	}
+}
+
+boolean sendKeyEvent (int type, GdkEventKey keyEvent) {
+	int length = keyEvent.length;
+	if (keyEvent.string == 0 || OS.g_utf8_strlen (keyEvent.string, length) <= 1) {
+		Event event = new Event ();
+		event.time = keyEvent.time;
+		if (!setKeyState (event, keyEvent)) return true;
+		sendEvent (type, event);
+		// widget could be disposed at this point
+
+		/*
+		* It is possible (but unlikely), that application
+		* code could have disposed the widget in the key
+		* events.  If this happens, end the processing of
+		* the key by returning false.
+		*/
+		if (isDisposed ()) return false;
+		return event.doit;
+	}
+	byte [] buffer = new byte [length];
+	OS.memmove (buffer, keyEvent.string, length);
+	char [] chars = Converter.mbcsToWcs (null, buffer);
+	return sendIMKeyEvent (type, keyEvent, chars) != null;
+}
+
+char [] sendIMKeyEvent (int type, GdkEventKey keyEvent, char  [] chars) {
+	int index = 0, count = 0, state = 0;
+	int /*long*/ ptr = 0;
+	if (keyEvent == null) {
+		ptr = OS.gtk_get_current_event ();
+		if (ptr != 0) {
+			keyEvent = new GdkEventKey ();
+			OS.memmove (keyEvent, ptr, GdkEventKey.sizeof);
+			switch (keyEvent.type) {
+				case OS.GDK_KEY_PRESS:
+				case OS.GDK_KEY_RELEASE:
+					state = keyEvent.state;
+					break;
+				default:
+					keyEvent = null;
+					break;
+			}
+		}
+	}
+	if (keyEvent == null) {
+		int [] buffer = new int [1];
+		OS.gtk_get_current_event_state (buffer);
+		state = buffer [0];
+	}
+	while (index < chars.length) {
+		Event event = new Event ();
+		if (keyEvent != null && chars.length <= 1) {
+			setKeyState (event, keyEvent);
+		} else {
+			setInputState (event, state);
+		}
+		event.character = chars [index];
+		sendEvent (type, event);
+
+		/*
+		* It is possible (but unlikely), that application
+		* code could have disposed the widget in the key
+		* events.  If this happens, end the processing of
+		* the key by returning null.
+		*/
+		if (isDisposed ()) {
+			if (ptr != 0) OS.gdk_event_free (ptr);
+			return null;
+		}
+		if (event.doit) chars [count++] = chars [index];
+		index++;
+	}
+	if (ptr != 0) OS.gdk_event_free (ptr);
+	if (count == 0) return null;
+	if (index != count) {
+		char [] result = new char [count];
+		System.arraycopy (chars, 0, result, 0, count);
+		return result;
+	}
+	return chars;
+}
+
+/**
+ * Sets the application defined widget data associated
+ * with the receiver to be the argument. The <em>widget
+ * data</em> is a single, unnamed field that is stored
+ * with every widget.
+ * <p>
+ * Applications may put arbitrary objects in this field. If
+ * the object stored in the widget data needs to be notified
+ * when the widget is disposed of, it is the application's
+ * responsibility to hook the Dispose event on the widget and
+ * do so.
+ * </p>
+ *
+ * @param data the widget data
+ *
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
+ * </ul>
+ *
+ * @see #getData()
+ */
+public void setData (Object data) {
+	checkWidget();
+	if ((state & KEYED_DATA) != 0) {
+		((Object []) this.data) [0] = data;
+	} else {
+		this.data = data;
+	}
+}
+
+/**
+ * Sets the application defined property of the receiver
+ * with the specified name to the given value.
+ * <p>
+ * Applications may associate arbitrary objects with the
+ * receiver in this fashion. If the objects stored in the
+ * properties need to be notified when the widget is disposed
+ * of, it is the application's responsibility to hook the
+ * Dispose event on the widget and do so.
+ * </p>
+ *
+ * @param key the name of the property
+ * @param value the new value for the property
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getData(String)
+ */
+public void setData (String key, Object value) {
+	checkWidget();
+	if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
+	int index = 1;
+	Object [] table = null;
+	if ((state & KEYED_DATA) != 0) {
+		table = (Object []) data;
+		while (index < table.length) {
+			if (key.equals (table [index])) break;
+			index += 2;
+		}
+	}
+	if (value != null) {
+		if ((state & KEYED_DATA) != 0) {
+			if (index == table.length) {
+				Object [] newTable = new Object [table.length + 2];
+				System.arraycopy (table, 0, newTable, 0, table.length);
+				data = table = newTable;
+			}
+		} else {
+			table = new Object [3];
+			table [0] = data;
+			data = table;
+			state |= KEYED_DATA;
+		}
+		table [index] = key;
+		table [index + 1] = value;
+	} else {
+		if ((state & KEYED_DATA) != 0) {
+			if (index != table.length) {
+				int length = table.length - 2;
+				if (length == 1) {
+					data = table [0];
+					state &= ~KEYED_DATA;
+				} else {
+					Object [] newTable = new Object [length];
+					System.arraycopy (table, 0, newTable, 0, index);
+					System.arraycopy (table, index + 2, newTable, index, length - index);
+					data = newTable;
+				}
+			}
+		}
+	}
+}
+
+void setForegroundColor (int /*long*/ handle, GdkColor color) {
+	int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
+	OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_NORMAL, color);
+	OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_ACTIVE, color);
+	OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_PRELIGHT, color);
+	int flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
+	flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
+	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags);
+	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
+	flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
+	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
+	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);
+	flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
+	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);
+
+	OS.gtk_rc_style_set_text (style, OS.GTK_STATE_NORMAL, color);
+	OS.gtk_rc_style_set_text (style, OS.GTK_STATE_ACTIVE, color);
+	OS.gtk_rc_style_set_text (style, OS.GTK_STATE_PRELIGHT, color);
+	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
+	flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
+	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags);
+	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);
+	flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
+	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);
+	flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
+	flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
+	OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
+	OS.gtk_widget_modify_style (handle, style);
+}
+
+boolean setInputState (Event event, int state) {
+	if ((state & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
+	if ((state & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
+	if ((state & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
+	if ((state & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
+	if ((state & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
+	if ((state & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
+	return true;
+}
+
+boolean setKeyState (Event event, GdkEventKey keyEvent) {
+	if (keyEvent.string != 0 && OS.g_utf8_strlen (keyEvent.string, keyEvent.length) > 1) return false;
+	boolean isNull = false;
+	event.keyCode = Display.translateKey (keyEvent.keyval);
+	switch (keyEvent.keyval) {
+		case OS.GDK_BackSpace:		event.character = SWT.BS; break;
+		case OS.GDK_Linefeed:		event.character = SWT.LF; break;
+		case OS.GDK_KP_Enter:
+		case OS.GDK_Return: 		event.character = SWT.CR; break;
+		case OS.GDK_KP_Delete:
+		case OS.GDK_Delete:			event.character = SWT.DEL; break;
+		case OS.GDK_Escape:			event.character = SWT.ESC; break;
+		case OS.GDK_Tab:
+		case OS.GDK_ISO_Left_Tab: 	event.character = SWT.TAB; break;
+		default: {
+			if (event.keyCode == 0) {
+				int [] keyval = new int [1], effective_group= new int [1], level = new int [1], consumed_modifiers = new int [1];
+				if (OS.gdk_keymap_translate_keyboard_state(OS.gdk_keymap_get_default (), keyEvent.hardware_keycode, 0, keyEvent.group, keyval, effective_group, level, consumed_modifiers)) {
+					event.keyCode = OS.gdk_keyval_to_unicode (keyval [0]);
+				}
+			}
+			int key = keyEvent.keyval;
+			if ((keyEvent.state & OS.GDK_CONTROL_MASK) != 0 && (0 <= key && key <= 0x7F)) {
+				if ('a'  <= key && key <= 'z') key -= 'a' - 'A';
+				if (64 <= key && key <= 95) key -= 64;
+				event.character = (char) key;
+				isNull = keyEvent.keyval == '@' && key == 0;
+			} else {
+				event.character = (char) OS.gdk_keyval_to_unicode (key);
+			}
+		}
+	}
+	if (event.keyCode == 0 && event.character == 0) {
+		if (!isNull) return false;
+	}
+	return setInputState (event, keyEvent.state);
+}
+
+void setOrientation () {
+}
+
+int /*long*/ shellMapProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
+	return 0;
+}
+
+int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
+	return 0;
+}
+
+int /*long*/ sizeRequestProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
+	return 0;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the receiver
+ */
+public String toString () {
+	String string = "*Disposed*";
+	if (!isDisposed ()) {
+		string = "*Wrong Thread*";
+		if (isValidThread ()) string = getNameText ();
+	}
+	return getName () + " {" + string + "}";
+}
+
+int /*long*/ topHandle () {
+	return handle;
+}
+
+int /*long*/ timerProc (int /*long*/ widget) {
+	return 0;
+}
+
+int /*long*/ treeSelectionProc (int /*long*/ model, int /*long*/ path, int /*long*/ iter, int [] selection, int length) {
+	return 0;
+}
+
+boolean translateTraversal (int event) {
+	return false;
+}
+
+int /*long*/ windowProc (int /*long*/ handle, int /*long*/ user_data) {
+	switch ((int)/*64*/user_data) {
+		case ACTIVATE: return gtk_activate (handle);
+		case CHANGED: return gtk_changed (handle);
+		case CLICKED: return gtk_clicked (handle);
+		case DAY_SELECTED: return gtk_day_selected (handle);
+		case HIDE: return gtk_hide (handle);
+		case GRAB_FOCUS: return gtk_grab_focus (handle);
+		case MAP: return gtk_map (handle);
+		case MONTH_CHANGED: return gtk_month_changed (handle);
+		case OUTPUT: return gtk_output (handle);
+		case POPUP_MENU: return gtk_popup_menu (handle);
+		case PREEDIT_CHANGED: return gtk_preedit_changed (handle);
+		case REALIZE: return gtk_realize (handle);
+		case SELECT: return gtk_select (handle);
+		case SHOW: return gtk_show (handle);
+		case VALUE_CHANGED: return gtk_value_changed (handle);
+		case UNMAP: return gtk_unmap (handle);
+		case UNREALIZE: return gtk_unrealize (handle);
+		default: return 0;
+	}
+}
+
+int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
+	switch ((int)/*64*/user_data) {
+		case EXPOSE_EVENT_INVERSE: {
+			GdkEventExpose gdkEvent = new GdkEventExpose ();
+			OS.memmove (gdkEvent, arg0, GdkEventExpose.sizeof);
+			int /*long*/ paintWindow = paintWindow();
+			int /*long*/ window = gdkEvent.window;
+			if (window != paintWindow) return 0;
+			return (state & OBSCURED) != 0 ? 1 : 0;
+		}
+		case BUTTON_PRESS_EVENT_INVERSE:
+		case BUTTON_RELEASE_EVENT_INVERSE:
+		case MOTION_NOTIFY_EVENT_INVERSE: {
+			return 1;
+		}
+		case BUTTON_PRESS_EVENT: return gtk_button_press_event (handle, arg0);
+		case BUTTON_RELEASE_EVENT: return gtk_button_release_event (handle, arg0);
+		case COMMIT: return gtk_commit (handle, arg0);
+		case CONFIGURE_EVENT: return gtk_configure_event (handle, arg0);
+		case DELETE_EVENT: return gtk_delete_event (handle, arg0);
+		case ENTER_NOTIFY_EVENT: return gtk_enter_notify_event (handle, arg0);
+		case EVENT: return gtk_event (handle, arg0);
+		case EVENT_AFTER: return gtk_event_after (handle, arg0);
+		case EXPOSE_EVENT: return gtk_expose_event (handle, arg0);
+		case FOCUS: return gtk_focus (handle, arg0);
+		case FOCUS_IN_EVENT: return gtk_focus_in_event (handle, arg0);
+		case FOCUS_OUT_EVENT: return gtk_focus_out_event (handle, arg0);
+		case KEY_PRESS_EVENT: return gtk_key_press_event (handle, arg0);
+		case KEY_RELEASE_EVENT: return gtk_key_release_event (handle, arg0);
+		case INPUT: return gtk_input (handle, arg0);
+		case LEAVE_NOTIFY_EVENT: return gtk_leave_notify_event (handle, arg0);
+		case MAP_EVENT: return gtk_map_event (handle, arg0);
+		case MNEMONIC_ACTIVATE: return gtk_mnemonic_activate (handle, arg0);
+		case MOTION_NOTIFY_EVENT: return gtk_motion_notify_event (handle, arg0);
+		case MOVE_FOCUS: return gtk_move_focus (handle, arg0);
+		case SCROLL_EVENT:	return gtk_scroll_event (handle, arg0);
+		case SHOW_HELP: return gtk_show_help (handle, arg0);
+		case SIZE_ALLOCATE: return gtk_size_allocate (handle, arg0);
+		case STYLE_SET: return gtk_style_set (handle, arg0);
+		case TOGGLED: return gtk_toggled (handle, arg0);
+		case UNMAP_EVENT: return gtk_unmap_event (handle, arg0);
+		case VISIBILITY_NOTIFY_EVENT: return gtk_visibility_notify_event (handle, arg0);
+		case WINDOW_STATE_EVENT: return gtk_window_state_event (handle, arg0);
+		default: return 0;
+	}
+}
+
+int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) {
+	switch ((int)/*64*/user_data) {
+		case DELETE_RANGE: return gtk_delete_range (handle, arg0, arg1);
+		case DELETE_TEXT: return gtk_delete_text (handle, arg0, arg1);
+		case ROW_ACTIVATED: return gtk_row_activated (handle, arg0, arg1);
+		case SCROLL_CHILD: return gtk_scroll_child (handle, arg0, arg1);
+		case SWITCH_PAGE: return gtk_switch_page (handle, arg0, arg1);
+		case TEST_COLLAPSE_ROW: return gtk_test_collapse_row (handle, arg0, arg1);
+		case TEST_EXPAND_ROW: return gtk_test_expand_row(handle, arg0, arg1);
+		default: return 0;
+	}
+}
+
+int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) {
+	switch ((int)/*64*/user_data) {
+		case CHANGE_VALUE: return gtk_change_value (handle, arg0, arg1, arg2);
+		case EXPAND_COLLAPSE_CURSOR_ROW: return gtk_expand_collapse_cursor_row (handle, arg0, arg1, arg2);
+		case INSERT_TEXT: return gtk_insert_text (handle, arg0, arg1, arg2);
+		case TEXT_BUFFER_INSERT_TEXT: return gtk_text_buffer_insert_text (handle, arg0, arg1, arg2);
+		default: return 0;
+	}
+}
+
+}
+++/
\ No newline at end of file
--- a/todo.txt	Mon Jan 07 23:29:21 2008 +0100
+++ b/todo.txt	Tue Jan 08 01:23:25 2008 +0100
@@ -82,18 +82,18 @@
 widgets/Tray
 widgets/ImageList
 widgets/TableItem
-widgets/Shell
+widgets/Shell                          //
 widgets/ScrollBar
 widgets/Spinner
-widgets/EventTable
+widgets/EventTable                     //
 widgets/Table
 widgets/ColorDialog
 widgets/Composite
 widgets/FileDialog
 widgets/Sash
-widgets/Listener
+widgets/Listener                       // OK
 widgets/Scale
-widgets/Display
+widgets/Display                        //
 widgets/List
 widgets/TabItem
 widgets/Decorations
@@ -101,7 +101,7 @@
 widgets/Monitor
 widgets/CoolBar
 widgets/ExpandItem
-widgets/Caret
+widgets/Caret                          //
 widgets/FontDialog
 widgets/TrayItem
 widgets/ExpandBar