# HG changeset patch # User Frank Benoit # Date 1200058297 -3600 # Node ID 8f049b136add4031aa6e600fbacea1e448b60868 # Parent 3da31bec7de0c1b41fc102e2471d725eddc4291a first example working diff -r 3da31bec7de0 -r 8f049b136add dsss.conf --- a/dsss.conf Fri Jan 11 11:21:52 2008 +0100 +++ b/dsss.conf Fri Jan 11 14:31:37 2008 +0100 @@ -6,9 +6,11 @@ buildflags+=-L-lgdk-x11-2.0 buildflags+=-L-latk-1.0 buildflags+=-L-lgdk_pixbuf-2.0 +buildflags+=-L-lgthread-2.0 buildflags+=-L-lm buildflags+=-L-lpangocairo-1.0 buildflags+=-L-lfontconfig +buildflags+=-L-lXtst buildflags+=-L-lXext buildflags+=-L-lXrender buildflags+=-L-lXinerama @@ -25,3 +27,7 @@ buildflags+=-L-ldl buildflags+=-L-lglib-2.0 buildflags+=-L-lcairo +buildflags+=-I/home/frank/jive +#buildflags+=-g -gc + + diff -r 3da31bec7de0 -r 8f049b136add dwt/SWT.d --- a/dwt/SWT.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/SWT.d Fri Jan 11 14:31:37 2008 +0100 @@ -1746,7 +1746,7 @@ * * @since 2.1 */ - public static const int MODIFIER_MASK; + public static /*const*/ int MODIFIER_MASK; /** * Keyboard and/or mouse event mask indicating that mouse button one @@ -1796,7 +1796,7 @@ * * @since 2.1 */ - public static const int BUTTON_MASK; + public static /*const*/ int BUTTON_MASK; /** * Keyboard and/or mouse event mask indicating that the MOD1 key @@ -1806,7 +1806,7 @@ * * @since 2.1 */ - public static const int MOD1; + public static /*const*/ int MOD1; /** * Keyboard and/or mouse event mask indicating that the MOD2 key @@ -1816,7 +1816,7 @@ * * @since 2.1 */ - public static const int MOD2; + public static /*const*/ int MOD2; /** * Keyboard and/or mouse event mask indicating that the MOD3 key @@ -1824,7 +1824,7 @@ * * @since 2.1 */ - public static const int MOD3; + public static /*const*/ int MOD3; /** * Keyboard and/or mouse event mask indicating that the MOD4 key @@ -1832,7 +1832,7 @@ * * @since 2.1 */ - public static const int MOD4; + public static /*const*/ int MOD4; /** * Constants to indicate line scrolling (value is 1). @@ -3609,7 +3609,7 @@ throw error; } -static this(){ +public static void static_this() { /* * These values represent bit masks that may need to * expand in the future. Therefore they are not initialized diff -r 3da31bec7de0 -r 8f049b136add dwt/accessibility/AccessibleFactory.d --- a/dwt/accessibility/AccessibleFactory.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/accessibility/AccessibleFactory.d Fri Jan 11 14:31:37 2008 +0100 @@ -36,7 +36,7 @@ static long[char[]] Types; static AccessibleFactory[long] Factories; - static const uint DefaultParentType; //$NON-NLS-1$ + static uint DefaultParentType; //$NON-NLS-1$ static const char[] FACTORY_PARENTTYPENAME = "AtkObjectFactory"; static const char[] SWT_TYPE_PREFIX = "SWT"; static const char[] CHILD_TYPENAME = "Child"; @@ -56,30 +56,30 @@ /* AT callbacks*/ /* interface definitions */ static GTypeInfo* ObjectIfaceDefinition; - static const GInterfaceInfo* ActionIfaceDefinition; - static const GInterfaceInfo* ComponentIfaceDefinition; - static const GInterfaceInfo* HypertextIfaceDefinition; - static const GInterfaceInfo* SelectionIfaceDefinition; - static const GInterfaceInfo* TextIfaceDefinition; + static GInterfaceInfo* ActionIfaceDefinition; + static GInterfaceInfo* ComponentIfaceDefinition; + static GInterfaceInfo* HypertextIfaceDefinition; + static GInterfaceInfo* SelectionIfaceDefinition; + static GInterfaceInfo* TextIfaceDefinition; - static this(){ - DefaultParentType = OS.g_type_from_name ("GtkAccessible"); //$NON-NLS-1$ - /* Action interface */ - ActionIfaceDefinition = cast(GInterfaceInfo*)OS.g_malloc (GInterfaceInfo.sizeof); - ActionIfaceDefinition.interface_init = &AccessibleFactory.initActionIfaceCB; - /* Component interface */ - ComponentIfaceDefinition = cast(GInterfaceInfo*)OS.g_malloc (GInterfaceInfo.sizeof); - ComponentIfaceDefinition.interface_init = &AccessibleFactory.initComponentIfaceCB; - /* Hypertext interface */ - HypertextIfaceDefinition = cast(GInterfaceInfo*)OS.g_malloc (GInterfaceInfo.sizeof); - HypertextIfaceDefinition.interface_init = &AccessibleFactory.initHypertextIfaceCB; - /* Selection interface */ - SelectionIfaceDefinition = cast(GInterfaceInfo*)OS.g_malloc (GInterfaceInfo.sizeof); - SelectionIfaceDefinition.interface_init = &AccessibleFactory.initSelectionIfaceCB; - /* Text interface */ - TextIfaceDefinition =cast(GInterfaceInfo*) OS.g_malloc (GInterfaceInfo.sizeof); - TextIfaceDefinition.interface_init = &AccessibleFactory.initTextIfaceCB; - } + static synchronized void static_this(){ + DefaultParentType = OS.g_type_from_name ("GtkAccessible"); //$NON-NLS-1$ + /* Action interface */ + ActionIfaceDefinition = cast(GInterfaceInfo*)OS.g_malloc (GInterfaceInfo.sizeof); + ActionIfaceDefinition.interface_init = &AccessibleFactory.initActionIfaceCB; + /* Component interface */ + ComponentIfaceDefinition = cast(GInterfaceInfo*)OS.g_malloc (GInterfaceInfo.sizeof); + ComponentIfaceDefinition.interface_init = &AccessibleFactory.initComponentIfaceCB; + /* Hypertext interface */ + HypertextIfaceDefinition = cast(GInterfaceInfo*)OS.g_malloc (GInterfaceInfo.sizeof); + HypertextIfaceDefinition.interface_init = &AccessibleFactory.initHypertextIfaceCB; + /* Selection interface */ + SelectionIfaceDefinition = cast(GInterfaceInfo*)OS.g_malloc (GInterfaceInfo.sizeof); + SelectionIfaceDefinition.interface_init = &AccessibleFactory.initSelectionIfaceCB; + /* Text interface */ + TextIfaceDefinition =cast(GInterfaceInfo*) OS.g_malloc (GInterfaceInfo.sizeof); + TextIfaceDefinition.interface_init = &AccessibleFactory.initTextIfaceCB; + } private this (int /*long*/ widgetType) { widgetTypeName = OS.g_type_name (widgetType); diff -r 3da31bec7de0 -r 8f049b136add dwt/accessibility/AccessibleObject.d --- a/dwt/accessibility/AccessibleObject.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/accessibility/AccessibleObject.d Fri Jan 11 14:31:37 2008 +0100 @@ -46,14 +46,14 @@ static char[] keybindingPtr; static char[] namePtr; static AccessibleObject[AtkObject*] AccessibleObjects; - static const uint ATK_ACTION_TYPE; - static const uint ATK_COMPONENT_TYPE; - static const uint ATK_HYPERTEXT_TYPE; - static const uint ATK_SELECTION_TYPE; - static const uint ATK_TEXT_TYPE; - static const bool DEBUG; + static /*const*/ uint ATK_ACTION_TYPE; + static /*const*/ uint ATK_COMPONENT_TYPE; + static /*const*/ uint ATK_HYPERTEXT_TYPE; + static /*const*/ uint ATK_SELECTION_TYPE; + static /*const*/ uint ATK_TEXT_TYPE; + static /*const*/ bool DEBUG; - static this(){ + public static void static_this() { DEBUG = Display.DEBUG; ATK_ACTION_TYPE = ATK.g_type_from_name ("AtkAction"); ATK_COMPONENT_TYPE = ATK.g_type_from_name ("AtkComponent"); diff -r 3da31bec7de0 -r 8f049b136add dwt/graphics/Device.d --- a/dwt/graphics/Device.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/graphics/Device.d Fri Jan 11 14:31:37 2008 +0100 @@ -28,35 +28,6 @@ import tango.stdc.stringz; import tango.io.Stdout; -/+ -class Device{ - static Device getDevice(){ - return null; - } - void new_Object (Object object) { - } - void dispose_Object (Object object) { - } - bool tracking; - bool useXRender; - bool isDisposed(){ - return false; - } - int[] colorRefCount; - GdkColor*[] gdkColors; - public Color getSystemColor (int id) { - return null; - } - Font systemFont; - Color COLOR_BLACK, COLOR_DARK_RED, COLOR_DARK_GREEN, COLOR_DARK_YELLOW, COLOR_DARK_BLUE; - Color COLOR_DARK_MAGENTA, COLOR_DARK_CYAN, COLOR_GRAY, COLOR_DARK_GRAY, COLOR_RED; - Color COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE; -} - -+/ - - - /** * This class is the abstract superclass of all device objects, * such as the Display device and the Printer device. Devices @@ -125,7 +96,7 @@ static bool CAIRO_LOADED; - static const Object CREATE_LOCK; + static Object CREATE_LOCK; /* * TEMPORARY CODE. When a graphics object is @@ -142,7 +113,7 @@ protected static Device CurrentDevice; protected static Runnable DeviceFinder; -static this(){ +synchronized static void static_this(){ CREATE_LOCK = new Object(); Devices = new Device[4]; } @@ -189,7 +160,7 @@ tracking = DEBUG; synchronized (CREATE_LOCK) { - if (data != null) { + if (data !is null) { debugging = data.debugging; tracking = data.tracking; } @@ -352,13 +323,13 @@ int count = 0, length = 0; if (tracking) length = objects.length; for (int i=0; i 0 || (major_version == 0 && minor_version >= 8); + useXRender = major_version > 0 || (major_version is 0 && minor_version >= 8); } } @@ -587,10 +558,10 @@ synchronized (CREATE_LOCK) { int index = 0; while (index < Devices.length) { - if (Devices [index] != null) break; + if (Devices [index] !is null) break; index++; } - if (index == Devices.length) { + if (index is Devices.length) { OS.XSetErrorHandler ( & XErrorProcFunc ); OS.XSetIOErrorHandler ( & XIOErrorProcFunc ); } @@ -699,13 +670,13 @@ */ public bool loadFont (char[] path) { checkDevice(); - if (path == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + if (path is null) SWT.error (SWT.ERROR_NULL_ARGUMENT); return cast(bool) OS.FcConfigAppFontAddFile (null, toStringz(path)); } private static extern(C) void logFunction (char* log_domain, int log_level, char* message, void* user_data) { Device dev = cast(Device)user_data; - if (dev.warningLevel == 0) { + if (dev.warningLevel is 0) { if (DEBUG || dev.debugging) { foreach( msg; new TracedException ("") ){ Stderr.formatln( "trc {}", msg ); @@ -824,17 +795,17 @@ public void setWarnings (bool warnings) { checkDevice (); if (warnings) { - if (--warningLevel == 0) { + if (--warningLevel is 0) { if (debugging) return; for (int i=0; i>= b) != 0;) inc |= bit; - for (int v = 0, p = 0; v < 0x10000; v+= inc) data[p++] = cast(byte)(v >> 8); - } - ONE_TO_ONE_MAPPING = ANY_TO_EIGHT[8]; + static byte[][] ANY_TO_EIGHT; + + synchronized static void static_this() { + ANY_TO_EIGHT = new byte[][](9); + for (int b = 0; b < 9; ++b) { + byte[] data = ANY_TO_EIGHT[b] = new byte[1 << b]; + if (b == 0) continue; + int inc = 0; + for (int bit = 0x10000; (bit >>= b) != 0;) inc |= bit; + for (int v = 0, p = 0; v < 0x10000; v+= inc) data[p++] = cast(byte)(v >> 8); + } + ONE_TO_ONE_MAPPING = ANY_TO_EIGHT[8]; } - static const byte[] ONE_TO_ONE_MAPPING; + static byte[] ONE_TO_ONE_MAPPING; /** * Scaled 8x8 Bayer dither matrix. @@ -422,7 +423,6 @@ byte[] alphaData, int alpha, int transparentPixel, int type, int x, int y, int disposalMethod, int delayTime) { - if (palette == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (!(depth == 1 || depth == 2 || depth == 4 || depth == 8 || depth == 16 || depth == 24 || depth == 32)) { diff -r 3da31bec7de0 -r 8f049b136add dwt/internal/Library.d --- a/dwt/internal/Library.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/internal/Library.d Fri Jan 11 14:31:37 2008 +0100 @@ -35,7 +35,7 @@ * The JAVA and SWT versions */ //public static const int JAVA_VERSION; - public static const int SWT_VERSION; + public static /*const*/ int SWT_VERSION; version( linux ){ static const char[] SEPARATOR = "\n"; @@ -45,7 +45,7 @@ } -static this(){ +public static void static_this() { //SEPARATOR = System.getProperty("file.separator"); //JAVA_VERSION = parseVersion(System.getProperty("java.version")); SWT_VERSION = buildSWT_VERSION(MAJOR_VERSION, MINOR_VERSION); diff -r 3da31bec7de0 -r 8f049b136add dwt/internal/Lock.d --- a/dwt/internal/Lock.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/internal/Lock.d Fri Jan 11 14:31:37 2008 +0100 @@ -23,7 +23,7 @@ Mutex mutex; Condition cond; - public this(){ + public this() { mutex = new Mutex; cond = new Condition(mutex); } @@ -37,7 +37,7 @@ public int lock() { synchronized (mutex) { Thread current = Thread.getThis(); - if (owner != current) { + if (owner !is current) { waitCount++; while (count > 0) { try { @@ -60,8 +60,8 @@ public void unlock() { synchronized (mutex) { Thread current = Thread.getThis(); - if (owner == current) { - if (--count == 0) { + if (owner is current) { + if (--count is 0) { owner = null; if (waitCount > 0) cond.notifyAll(); } diff -r 3da31bec7de0 -r 8f049b136add dwt/internal/Platform.d --- a/dwt/internal/Platform.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/internal/Platform.d Fri Jan 11 14:31:37 2008 +0100 @@ -18,8 +18,8 @@ public class Platform { public static const char[] PLATFORM = "gtk"; //$NON-NLS-1$ - public static const Lock lock; - static this(){ + public static /*const*/ Lock lock; + public static void static_this() { lock = new Lock(); } } diff -r 3da31bec7de0 -r 8f049b136add dwt/internal/accessibility/gtk/ATK.d --- a/dwt/internal/accessibility/gtk/ATK.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/internal/accessibility/gtk/ATK.d Fri Jan 11 14:31:37 2008 +0100 @@ -36,12 +36,24 @@ alias dwt.internal.c.gtk.GtkAccessible GtkAccessible; -private AtkActionIface* ATK_ACTION_GET_IFACE( AtkObject* ); -private AtkComponentIface* ATK_COMPONENT_GET_IFACE( AtkObject* ); -private AtkObjectFactoryClass* ATK_OBJECT_FACTORY_CLASS( void* ); -private AtkSelectionIface* ATK_SELECTION_GET_IFACE( AtkObject* ); -private AtkTextIface* ATK_TEXT_GET_IFACE(AtkObject*); -private GtkAccessible* GTK_ACCESSIBLE(AtkObject*); +private AtkActionIface* ATK_ACTION_GET_IFACE( AtkObject* ){ + return null; +} +private AtkComponentIface* ATK_COMPONENT_GET_IFACE( AtkObject* ){ + return null; +} +private AtkObjectFactoryClass* ATK_OBJECT_FACTORY_CLASS( void* ){ + return null; +} +private AtkSelectionIface* ATK_SELECTION_GET_IFACE( AtkObject* ){ + return null; +} +private AtkTextIface* ATK_TEXT_GET_IFACE(AtkObject*){ + return null; +} +private GtkAccessible* GTK_ACCESSIBLE(AtkObject*){ + return null; +} diff -r 3da31bec7de0 -r 8f049b136add dwt/internal/gtk/OS.d --- a/dwt/internal/gtk/OS.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/internal/gtk/OS.d Fri Jan 11 14:31:37 2008 +0100 @@ -144,6 +144,7 @@ public alias dwt.internal.c.gtk.GtkImageMenuItem GtkImageMenuItem; public alias dwt.internal.c.gtk.GtkMenuItem GtkMenuItem; public alias dwt.internal.c.gtk.GtkIMMulticontext GtkIMMulticontext; +public alias dwt.internal.c.gtk.GtkTooltipsData GtkTooltipsData; public alias dwt.internal.c.Xlib.XErrorEvent XErrorEvent; public alias dwt.internal.c.Xlib.XExposeEvent XExposeEvent; @@ -244,8 +245,8 @@ public class OS : Platform { /** OS Constants */ - public static const bool IsAIX, IsSunOS, IsLinux, IsHPUX; - static this() { + public static /*const*/ bool IsAIX, IsSunOS, IsLinux, IsHPUX; + public static void static_this() { /* Initialize the OS flags and locale constants */ char[] osName = "Linux";//System.getProperty ("os.name"); bool isAIX = false, isSunOS = false, isLinux = false, isHPUX = false; @@ -256,7 +257,7 @@ if (osName == "HP-UX") isHPUX = true; IsAIX = isAIX; IsSunOS = isSunOS; IsLinux = isLinux; IsHPUX = isHPUX; //PORTING_LEFT - GTK_VERSION = 0; //buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version()); + GTK_VERSION = buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version()); } /** Constants */ @@ -703,7 +704,7 @@ public static const char[] ypad = "ypad"; public static const char[] GTK_PRINT_SETTINGS_OUTPUT_URI = "output-uri"; - public static const int GTK_VERSION;// see static ctor = buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version()); + public static /*const*/ int GTK_VERSION;// see static ctor = buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version()); public static int buildVERSION(int major, int minor, int micro) { diff -r 3da31bec7de0 -r 8f049b136add dwt/internal/image/JPEGFileFormat.d --- a/dwt/internal/image/JPEGFileFormat.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/internal/image/JPEGFileFormat.d Fri Jan 11 14:31:37 2008 +0100 @@ -124,7 +124,7 @@ public static const int ID_Y = 1 - 1; public static const int ID_CB = 2 - 1; public static const int ID_CR = 3 - 1; - public static const RGB[] RGB16; + public static /*const*/ RGB[] RGB16; public static const int[] ExtendTest = [ 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144 @@ -147,7 +147,7 @@ public static int[] CrRTable, CbBTable, CrGTable, CbGTable; public static int[] RYTable, GYTable, BYTable, RCbTable, GCbTable, BCbTable, RCrTable, GCrTable, BCrTable, NBitsTable; - static this(){ + public static void static_this() { initialize(); RGB16 = [ new RGB(0,0,0), diff -r 3da31bec7de0 -r 8f049b136add dwt/internal/image/PngChunk.d --- a/dwt/internal/image/PngChunk.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/internal/image/PngChunk.d Fri Jan 11 14:31:37 2008 +0100 @@ -49,8 +49,8 @@ static const byte[] TYPE_IEND = cast(byte[])"IEND";//{(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'}; static const byte[] TYPE_tRNS = cast(byte[])"tRNS";//{(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'}; - static const int[] CRC_TABLE; - static this() { + static /*const*/ int[] CRC_TABLE; + public static void static_this() { CRC_TABLE = new int[256]; for (int i = 0; i < 256; i++) { CRC_TABLE[i] = i; diff -r 3da31bec7de0 -r 8f049b136add dwt/widgets/Control.d --- a/dwt/widgets/Control.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/widgets/Control.d Fri Jan 11 14:31:37 2008 +0100 @@ -43,40 +43,19 @@ import dwt.widgets.Decorations; import dwt.widgets.Display; 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.TypedListener; import dwt.widgets.Widget; +import dwt.accessibility.Accessible; import Math = tango.math.Math; import tango.stdc.string; import tango.stdc.stringz; import tango.core.Thread; -/+ -class Control : Widget { - GdkWindow* paintWindow () { return null; }; - public Shell getShell(); - bool isEnabled(); - bool isDisposed(); - GdkWindow* eventWindow (); - GtkIMContext * imHandle(); - Control findBackgroundControl (); - GdkColor* getBackgroundColor () ; - GdkColor* getForegroundColor () ; - PangoFontDescription* getFontDescription (); - public Point toDisplay (int x, int y); - public Point toDisplay (Point point) ; - Point getIMCaretPos () ; -} -+/ - -class Accessible{ - static Accessible internal_new_Accessible(Control); -} /** * Control is the abstract superclass of all windowed user interface classes. @@ -2430,6 +2409,7 @@ switch (button) { case -6: button = 4; break; case -7: button = 5; break; + default: } return sendMouseEvent (SWT.MouseUp, button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1; } @@ -2509,6 +2489,7 @@ sendFocusEvent (gdkEventFocus.in_ !is 0 ? SWT.FocusIn : SWT.FocusOut); break; + default: } } return 0; @@ -2693,6 +2674,7 @@ 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; + default: } return 0; } @@ -3121,6 +3103,7 @@ shell.setActiveControl (null); } break; + default: } } } @@ -4148,6 +4131,7 @@ case SWT.TRAVERSE_MNEMONIC: return traverseMnemonic (event.character); case SWT.TRAVERSE_PAGE_NEXT: return traversePage (true); case SWT.TRAVERSE_PAGE_PREVIOUS: return traversePage (false); + default: } return false; } @@ -4290,6 +4274,7 @@ } } break; + default: } } return super.windowProc (handle, arg0, user_data); diff -r 3da31bec7de0 -r 8f049b136add dwt/widgets/Display.d --- a/dwt/widgets/Display.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/widgets/Display.d Fri Jan 11 14:31:37 2008 +0100 @@ -40,13 +40,13 @@ import dwt.widgets.Tray; import dwt.widgets.Widget; -import tango.io.Stdout; import tango.stdc.string; import tango.stdc.stringz; import dwt.dwthelper.utils; import dwt.dwthelper.Runnable; import tango.core.Thread; +import tango.io.Stdout; /** * Instances of this class are responsible for managing the @@ -154,9 +154,9 @@ Widget lastWidget; Widget [] widgetTable; 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 int SWT_OBJECT_INDEX; + static int SWT_OBJECT_INDEX1; + static int SWT_OBJECT_INDEX2; /* Focus */ int focusEvent; @@ -209,9 +209,10 @@ /* Idle proc callback */ CallbackData idleProcCallbackData; int idleHandle; - static const char[] ADD_IDLE_PROC_KEY; - static const char[] REMOVE_IDLE_PROC_KEY; - Object idleLock; + static const char[] ADD_IDLE_PROC_KEY = "dwt.internal.gtk2.addIdleProc"; + static const char[] REMOVE_IDLE_PROC_KEY = "dwt.internal.gtk2.removeIdleProc"; + + Object idleLock; bool idleNeeded; /* GtkTreeView callbacks */ @@ -390,15 +391,13 @@ * it does not compile on some Java compilers when they are * targeted for CLDC. Use Class.forName() instead. */ - static this(){ - Displays = new Display [4]; - initDeviceFinder(); - SWT_OBJECT_INDEX = OS.g_quark_from_string ("SWT_OBJECT_INDEX"); - SWT_OBJECT_INDEX1 = OS.g_quark_from_string ("SWT_OBJECT_INDEX1"); - SWT_OBJECT_INDEX2 = OS.g_quark_from_string ("SWT_OBJECT_INDEX2"); - ADD_IDLE_PROC_KEY = "dwt.internal.gtk2.addIdleProc"; - REMOVE_IDLE_PROC_KEY = "dwt.internal.gtk2.removeIdleProc"; - } + synchronized static void static_this() { + Displays = new Display [4]; + initDeviceFinder(); + SWT_OBJECT_INDEX = OS.g_quark_from_string ("SWT_OBJECT_INDEX"); + SWT_OBJECT_INDEX1 = OS.g_quark_from_string ("SWT_OBJECT_INDEX1"); + SWT_OBJECT_INDEX2 = OS.g_quark_from_string ("SWT_OBJECT_INDEX2"); + } /* GTK Version */ static const int MAJOR = 2; @@ -790,6 +789,7 @@ } } break; + default: } } return 0; @@ -913,9 +913,10 @@ /* Initialize the filter and event callback */ OS.gdk_event_handler_set (&eventProcFunc, cast(void*)this, null); - filterProcCallbackData.display = this; - filterProcCallbackData.data = null; - OS.gdk_window_add_filter (null, &filterProcFunc, cast(void*)&filterProcCallbackData ); + //filterProcCallbackData.display = this; + //filterProcCallbackData.data = null; + //OS.gdk_window_add_filter (null, &filterProcFunc, cast(void*)&filterProcCallbackData ); + doWindowAddFilter( &filterProcCallbackData, null, null ); } /* @@ -924,13 +925,13 @@ package void doWindowAddFilter( CallbackData* cbdata, GdkWindow* window, GtkWidget* widget ){ cbdata.display = this; cbdata.data = widget; - OS.gdk_window_add_filter (window, &filterProcFunc, cast(void*)&cbdata ); + OS.gdk_window_add_filter (window, &filterProcFunc, cbdata ); } package void doWindowRemoveFilter( CallbackData* cbdata, GdkWindow* window, GtkWidget* widget ){ cbdata.display = this; cbdata.data = widget; - OS.gdk_window_remove_filter(window, &filterProcFunc, cast(void*)&cbdata ); + OS.gdk_window_remove_filter(window, &filterProcFunc, cbdata ); } Image createImage (char[] name) { @@ -1133,6 +1134,7 @@ case OS.GDK_BUTTON_PRESS: case OS.GDK_KEY_PRESS: lastUserEventTime = time; + default: } bool dispatch = true; if (dispatchEvents !is null) { @@ -1186,6 +1188,7 @@ } } } while ((window = OS.gdk_window_get_parent (window)) !is null); + default: } } if (control !is null) { @@ -1427,7 +1430,8 @@ auto callbackdata = cast(CallbackData*)data; auto disp = callbackdata.display; if( disp is null ) return 0; - return disp.filterProcMeth(xEvent,gdkEvent,callbackdata); + auto res = disp.filterProcMeth(xEvent,gdkEvent,callbackdata); + return res; } int filterProcMeth (GdkXEvent* xEvent, GdkEvent* gdkEvent, CallbackData* callbackData) { @@ -1447,6 +1451,7 @@ case 7: mouseEvent.button = -mouseEvent.button; break; + default: } } } @@ -1604,9 +1609,9 @@ } // /+static bool isValidClass (Class clazz) { -// //PROTING_TODO char[] name = clazz.getName (); -// //PROTING_TODO int index = name.lastIndexOf ('.'); -// //PROTING_TODO return name.substring (0, index + 1)==/*eq*/ PACKAGE_PREFIX; +// //PORTING_TODO char[] name = clazz.getName (); +// //PORTING_TODO int index = name.lastIndexOf ('.'); +// //PORTING_TODO return name.substring (0, index + 1)==/*eq*/ PACKAGE_PREFIX; // return true; // }+/ @@ -2072,6 +2077,7 @@ warningImage = createImage ("gtk-dialog-warning"); } return warningImage; + default: } return null; } @@ -2840,6 +2846,7 @@ OS.XTestFakeButtonEvent (xDisplay, button, type is SWT.MouseDown, 0); } return true; + default: } /* * This code is intentionally commented. After posting a @@ -3719,13 +3726,36 @@ return 0; } -int /*long*/ sizeAllocateProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) { + +package int doSizeAllocateConnect( CallbackData* cbdata, GtkWidget* window, GtkWidget* widget ){ + cbdata.display = this; + cbdata.data = cast(void*)widget; + return OS.g_signal_connect (cast(void*)window, OS.size_allocate.ptr, cast(GCallback)&sizeAllocateProcFunc, cast(void*)&cbdata); +} + +private static extern(C) void sizeAllocateProcFunc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) { + auto cbdata = cast(CallbackData*)user_data; + cbdata.display.sizeAllocateProc( cast(GtkWidget*)handle, arg0, cast(int)cbdata.data ); +} + +void sizeAllocateProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) { Widget widget = getWidget ( cast(GtkWidget*)user_data); if (widget is null) return 0; - return widget.sizeAllocateProc (handle, arg0, user_data); + widget.sizeAllocateProc (handle, arg0, user_data); } +package int doSizeRequestConnect( CallbackData* cbdata, GtkWidget* window, GtkWidget* widget ){ + cbdata.display = this; + cbdata.data = cast(void*)widget; + return OS.g_signal_connect (cast(void*)window, OS.size_request.ptr, cast(GCallback)&sizeRequestProcFunc, cast(void*)&cbdata ); +} + +private static extern(C) void sizeRequestProcFunc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) { + auto cbdata = cast(CallbackData*)user_data; + cbdata.display.sizeRequestProcMeth( cast(GtkWidget*)handle, arg0, cast(int)cbdata.data ); +} + int /*long*/ sizeRequestProcMeth (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) { Widget widget = getWidget (cast(GtkWidget*)user_data); if (widget is null) return 0; @@ -3954,9 +3984,9 @@ } package int doWindowTimerAdd( CallbackData* cbdata, int delay, GtkWidget* widget ){ - timerProcCallbackData.display = this; - timerProcCallbackData.data = cast(void*)widget; - return OS.gtk_timeout_add (delay, &windowTimerProcFunc, &timerProcCallbackData); + cbdata.display = this; + cbdata.data = cast(void*)widget; + return OS.gtk_timeout_add (delay, &windowTimerProcFunc, &cbdata); } private static extern(C) int /*long*/ windowTimerProcFunc (void* user_data) { diff -r 3da31bec7de0 -r 8f049b136add dwt/widgets/EventTable.d --- a/dwt/widgets/EventTable.d Fri Jan 11 11:21:52 2008 +0100 +++ b/dwt/widgets/EventTable.d Fri Jan 11 14:31:37 2008 +0100 @@ -12,20 +12,25 @@ import dwt.widgets.Listener; import dwt.widgets.Event; +import dwt.widgets.Listener; +import dwt.widgets.TypedListener; +import dwt.internal.SWTEventListener; +import dwt.dwthelper.System; +import dwt.SWT; import dwt.internal.SWTEventListener; +/+ class EventTable{ - public void hook (int eventType, Listener listener) {} - public void sendEvent (Event event) ; - public bool hooks (int eventType) ; - public void unhook (int eventType, Listener listener) ; - public void unhook (int eventType, SWTEventListener listener) ; - public int size () ; + public void hook (int eventType, Listener listener) { + } + public void sendEvent (Event event) {} + public bool hooks (int eventType) { return false; } + public void unhook (int eventType, Listener listener) {} + public void unhook (int eventType, SWTEventListener listener) {} + public int size () { return 0;} } ++/ -/+++ -import dwt.*; -import dwt.internal.SWTEventListener; /** * Instances of this class implement a simple @@ -40,52 +45,52 @@ int level; public void hook (int eventType, Listener listener) { - if (types == null) types = new int [4]; - if (listeners == null) listeners = new Listener [4]; + if (types is null) types = new int [4]; + if (listeners is null) listeners = new Listener [4]; int length = types.length, index = length - 1; while (index >= 0) { - if (types [index] != 0) break; + if (types [index] !is 0) break; --index; } index++; - if (index == length) { + if (index is 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); + SimpleType!(Listener).arraycopy (listeners, 0, newListeners, 0, length); listeners = newListeners; } types [index] = eventType; listeners [index] = listener; } -public boolean hooks (int eventType) { - if (types == null) return false; +public bool hooks (int eventType) { + if (types is null) return false; for (int i=0; i= 0 ? 1 : -1; try { for (int i=0; i= 0 ? 1 : -1; - if (compact && level == 0) { + if (compact && level is 0) { int index = 0; for (int i=0; i 0) level = -level; @@ -122,9 +127,9 @@ } public void unhook (int eventType, Listener listener) { - if (types == null) return; + if (types is null) return; for (int i=0; i