Mercurial > projects > dwt-linux
diff dwt/widgets/Display.d @ 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 | 92223a4ecca7 |
children | 09f5459a5014 |
line wrap: on
line diff
--- 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