changeset 66:bb2217c09e61

Fixed signal blocking/unblocking: The right closure is chosen by the user_data value. In the D port the CallbackData struct is used to encapsulate also an instance pointer to the Display. When selecting the closure, the pointer of the CallbackData must be given instead of the integer constant. To make porting easier, value getter are created. They are called 'ud'+NAME.
author Frank Benoit <benoit@tionex.de>
date Sun, 13 Jan 2008 23:50:55 +0100
parents 91456f72bc45
children 15b21862b0ac
files dwt/widgets/Button.d dwt/widgets/Display.d dwt/widgets/ScrollBar.d dwt/widgets/Slider.d dwt/widgets/Spinner.d dwt/widgets/Text.d dwt/widgets/Widget.d
diffstat 7 files changed, 399 insertions(+), 162 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/widgets/Button.d	Sat Jan 12 15:38:16 2008 +0100
+++ b/dwt/widgets/Button.d	Sun Jan 13 23:50:55 2008 +0100
@@ -711,10 +711,10 @@
 public void setSelection (bool selected) {
     checkWidget();
     if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) is 0) return;
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CLICKED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCLICKED);
     OS.gtk_toggle_button_set_active (cast(GtkToggleButton*)handle, selected);
     if ((style & SWT.RADIO) !is 0) OS.gtk_toggle_button_set_active (cast(GtkToggleButton*)groupHandle, !selected);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CLICKED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCLICKED);
 }
 
 /**
--- a/dwt/widgets/Display.d	Sat Jan 12 15:38:16 2008 +0100
+++ b/dwt/widgets/Display.d	Sun Jan 13 23:50:55 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
  * 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
@@ -137,7 +137,7 @@
     int max_priority, timeout;
     void*/*Callback*/ eventCallback, filterCallback;
 
-    CallbackData*[] windowProcCallbackDatas; // to prevent GC from collect
+    CallbackData*[int] windowProcCallbackDatas; // to prevent GC from collect
 
     CallbackData  filterProcCallbackData;
     EventTable eventTable, filterTable;
@@ -596,6 +596,7 @@
 }
 
 private static extern(C) int /*long*/ allChildrenProcFunc (GtkWidget* handle, void* user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     CallbackData* cbdata = cast(CallbackData*)user_data;
     return cbdata.display.allChildrenProc( cast(GtkWidget*)handle, cast(int)cbdata.data );
 }
@@ -734,6 +735,7 @@
 }
 
 private static extern(C) int checkIfEventProcFunc (void* display, XEvent* xEvent, char* userData) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     auto disp = cast(Display)userData;
     return disp.checkIfEventProcMeth( display, xEvent );
 }
@@ -1114,6 +1116,7 @@
 }
 
 private static extern(C) void eventProcFunc (GdkEvent* event, void* data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     Display disp = cast(Display)data;
     disp.eventProcMeth(event);
 }
@@ -1281,27 +1284,32 @@
 }
 
 private static extern(C) void fixedClassInitProcFunc (void* g_class, void* class_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     GtkWidgetClass* klass = cast(GtkWidgetClass*)g_class;
     klass.map = &fixedMapProcFunc;
 }
 
 private static extern(C)  void fixedMapProcFunc (GtkWidget * handle) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     Display display = getCurrent ();
     Widget widget = display.getWidget (handle);
     if (widget !is null) widget.fixedMapProc (handle);
 }
 
 private static extern(C) void rendererClassInitProcFunc (void* g_class, void* class_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     GtkCellRendererClass* klass = cast(GtkCellRendererClass*)g_class;
     klass.render = &rendererRenderProcFunc;
     klass.get_size = &rendererGetSizeProcFunc;
 }
 private static extern(C) void rendererGetSizeProcFunc(GtkCellRenderer *cell, GtkWidget *handle, GdkRectangle *cell_area, int *x_offset, int *y_offset, int *width, int *height) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     Display display = getCurrent ();
     Widget widget = display.getWidget (handle);
     if (widget !is null) widget.rendererGetSizeProc (cell, handle, cell_area, x_offset, y_offset, width, height);
 }
 private static extern(C) void rendererRenderProcFunc(GtkCellRenderer * cell, GdkDrawable * window, GtkWidget * handle, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, int flags){
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     Display display = getCurrent ();
     Widget widget = display.getWidget (handle);
     if (widget !is null) widget.rendererRenderProc (cell, window, handle, background_area, cell_area, expose_area, flags);
@@ -1427,6 +1435,7 @@
 }
 
 private static extern(C) int filterProcFunc (GdkXEvent* xEvent, GdkEvent* gdkEvent, void* data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     auto callbackdata = cast(CallbackData*)data;
     auto disp = callbackdata.display;
     if( disp is null ) return 0;
@@ -2231,6 +2240,7 @@
 }
 
 private static extern(C) int idleProcFunc (void* data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     auto dbdata = cast(CallbackData*)data;
     return dbdata.display.idleProc();
 }
@@ -2305,7 +2315,7 @@
         CallbackData* res= new CallbackData;
         res.display = this;
         res.data = cast(void*)value;
-        windowProcCallbackDatas ~= res;
+        windowProcCallbackDatas[ value ] = res;
         return OS.g_cclosure_new( cb, cast(void*)res, cast(GClosureNotify)notify );
     }
 
@@ -2387,6 +2397,10 @@
     OS.g_closure_ref (shellMapProcClosure);
 }
 
+void* getWindowProcUserData( int value ){
+    return windowProcCallbackDatas[ value ];
+}
+
 void initializeSystemSettings () {
     styleSetProcCallbackData.display = this;
     styleSetProcCallbackData.data = null;
@@ -2664,6 +2678,7 @@
 }
 
 private static extern(C) void menuPositionProcFunc (GtkMenu* menu, int* x, int* y, int* push_in, void* user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     auto display = cast(Display)user_data;
     display.menuPositionProc( menu, x, y, push_in, null );
 }
@@ -2736,6 +2751,7 @@
 }
 
 private static extern(C) int /*long*/ mouseHoverProcFunc ( void* user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     CallbackData* cbdata = cast(CallbackData*)user_data;
     return cbdata.display.mouseHoverProc( cast(GtkWidget*)cbdata.data );
 }
@@ -3480,6 +3496,7 @@
 }
 
 private static extern(C) int /*long*/ setDirectionProcFunc (GtkWidget* widget, void* direction) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     return setDirectionProc( widget, cast(int)direction );
 }
 static int /*long*/ setDirectionProc (GtkWidget* widget, int /*long*/ direction) {
@@ -3689,6 +3706,7 @@
 
 
 private static extern(C) int timerProcFunc ( void * data ) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     CallbackData* cbdata = cast( CallbackData* ) data;
     return cbdata.display.timerProc( cast(int) cbdata.data );
 }
@@ -3706,6 +3724,7 @@
 }
 
 private static extern(C) int caretProcFunc ( void * data ) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     CallbackData* cbdata = cast( CallbackData* ) data;
     return cbdata.display.caretProc( cast(int) cbdata.data );
 }
@@ -3734,6 +3753,7 @@
 }
 
 private static extern(C) void sizeAllocateProcFunc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     auto cbdata = cast(CallbackData*)user_data;
     cbdata.display.sizeAllocateProc( cast(GtkWidget*)handle, arg0, cast(int)cbdata.data );
 }
@@ -3752,6 +3772,7 @@
 }
 
 private static extern(C) void  sizeRequestProcFunc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     auto cbdata = cast(CallbackData*)user_data;
     cbdata.display.sizeRequestProcMeth( cast(GtkWidget*)handle, arg0, cast(int)cbdata.data );
 }
@@ -3823,6 +3844,7 @@
 }
 
 private static extern(C) int /*long*/ shellMapProcFunc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     auto cbdata = cast(CallbackData*)user_data;
     return cbdata.display.shellMapProc( cast(GtkWidget*)handle, arg0, cast(int)cbdata.data );
 }
@@ -3834,6 +3856,7 @@
 }
 
 private static extern(C) int /*long*/ styleSetProcFunc (int /*long*/ gobject, int /*long*/ arg1, int /*long*/ user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     auto cbdata = cast(CallbackData*)user_data;
     return cbdata.display.styleSetProcMeth( gobject, arg1, cast(int)cbdata.data );
 }
@@ -3944,6 +3967,7 @@
 }
 
 private static extern(C) int /*long*/ windowProcFunc2 (GtkWidget* handle, int /*long*/ user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     CallbackData* cbdata = cast(CallbackData*)user_data;
     return cbdata.display.windowProc( handle, cast(int)cbdata.data );
 }
@@ -3954,6 +3978,7 @@
 }
 
 private static extern(C) int /*long*/ windowProcFunc3 (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     CallbackData* cbdata = cast(CallbackData*)user_data;
     return cbdata.display.windowProc( cast(GtkWidget*)handle, arg0, cast(int)cbdata.data );
 }
@@ -3964,6 +3989,7 @@
 }
 
 private static extern(C) int /*long*/ windowProcFunc4 (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     CallbackData* cbdata = cast(CallbackData*)user_data;
     return cbdata.display.windowProc( cast(GtkWidget*)handle, arg0, arg1, cast(int)cbdata.data );
 }
@@ -3974,6 +4000,7 @@
 }
 
 private static extern(C) int /*long*/ windowProcFunc5 (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     CallbackData* cbdata = cast(CallbackData*)user_data;
     return cbdata.display.windowProc( cast(GtkWidget*)handle, arg0, arg1, arg2, cast(int)cbdata.data );
 }
@@ -3990,6 +4017,7 @@
 }
 
 private static extern(C) int /*long*/ windowTimerProcFunc (void* user_data) {
+    version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush;
     CallbackData* cbdata = cast(CallbackData*)user_data;
     return cbdata.display.windowTimerProc( cast(GtkWidget*)cbdata.data );
 }
--- a/dwt/widgets/ScrollBar.d	Sat Jan 12 15:38:16 2008 +0100
+++ b/dwt/widgets/ScrollBar.d	Sun Jan 13 23:50:55 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
  * 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
@@ -525,9 +525,9 @@
     checkWidget ();
     if (value < 1) return;
     adjustmentHandle.step_increment = cast(float) value;
-    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_adjustment_changed (adjustmentHandle);
-    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -550,9 +550,9 @@
     adjustmentHandle.upper = value;
     adjustmentHandle.page_size = Math.min (adjustmentHandle.page_size, value - minimum);
     adjustmentHandle.value = Math.min (adjustmentHandle.value, (value - adjustmentHandle.page_size));
-    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_adjustment_changed (adjustmentHandle);
-    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -576,9 +576,9 @@
     adjustmentHandle.lower = value;
     adjustmentHandle.page_size = Math.min (adjustmentHandle.page_size, maximum - value);
     adjustmentHandle.value = Math.max (adjustmentHandle.value, value);
-    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_adjustment_changed (adjustmentHandle);
-    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -598,9 +598,9 @@
     checkWidget ();
     if (value < 1) return;
     adjustmentHandle.page_increment = cast(float) value;
-    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_adjustment_changed (adjustmentHandle);
-    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -618,9 +618,9 @@
 public void setSelection (int value) {
     checkWidget ();
     value = Math.min (value, getMaximum() - getThumb());
-    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_adjustment_set_value (adjustmentHandle, value);
-    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -643,9 +643,9 @@
     value = Math.min (value, cast(int)(adjustmentHandle.upper - adjustmentHandle.lower));
     adjustmentHandle.page_size = cast(double) value;
     adjustmentHandle.value = Math.min (adjustmentHandle.value, (adjustmentHandle.upper - value));
-    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_adjustment_changed (adjustmentHandle);
-    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -683,10 +683,10 @@
     adjustmentHandle.page_increment = pageIncrement;
     adjustmentHandle.page_size = thumb;
     adjustmentHandle.value = Math.min (Math.max (selection, minimum), maximum - thumb);
-    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_adjustment_changed (adjustmentHandle);
     OS.gtk_adjustment_value_changed (adjustmentHandle);
-    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
--- a/dwt/widgets/Slider.d	Sat Jan 12 15:38:16 2008 +0100
+++ b/dwt/widgets/Slider.d	Sun Jan 13 23:50:55 2008 +0100
@@ -401,9 +401,9 @@
 public void setIncrement (int value) {
     checkWidget ();
     if (value < 1) return;
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_range_set_increments (cast(GtkRange*)handle, value, getPageIncrement ());
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -427,9 +427,9 @@
     adjustment.upper = value;
     adjustment.page_size = Math.min (cast(int)adjustment.page_size, value - minimum);
     adjustment.value = Math.min (cast(int)adjustment.value, cast(int)(value - adjustment.page_size));
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_adjustment_changed (adjustment);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -454,9 +454,9 @@
     adjustment.lower = value;
     adjustment.page_size = Math.min (cast(int)adjustment.page_size, maximum - value);
     adjustment.value = Math.max (cast(int)adjustment.value, value);
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_adjustment_changed (adjustment);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 void setOrientation () {
@@ -484,9 +484,9 @@
 public void setPageIncrement (int value) {
     checkWidget ();
     if (value < 1) return;
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_range_set_increments (cast(GtkRange*)handle, getIncrement (), value);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -503,9 +503,9 @@
  */
 public void setSelection (int value) {
     checkWidget ();
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_range_set_value (cast(GtkRange*)handle, value);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -529,9 +529,9 @@
     value = cast(int) Math.min (value, cast(int)(adjustment.upper - adjustment.lower));
     adjustment.page_size = cast(double) value;
     adjustment.value = Math.min (cast(int)adjustment.value, cast(int)(adjustment.upper - value));
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_adjustment_changed (adjustment);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -570,10 +570,10 @@
     adjustment.page_size = cast(double) thumb;
     adjustment.step_increment = cast(double) increment;
     adjustment.page_increment = cast(double) pageIncrement;
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_adjustment_changed (adjustment);
     OS.gtk_adjustment_value_changed (adjustment);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 }
--- a/dwt/widgets/Spinner.d	Sat Jan 12 15:38:16 2008 +0100
+++ b/dwt/widgets/Spinner.d	Sun Jan 13 23:50:55 2008 +0100
@@ -540,7 +540,7 @@
     * change and set it after the insert-text signal has completed.
     */
     fixStart = fixEnd = -1;
-    OS.g_signal_handlers_block_matched (imContext, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)COMMIT);
+    OS.g_signal_handlers_block_matched (imContext, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCOMMIT);
     int id = OS.g_signal_lookup (OS.commit.ptr, OS.gtk_im_context_get_type ());
     int mask =  OS.G_SIGNAL_MATCH_DATA | OS.G_SIGNAL_MATCH_ID;
     OS.g_signal_handlers_unblock_matched (imContext, mask, id, 0, null, null, cast(void*)handle);
@@ -549,8 +549,8 @@
     } else {
         OS.g_signal_emit_by_name1 (imContext, OS.commit.ptr, cast(int)toStringz(newChars));
     }
-    OS.g_signal_handlers_unblock_matched (imContext, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)COMMIT);
-    OS.g_signal_handlers_block_matched (imContext, mask, id, 0, null, null, cast(void*)handle);
+    OS.g_signal_handlers_unblock_matched (imContext, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCOMMIT);
+    OS.g_signal_handlers_block_matched (imContext, mask, id, 0, null, null, udhandle);
     if (fixStart !is -1 && fixEnd !is -1) {
         OS.gtk_editable_set_position (cast(GtkEditable*)handle, fixStart);
         OS.gtk_editable_select_region (cast(GtkEditable*)handle, fixStart, fixEnd);
@@ -568,11 +568,11 @@
         if (newText.length > 0) {
             int pos;
             pos = cast(int)/*64*/end_pos;
-            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
-            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)INSERT_TEXT);
+            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
+            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udINSERT_TEXT);
             OS.gtk_editable_insert_text (cast(GtkEditable*)handle, newText.ptr, newText.length, &pos);
-            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)INSERT_TEXT);
-            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
+            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udINSERT_TEXT);
+            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
             OS.gtk_editable_set_position (cast(GtkEditable*)handle, pos);
         }
     }
@@ -605,15 +605,15 @@
         OS.gtk_editable_get_selection_bounds (cast(GtkEditable*)handle, &newStart, &newEnd);
         if (newText !is null) {
             if (newStart !is newEnd) {
-                OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)DELETE_TEXT);
-                OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
+                OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udDELETE_TEXT);
+                OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
                 OS.gtk_editable_delete_selection (cast(GtkEditable*)handle);
-                OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)DELETE_TEXT);
-                OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
+                OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udDELETE_TEXT);
+                OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
             }
-            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)INSERT_TEXT);
+            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udINSERT_TEXT);
             OS.gtk_editable_insert_text (cast(GtkEditable*)handle, newText.ptr, newText.length, &pos);
-            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)INSERT_TEXT);
+            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udINSERT_TEXT);
             newStart = newEnd = pos;
         }
         pos = newEnd;
@@ -652,7 +652,7 @@
         OS.g_signal_connect_closure (imContext, OS.commit.ptr, display.closures [COMMIT], false);
         int id = OS.g_signal_lookup (OS.commit.ptr, OS.gtk_im_context_get_type ());
         int mask =  OS.G_SIGNAL_MATCH_DATA | OS.G_SIGNAL_MATCH_ID;
-        OS.g_signal_handlers_block_matched (imContext, mask, id, 0, null, null, cast(void*)handle);
+        OS.g_signal_handlers_block_matched (imContext, mask, id, 0, null, null, udhandle);
     }
 }
 
@@ -804,9 +804,9 @@
     double newValue = value;
     int digits = OS.gtk_spin_button_get_digits (cast(GtkSpinButton*)handle);
     for (int i = 0; i < digits; i++) newValue /= 10;
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_spin_button_set_increments (cast(GtkSpinButton*)handle, newValue, adjustment.page_increment);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -830,9 +830,9 @@
     int digits = OS.gtk_spin_button_get_digits (cast(GtkSpinButton*)handle);
     for (int i = 0; i < digits; i++) newValue /= 10;
     if (newValue <= adjustment.lower) return;
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_spin_button_set_range (cast(GtkSpinButton*)handle, adjustment.lower, newValue);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -856,9 +856,9 @@
     int digits = OS.gtk_spin_button_get_digits (cast(GtkSpinButton*)handle);
     for (int i = 0; i < digits; i++) newValue /= 10;
     if (newValue >= adjustment.upper) return;
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_spin_button_set_range (cast(GtkSpinButton*)handle, newValue, adjustment.upper);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -880,9 +880,9 @@
     double newValue = value;
     int digits = OS.gtk_spin_button_get_digits (cast(GtkSpinButton*)handle);
     for (int i = 0; i < digits; i++) newValue /= 10;
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_spin_button_set_increments (cast(GtkSpinButton*)handle, adjustment.step_increment, newValue);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -903,9 +903,9 @@
     double newValue = value;
     int digits = OS.gtk_spin_button_get_digits (cast(GtkSpinButton*)handle);
     for (int i = 0; i < digits; i++) newValue /= 10;
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_spin_button_set_value (cast(GtkSpinButton*)handle, newValue);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 /**
@@ -986,12 +986,12 @@
     selection = Math.min (Math.max (minimum, selection), maximum);
     double factor = 1;
     for (int i = 0; i < digits; i++) factor *= 10;
-    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
     OS.gtk_spin_button_set_range (cast(GtkSpinButton*)handle, minimum / factor, maximum / factor);
     OS.gtk_spin_button_set_increments (cast(GtkSpinButton*)handle, increment / factor, pageIncrement / factor);
     OS.gtk_spin_button_set_value (cast(GtkSpinButton*)handle, selection / factor);
     OS.gtk_spin_button_set_digits (cast(GtkSpinButton*)handle, digits);
-    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)VALUE_CHANGED);
+    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udVALUE_CHANGED);
 }
 
 bool translateTraversal (GdkEventKey* keyEvent) {
--- a/dwt/widgets/Text.d	Sat Jan 12 15:38:16 2008 +0100
+++ b/dwt/widgets/Text.d	Sun Jan 13 23:50:55 2008 +0100
@@ -1126,14 +1126,14 @@
     char [] newChars = sendIMKeyEvent (SWT.KeyDown, null, chars);
     if (newChars is null) return 0;
     /*
-    * Feature in GTK.  For a GtkEntry, during the insert-text signal,
-    * GTK allows the programmer to change only the caret location,
-    * not the selection.  If the programmer changes the selection,
-    * the new selection is lost.  The fix is to detect a selection
-    * change and set it after the insert-text signal has completed.
-    */
+     * Feature in GTK.  For a GtkEntry, during the insert-text signal,
+     * GTK allows the programmer to change only the caret location,
+     * not the selection.  If the programmer changes the selection,
+     * the new selection is lost.  The fix is to detect a selection
+     * change and set it after the insert-text signal has completed.
+     */
     fixStart = fixEnd = -1;
-    OS.g_signal_handlers_block_matched (imContext, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)COMMIT);
+    OS.g_signal_handlers_block_matched (imContext, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCOMMIT);
     int id = OS.g_signal_lookup (OS.commit.ptr, OS.gtk_im_context_get_type ());
     int mask =  OS.G_SIGNAL_MATCH_DATA | OS.G_SIGNAL_MATCH_ID;
     OS.g_signal_handlers_unblock_matched (imContext, mask, id, 0, null, null, cast(void*)handle);
@@ -1142,7 +1142,7 @@
     } else {
         OS.g_signal_emit_by_name1 (imContext, OS.commit.ptr, cast(int)toStringz(newChars) );
     }
-    OS.g_signal_handlers_unblock_matched (imContext, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)COMMIT);
+    OS.g_signal_handlers_unblock_matched (imContext, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCOMMIT );
     OS.g_signal_handlers_block_matched (imContext, mask, id, 0, null, null, cast(void*)handle);
     if ((style & SWT.SINGLE) !is 0) {
         if (fixStart !is -1 && fixEnd !is -1) {
@@ -1173,14 +1173,14 @@
         OS.g_signal_stop_emission_by_name (bufferHandle, OS.delete_range.ptr);
     } else {
         if (newText.length > 0) {
-            OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
-            OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)DELETE_RANGE);
+            OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
+            OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udDELETE_RANGE);
             OS.gtk_text_buffer_delete (bufferHandle, &startIter, &endIter);
-            OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)DELETE_RANGE);
-            OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
-            OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)TEXT_BUFFER_INSERT_TEXT);
+            OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udDELETE_RANGE);
+            OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
+            OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udTEXT_BUFFER_INSERT_TEXT);
             OS.gtk_text_buffer_insert (bufferHandle, &startIter, newText.ptr, newText.length);
-            OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)TEXT_BUFFER_INSERT_TEXT);
+            OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udTEXT_BUFFER_INSERT_TEXT);
             OS.g_signal_stop_emission_by_name (bufferHandle, OS.delete_range.ptr);
         }
     }
@@ -1203,11 +1203,11 @@
         if (newText.length > 0) {
             int pos;
             pos = cast(int)/*64*/end_pos;
-            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
-            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)INSERT_TEXT);
+            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
+            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udINSERT_TEXT);
             OS.gtk_editable_insert_text (cast(GtkEditable*)handle, newText.ptr, newText.length, &pos);
-            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)INSERT_TEXT);
-            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
+            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udINSERT_TEXT);
+            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
             OS.gtk_editable_set_position (cast(GtkEditable*)handle, pos);
         }
     }
@@ -1281,15 +1281,15 @@
         OS.gtk_editable_get_selection_bounds (cast(GtkEditable*)handle, &newStart, &newEnd);
         if (newText !is null) {
             if (newStart !is newEnd) {
-                OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)DELETE_TEXT);
-                OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
+                OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udDELETE_TEXT);
+                OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
                 OS.gtk_editable_delete_selection (cast(GtkEditable*)handle);
-                OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)DELETE_TEXT);
-                OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
+                OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udDELETE_TEXT);
+                OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
             }
-            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)INSERT_TEXT);
+            OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udINSERT_TEXT);
             OS.gtk_editable_insert_text (cast(GtkEditable*)handle, newText.ptr, newText.length, &pos);
-            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)INSERT_TEXT);
+            OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udINSERT_TEXT);
             newStart = newEnd = pos;
         }
         pos  = newEnd;
@@ -1327,9 +1327,9 @@
         OS.g_signal_stop_emission_by_name (bufferHandle, OS.insert_text.ptr);
     } else {
         if (newText !is oldText) {
-            OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)TEXT_BUFFER_INSERT_TEXT);
+            OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udTEXT_BUFFER_INSERT_TEXT);
             OS.gtk_text_buffer_insert (bufferHandle, iter, newText.ptr, newText.length);
-            OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)TEXT_BUFFER_INSERT_TEXT);
+            OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udTEXT_BUFFER_INSERT_TEXT);
             OS.g_signal_stop_emission_by_name (bufferHandle, OS.insert_text.ptr);
         }
     }
@@ -1867,22 +1867,22 @@
         if (string is null) return;
     }
     if ((style & SWT.SINGLE) !is 0) {
-        OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
-        OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)DELETE_TEXT);
-        OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)INSERT_TEXT);
+        OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
+        OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udDELETE_TEXT);
+        OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udINSERT_TEXT);
         OS.gtk_entry_set_text (cast(GtkEntry*)handle, toStringz(string) );
-        OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
-        OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)DELETE_TEXT);
-        OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)INSERT_TEXT);
+        OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
+        OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udDELETE_TEXT);
+        OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udINSERT_TEXT);
     } else {
         GtkTextIter position;
-        OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
-        OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)DELETE_RANGE);
-        OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)TEXT_BUFFER_INSERT_TEXT);
+        OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
+        OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udDELETE_RANGE);
+        OS.g_signal_handlers_block_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udTEXT_BUFFER_INSERT_TEXT);
         OS.gtk_text_buffer_set_text (bufferHandle, string.ptr, string.length);
-        OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)CHANGED);
-        OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)DELETE_RANGE);
-        OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)TEXT_BUFFER_INSERT_TEXT);
+        OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
+        OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udDELETE_RANGE);
+        OS.g_signal_handlers_unblock_matched (bufferHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udTEXT_BUFFER_INSERT_TEXT);
         OS.gtk_text_buffer_get_iter_at_offset (bufferHandle, &position, 0);
         OS.gtk_text_buffer_place_cursor (bufferHandle, &position);
         auto mark = OS.gtk_text_buffer_get_insert (bufferHandle);
--- a/dwt/widgets/Widget.d	Sat Jan 12 15:38:16 2008 +0100
+++ b/dwt/widgets/Widget.d	Sun Jan 13 23:50:55 2008 +0100
@@ -27,6 +27,11 @@
 import tango.stdc.string;
 import tango.core.Thread;
 
+//version=LOG;
+version(LOG){
+    import tango.io.Stdout;
+}
+
 /**
  * This class is the abstract superclass of all user interface objects.
  * Widgets are created, disposed and issue notification to listeners
@@ -172,6 +177,73 @@
     static const int MONTH_CHANGED = 61;
     static const int LAST_SIGNAL = 62;
 
+    template UD_Getter( char[] name ){
+        const char[] UD_Getter = "void* ud"~name~"(){ return getDisplay().getWindowProcUserData( "~name~"); }\n";
+    }
+
+    mixin ( UD_Getter!( "ACTIVATE" ));
+    mixin ( UD_Getter!( "BUTTON_PRESS_EVENT" ));
+    mixin ( UD_Getter!( "BUTTON_PRESS_EVENT_INVERSE" ));
+    mixin ( UD_Getter!( "BUTTON_RELEASE_EVENT" ));
+    mixin ( UD_Getter!( "BUTTON_RELEASE_EVENT_INVERSE" ));
+    mixin ( UD_Getter!( "CHANGED" ));
+    mixin ( UD_Getter!( "CHANGE_VALUE" ));
+    mixin ( UD_Getter!( "CLICKED" ));
+    mixin ( UD_Getter!( "COMMIT" ));
+    mixin ( UD_Getter!( "CONFIGURE_EVENT" ));
+    mixin ( UD_Getter!( "DELETE_EVENT" ));
+    mixin ( UD_Getter!( "DELETE_RANGE" ));
+    mixin ( UD_Getter!( "DELETE_TEXT" ));
+    mixin ( UD_Getter!( "ENTER_NOTIFY_EVENT" ));
+    mixin ( UD_Getter!( "EVENT" ));
+    mixin ( UD_Getter!( "EVENT_AFTER" ));
+    mixin ( UD_Getter!( "EXPAND_COLLAPSE_CURSOR_ROW" ));
+    mixin ( UD_Getter!( "EXPOSE_EVENT" ));
+    mixin ( UD_Getter!( "EXPOSE_EVENT_INVERSE" ));
+    mixin ( UD_Getter!( "FOCUS" ));
+    mixin ( UD_Getter!( "FOCUS_IN_EVENT" ));
+    mixin ( UD_Getter!( "FOCUS_OUT_EVENT" ));
+    mixin ( UD_Getter!( "GRAB_FOCUS" ));
+    mixin ( UD_Getter!( "HIDE" ));
+    mixin ( UD_Getter!( "INPUT" ));
+    mixin ( UD_Getter!( "INSERT_TEXT" ));
+    mixin ( UD_Getter!( "KEY_PRESS_EVENT" ));
+    mixin ( UD_Getter!( "KEY_RELEASE_EVENT" ));
+    mixin ( UD_Getter!( "LEAVE_NOTIFY_EVENT" ));
+    mixin ( UD_Getter!( "MAP" ));
+    mixin ( UD_Getter!( "MAP_EVENT" ));
+    mixin ( UD_Getter!( "MNEMONIC_ACTIVATE" ));
+    mixin ( UD_Getter!( "MOTION_NOTIFY_EVENT" ));
+    mixin ( UD_Getter!( "MOTION_NOTIFY_EVENT_INVERSE" ));
+    mixin ( UD_Getter!( "MOVE_FOCUS" ));
+    mixin ( UD_Getter!( "OUTPUT" ));
+    mixin ( UD_Getter!( "POPUP_MENU" ));
+    mixin ( UD_Getter!( "PREEDIT_CHANGED" ));
+    mixin ( UD_Getter!( "REALIZE" ));
+    mixin ( UD_Getter!( "ROW_ACTIVATED" ));
+    mixin ( UD_Getter!( "SCROLL_CHILD" ));
+    mixin ( UD_Getter!( "SCROLL_EVENT" ));
+    mixin ( UD_Getter!( "SELECT" ));
+    mixin ( UD_Getter!( "SHOW" ));
+    mixin ( UD_Getter!( "SHOW_HELP" ));
+    mixin ( UD_Getter!( "SIZE_ALLOCATE" ));
+    mixin ( UD_Getter!( "STYLE_SET" ));
+    mixin ( UD_Getter!( "SWITCH_PAGE" ));
+    mixin ( UD_Getter!( "TEST_COLLAPSE_ROW" ));
+    mixin ( UD_Getter!( "TEST_EXPAND_ROW" ));
+    mixin ( UD_Getter!( "TEXT_BUFFER_INSERT_TEXT" ));
+    mixin ( UD_Getter!( "TOGGLED" ));
+    mixin ( UD_Getter!( "UNMAP" ));
+    mixin ( UD_Getter!( "UNMAP_EVENT" ));
+    mixin ( UD_Getter!( "UNREALIZE" ));
+    mixin ( UD_Getter!( "VALUE_CHANGED" ));
+    mixin ( UD_Getter!( "VISIBILITY_NOTIFY_EVENT" ));
+    mixin ( UD_Getter!( "WINDOW_STATE_EVENT" ));
+    mixin ( UD_Getter!( "ACTIVATE_INVERSE" ));
+    mixin ( UD_Getter!( "DAY_SELECTED" ));
+    mixin ( UD_Getter!( "MONTH_CHANGED" ));
+    mixin ( UD_Getter!( "LAST_SIGNAL" ));
+
 /**
  * Prevents uninitialized instances from being created outside the package.
  */
@@ -921,9 +993,9 @@
 
 bool mnemonicHit (GtkWidget* mnemonicHandle, char key) {
     if (!mnemonicMatch (mnemonicHandle, key)) return false;
-    OS.g_signal_handlers_block_matched ( cast(void*)mnemonicHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)MNEMONIC_ACTIVATE);
+    OS.g_signal_handlers_block_matched ( cast(void*)mnemonicHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udMNEMONIC_ACTIVATE);
     bool result = cast(bool)OS.gtk_widget_mnemonic_activate (cast(GtkWidget*)mnemonicHandle, false);
-    OS.g_signal_handlers_unblock_matched (cast(void*)mnemonicHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)MNEMONIC_ACTIVATE);
+    OS.g_signal_handlers_unblock_matched (cast(void*)mnemonicHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udMNEMONIC_ACTIVATE);
     return result;
 }
 
@@ -1163,8 +1235,7 @@
     if (keyEvent is null) {
         ptr = OS.gtk_get_current_event ();
         if (ptr !is null) {
-            keyEvent = new GdkEventKey ();
-            memmove (keyEvent, ptr, GdkEventKey.sizeof);
+            keyEvent = cast(GdkEventKey*)ptr;
             switch (cast(int)keyEvent.type) {
                 case OS.GDK_KEY_PRESS:
                 case OS.GDK_KEY_RELEASE:
@@ -1447,31 +1518,76 @@
 }
 
 int /*long*/ windowProc (GtkWidget* handle, int /*long*/ user_data) {
+    void trace( char[] str ){
+        version(LOG) Stderr.formatln( "Widget windowProc {}", str ).flush;
+    }
+
     switch (cast(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 (cast(GtkIMContext*)handle);
-        case REALIZE: return gtk_realize (handle);
-        case SELECT: return gtk_select (cast(int)handle);
-        case SHOW: return gtk_show (handle);
-        case VALUE_CHANGED: return gtk_value_changed (cast(int)handle);
-        case UNMAP: return gtk_unmap (handle);
-        case UNREALIZE: return gtk_unrealize (handle);
-        default: return 0;
+        case ACTIVATE:
+            trace( "ACTIVATE" );
+            return gtk_activate (handle);
+        case CHANGED:
+            trace( "CHANGED" );
+            return gtk_changed (handle);
+        case CLICKED:
+            trace( "CLICKED" );
+            return gtk_clicked (handle);
+        case DAY_SELECTED:
+            trace( "DAY_SELECTED" );
+            return gtk_day_selected (handle);
+        case HIDE:
+            trace( "HIDE" );
+            return gtk_hide (handle);
+        case GRAB_FOCUS:
+            trace( "GRAB_FOCUS" );
+            return gtk_grab_focus (handle);
+        case MAP:
+            trace( "MAP" );
+            return gtk_map (handle);
+        case MONTH_CHANGED:
+            trace( "MONTH_CHANGED" );
+            return gtk_month_changed (handle);
+        case OUTPUT:
+            trace( "OUTPUT" );
+            return gtk_output (handle);
+        case POPUP_MENU:
+            trace( "POPUP_MENU" );
+            return gtk_popup_menu (handle);
+        case PREEDIT_CHANGED:
+            trace( "PREEDIT_CHANGED" );
+            return gtk_preedit_changed (cast(GtkIMContext*)handle);
+        case REALIZE:
+            trace( "REALIZE" );
+            return gtk_realize (handle);
+        case SELECT:
+            trace( "SELECT" );
+            return gtk_select (cast(int)handle);
+        case SHOW:
+            trace( "SHOW" );
+            return gtk_show (handle);
+        case VALUE_CHANGED:
+            trace( "VALUE_CHANGED" );
+            return gtk_value_changed (cast(int)handle);
+        case UNMAP:
+            trace( "UNMAP" );
+            return gtk_unmap (handle);
+        case UNREALIZE:
+            trace( "UNREALIZE" );
+            return gtk_unrealize (handle);
+        default:
+            trace( "default" );
+            return 0;
     }
 }
 
 int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) {
+    void trace( char[] str ){
+        version(LOG) Stderr.formatln( "Widget windowProc1 {}", str ).flush;
+    }
+
     switch (cast(int)/*64*/user_data) {
         case EXPOSE_EVENT_INVERSE: {
+            trace( "EXPOSE_EVENT_INVERSE" );
             GdkEventExpose* gdkEvent = cast(GdkEventExpose*) arg0;
             auto paintWindow = paintWindow();
             auto window = gdkEvent.window;
@@ -1481,60 +1597,153 @@
         case BUTTON_PRESS_EVENT_INVERSE:
         case BUTTON_RELEASE_EVENT_INVERSE:
         case MOTION_NOTIFY_EVENT_INVERSE: {
+            trace( "BUTTON_PRESS_EVENT_INVERSE BUTTON_RELEASE_EVENT_INVERSE MOTION_NOTIFY_EVENT_INVERSE" );
             return 1;
         }
-        case BUTTON_PRESS_EVENT: return gtk_button_press_event (handle, cast(GdkEventButton*)arg0);
-        case BUTTON_RELEASE_EVENT: return gtk_button_release_event (handle, cast(GdkEventButton*)arg0);
-        case COMMIT: return gtk_commit (cast(GtkIMContext*)handle, cast(char*)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, cast(GdkEventCrossing*)arg0);
-        case EVENT: return gtk_event (handle, cast(GdkEvent*)arg0);
-        case EVENT_AFTER: return gtk_event_after (handle, cast(GdkEvent*)arg0);
-        case EXPOSE_EVENT: return gtk_expose_event (handle, cast(GdkEventExpose*)arg0);
-        case FOCUS: return gtk_focus (handle, arg0);
-        case FOCUS_IN_EVENT: return gtk_focus_in_event (handle, cast(GdkEventFocus*)arg0);
-        case FOCUS_OUT_EVENT: return gtk_focus_out_event (handle, cast(GdkEventFocus*)arg0);
-        case KEY_PRESS_EVENT: return gtk_key_press_event (handle, cast(GdkEventKey*)arg0);
-        case KEY_RELEASE_EVENT: return gtk_key_release_event (handle, cast(GdkEventKey*)arg0);
-        case INPUT: return gtk_input (handle, arg0);
-        case LEAVE_NOTIFY_EVENT: return gtk_leave_notify_event (handle, cast(GdkEventCrossing*)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, cast(GdkEventMotion*)arg0);
-        case MOVE_FOCUS: return gtk_move_focus (handle, arg0);
-        case SCROLL_EVENT:  return gtk_scroll_event (handle, cast(GdkEventScroll*)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 (cast(int)handle, arg0);
-        case UNMAP_EVENT: return gtk_unmap_event (handle, arg0);
-        case VISIBILITY_NOTIFY_EVENT: return gtk_visibility_notify_event (handle, cast(GdkEventVisibility*)arg0);
-        case WINDOW_STATE_EVENT: return gtk_window_state_event (handle, cast(GdkEventWindowState*)arg0);
-        default: return 0;
+        case BUTTON_PRESS_EVENT:
+            trace( "BUTTON_PRESS_EVENT" );
+            return gtk_button_press_event (handle, cast(GdkEventButton*)arg0);
+        case BUTTON_RELEASE_EVENT:
+            trace( "BUTTON_RELEASE_EVENT" );
+            return gtk_button_release_event (handle, cast(GdkEventButton*)arg0);
+        case COMMIT:
+            trace( "COMMIT" );
+            return gtk_commit (cast(GtkIMContext*)handle, cast(char*)arg0);
+        case CONFIGURE_EVENT:
+            trace( "CONFIGURE_EVENT" );
+            return gtk_configure_event (handle, arg0);
+        case DELETE_EVENT:
+            trace( "DELETE_EVENT" );
+            return gtk_delete_event (handle, arg0);
+        case ENTER_NOTIFY_EVENT:
+            trace( "ENTER_NOTIFY_EVENT" );
+            return gtk_enter_notify_event (handle, cast(GdkEventCrossing*)arg0);
+        case EVENT:
+            trace( "EVENT" );
+            return gtk_event (handle, cast(GdkEvent*)arg0);
+        case EVENT_AFTER:
+            trace( "EVENT_AFTER" );
+            return gtk_event_after (handle, cast(GdkEvent*)arg0);
+        case EXPOSE_EVENT:
+            trace( "EXPOSE_EVENT" );
+            return gtk_expose_event (handle, cast(GdkEventExpose*)arg0);
+        case FOCUS:
+            trace( "FOCUS" );
+            return gtk_focus (handle, arg0);
+        case FOCUS_IN_EVENT:
+            trace( "FOCUS_IN_EVENT" );
+            return gtk_focus_in_event (handle, cast(GdkEventFocus*)arg0);
+        case FOCUS_OUT_EVENT:
+            trace( "FOCUS_OUT_EVENT" );
+            return gtk_focus_out_event (handle, cast(GdkEventFocus*)arg0);
+        case KEY_PRESS_EVENT:
+            trace( "KEY_PRESS_EVENT" );
+            return gtk_key_press_event (handle, cast(GdkEventKey*)arg0);
+        case KEY_RELEASE_EVENT:
+            trace( "KEY_RELEASE_EVENT" );
+            return gtk_key_release_event (handle, cast(GdkEventKey*)arg0);
+        case INPUT:
+            trace( "INPUT" );
+            return gtk_input (handle, arg0);
+        case LEAVE_NOTIFY_EVENT:
+            trace( "LEAVE_NOTIFY_EVENT" );
+            return gtk_leave_notify_event (handle, cast(GdkEventCrossing*)arg0);
+        case MAP_EVENT:
+            trace( "MAP_EVENT" );
+            return gtk_map_event (handle, arg0);
+        case MNEMONIC_ACTIVATE:
+            trace( "MNEMONIC_ACTIVATE" );
+            return gtk_mnemonic_activate (handle, arg0);
+        case MOTION_NOTIFY_EVENT:
+            trace( "MOTION_NOTIFY_EVENT" );
+            return gtk_motion_notify_event (handle, cast(GdkEventMotion*)arg0);
+        case MOVE_FOCUS:
+            trace( "MOVE_FOCUS" );
+            return gtk_move_focus (handle, arg0);
+        case SCROLL_EVENT:
+            trace( "SCROLL_EVENT" );
+            return gtk_scroll_event (handle, cast(GdkEventScroll*)arg0);
+        case SHOW_HELP:
+            trace( "SHOW_HELP" );
+            return gtk_show_help (handle, arg0);
+        case SIZE_ALLOCATE:
+            trace( "SIZE_ALLOCATE" );
+            return gtk_size_allocate (handle, arg0);
+        case STYLE_SET:
+            trace( "STYLE_SET" );
+            return gtk_style_set (handle, arg0);
+        case TOGGLED:
+            trace( "TOGGLED" );
+            return gtk_toggled (cast(int)handle, arg0);
+        case UNMAP_EVENT:
+            trace( "UNMAP_EVENT" );
+            return gtk_unmap_event (handle, arg0);
+        case VISIBILITY_NOTIFY_EVENT:
+            trace( "VISIBILITY_NOTIFY_EVENT" );
+            return gtk_visibility_notify_event (handle, cast(GdkEventVisibility*)arg0);
+        case WINDOW_STATE_EVENT:
+            trace( "WINDOW_STATE_EVENT" );
+            return gtk_window_state_event (handle, cast(GdkEventWindowState*)arg0);
+        default:
+            trace( "default" );
+            return 0;
     }
 }
 
 int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) {
+    void trace( char[] str ){
+        version(LOG) Stderr.formatln( "Widget windowProc2 {}", str ).flush;
+    }
+
     switch (cast(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 (cast(int)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 (cast(int)handle, arg0, arg1);
-        case TEST_EXPAND_ROW: return gtk_test_expand_row(cast(int)handle, arg0, arg1);
-        default: return 0;
+        case DELETE_RANGE:
+            trace( "DELETE_RANGE" );
+            return gtk_delete_range (handle, arg0, arg1);
+        case DELETE_TEXT:
+            trace( "DELETE_TEXT" );
+            return gtk_delete_text (handle, arg0, arg1);
+        case ROW_ACTIVATED:
+            trace( "ROW_ACTIVATED" );
+            return gtk_row_activated (cast(int)handle, arg0, arg1);
+        case SCROLL_CHILD:
+            trace( "SCROLL_CHILD" );
+            return gtk_scroll_child (handle, arg0, arg1);
+        case SWITCH_PAGE:
+            trace( "SWITCH_PAGE" );
+            return gtk_switch_page (handle, arg0, arg1);
+        case TEST_COLLAPSE_ROW:
+            trace( "TEST_COLLAPSE_ROW" );
+            return gtk_test_collapse_row (cast(int)handle, arg0, arg1);
+        case TEST_EXPAND_ROW:
+            trace( "TEST_EXPAND_ROW" );
+            return gtk_test_expand_row(cast(int)handle, arg0, arg1);
+        default:
+            trace( "default" );
+            return 0;
     }
 }
 
 int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) {
+    void trace( char[] str ){
+        version(LOG) Stderr.formatln( "Widget windowProc3 {}", str ).flush;
+    }
+
     switch (cast(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 (cast(GtkEditable*)handle, cast(char*)arg0, arg1, arg2);
-        case TEXT_BUFFER_INSERT_TEXT: return gtk_text_buffer_insert_text (cast(GtkTextBuffer*)handle, cast(GtkTextIter*)arg0, cast(char*)arg1, arg2);
-        default: return 0;
+        case CHANGE_VALUE:
+            trace( "CHANGE_VALUE" );
+            return gtk_change_value (handle, arg0, arg1, arg2);
+        case EXPAND_COLLAPSE_CURSOR_ROW:
+            trace( "EXPAND_COLLAPSE_CURSOR_ROW" );
+            return gtk_expand_collapse_cursor_row (handle, arg0, arg1, arg2);
+        case INSERT_TEXT:
+            trace( "INSERT_TEXT" );
+            return gtk_insert_text (cast(GtkEditable*)handle, cast(char*)arg0, arg1, arg2);
+        case TEXT_BUFFER_INSERT_TEXT:
+            trace( "TEXT_BUFFER_INSERT_TEXT" );
+            return gtk_text_buffer_insert_text (cast(GtkTextBuffer*)handle, cast(GtkTextIter*)arg0, cast(char*)arg1, arg2);
+        default:
+            trace( "default" );
+            return 0;
     }
 }