# HG changeset patch # User Frank Benoit # Date 1199688452 -3600 # Node ID b73b14942338cccb6bceaf1c379805761fb0995e # Parent 92223a4ecca765b6f14dd8bd6acdd3cf37017b59 Device diff -r 92223a4ecca7 -r b73b14942338 dwt/graphics/Device.d --- a/dwt/graphics/Device.d Mon Jan 07 03:41:50 2008 +0100 +++ b/dwt/graphics/Device.d Mon Jan 07 07:47:32 2008 +0100 @@ -10,8 +10,28 @@ *******************************************************************************/ module dwt.graphics.Device; -import dwt.internal.gtk.c.gdktypes : GdkColor; +import dwt.internal.gtk.c.gdktypes; +import dwt.internal.gtk.c.gtktypes; import dwt.graphics.Color; +import dwt.graphics.Font; +import dwt.graphics.Drawable; +import dwt.graphics.DeviceData; +import dwt.graphics.Rectangle; +import dwt.graphics.FontData; +import dwt.graphics.Font; +import dwt.graphics.GCData; +import dwt.dwthelper.Runnable; +import dwt.SWT; +import dwt.SWTError; +import dwt.internal.Compatibility; +import dwt.internal.gtk.OS; +import dwt.internal.gtk.c.gdktypes; + +import tango.core.Exception; +import tango.stdc.stringz; +import tango.io.Stdout; + +/+ class Device{ static Device getDevice(){ return null; @@ -30,13 +50,15 @@ 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; } -/++++ ++/ -import dwt.*; -import dwt.internal.*; -import dwt.internal.gtk.*; + /** * This class is the abstract superclass of all device objects, @@ -44,7 +66,7 @@ * can have a graphics context (GC) created for them, and they * can be drawn on by sending messages to the associated GC. */ -public abstract class Device implements Drawable { +public abstract class Device : Drawable { /** * the handle to the X Display * (Warning: This field is platform dependent) @@ -55,35 +77,38 @@ * platforms and should never be accessed from application code. *

*/ - protected int /*long*/ xDisplay; - int /*long*/ shellHandle; + protected dwt.internal.gtk.c.cairotypes.Display* xDisplay; + GtkWidget* shellHandle; /* Debugging */ - public static boolean DEBUG; - boolean debug = DEBUG; - boolean tracking = DEBUG; - Error [] errors; + public static bool DEBUG; + bool debugging; + bool tracking; + TracedException [] errors; Object [] objects; /* Colormap and reference count */ - GdkColor [] gdkColors; + GdkColor *[] gdkColors; int [] colorRefCount; /* Disposed flag */ - boolean disposed; + bool disposed; /* Warning and Error Handlers */ - int /*long*/ logProc; - Callback logCallback; + //int /*long*/ logProcFld; + //GLogFunc logCallback; //NOT DONE - get list of valid names - String [] log_domains = {"GLib-GObject", "GLib", "GObject", "Pango", "ATK", "GdkPixbuf", "Gdk", "Gtk", "GnomeVFS"}; - int [] handler_ids = new int [log_domains.length]; + char[] [] log_domains = ["GLib-GObject"[], "GLib", "GObject", "Pango", "ATK", "GdkPixbuf", "Gdk", "Gtk", "GnomeVFS"]; + int [] handler_ids;// = new int [log_domains.length]; int warningLevel; /* X Warning and Error Handlers */ - static Callback XErrorCallback, XIOErrorCallback; + static extern(C) int function(void *) mXIOErrorHandler; + static extern(C) int function(void *, XErrorEvent *) mXErrorHandler; + //static int mXErrorCallback, mXIOErrorCallback; + static int /*long*/ XErrorProc, XIOErrorProc, XNullErrorProc, XNullIOErrorProc; - static Device[] Devices = new Device[4]; + static Device[] Devices; /* * The following colors are listed in the Windows @@ -97,13 +122,13 @@ /* System Font */ Font systemFont; - int /*long*/ emptyTab; + PangoTabArray* emptyTab; - boolean useXRender; + bool useXRender; - static boolean CAIRO_LOADED; + static bool CAIRO_LOADED; - static final Object CREATE_LOCK = new Object(); + static const Object CREATE_LOCK; /* * TEMPORARY CODE. When a graphics object is @@ -119,17 +144,16 @@ */ protected static Device CurrentDevice; protected static Runnable DeviceFinder; - static { - try { - Class.forName ("dwt.widgets.Display"); - } catch (Throwable e) {} - } +static this(){ + CREATE_LOCK = new Object(); + Devices = new Device[4]; +} /* * TEMPORARY CODE. */ static synchronized Device getDevice () { - if (DeviceFinder != null) DeviceFinder.run(); + if (DeviceFinder !is null) DeviceFinder.run(); Device device = CurrentDevice; CurrentDevice = null; return device; @@ -146,7 +170,7 @@ * * @since 3.1 */ -public Device() { +public this() { this(null); } @@ -162,14 +186,18 @@ * @see #init * @see DeviceData */ -public Device(DeviceData data) { +public this(DeviceData data) { + handler_ids = new int [log_domains.length]; + debugging = DEBUG; + tracking = DEBUG; + synchronized (CREATE_LOCK) { if (data != null) { - debug = data.debug; + debugging = data.debugging; tracking = data.tracking; } if (tracking) { - errors = new Error [128]; + errors = new TracedException [128]; objects = new Object [128]; } create (data); @@ -182,25 +210,6 @@ } void checkCairo() { - if (CAIRO_LOADED) return; - try { - /* Check if cairo is available on the system */ - byte[] buffer = Converter.wcsToMbcs(null, "libcairo.so.2", true); - int /*long*/ libcairo = OS.dlopen(buffer, OS.RTLD_LAZY); - if (libcairo != 0) { - OS.dlclose(libcairo); - } else { - try { - System.loadLibrary("cairo-swt"); - } catch (UnsatisfiedLinkError e) { - /* Ignore problems loading the fallback library */ - } - } - Class.forName("dwt.internal.cairo.Cairo"); - CAIRO_LOADED = true; - } catch (Throwable t) { - SWT.error(SWT.ERROR_NO_GRAPHICS_LIBRARY, t, " [Cairo is required]"); - } } /** @@ -260,7 +269,7 @@ release (); destroy (); deregister (this); - xDisplay = 0; + xDisplay = null; disposed = true; if (tracking) { objects = null; @@ -270,7 +279,7 @@ void dispose_Object (Object object) { for (int i=0; iERROR_DEVICE_DISPOSED - if the receiver has been disposed * */ -public FontData[] getFontList (String faceName, boolean scalable) { +public FontData[] getFontList (char[] faceName, bool scalable) { checkDevice (); if (!scalable) return new FontData[0]; - int /*long*/[] family = new int /*long*/[1]; - int /*long*/[] face = new int /*long*/[1]; - int /*long*/[] families = new int /*long*/[1]; - int[] n_families = new int[1]; - int /*long*/[] faces = new int /*long*/[1]; - int[] n_faces = new int[1]; - int /*long*/ context = OS.gdk_pango_context_get(); - OS.pango_context_list_families(context, families, n_families); + PangoFontFamily* family; + PangoFontFace * face; + PangoFontFamily** families; + int n_families; + PangoFontFace ** faces; + int n_faces; + auto context = OS.gdk_pango_context_get(); + OS.pango_context_list_families(context, &families, &n_families); int nFds = 0; - FontData[] fds = new FontData[faceName != null ? 4 : n_families[0]]; - for (int i=0; iERROR_DEVICE_DISPOSED - if the receiver has been disposed * */ -public boolean getWarnings () { +public bool getWarnings () { checkDevice (); return warningLevel == 0; } @@ -570,34 +571,27 @@ * @see #create */ protected void init () { - if (xDisplay != 0) { - int[] event_basep = new int[1], error_basep = new int [1]; - if (OS.XRenderQueryExtension (xDisplay, event_basep, error_basep)) { - int[] major_versionp = new int[1], minor_versionp = new int [1]; - OS.XRenderQueryVersion (xDisplay, major_versionp, minor_versionp); - useXRender = major_versionp[0] > 0 || (major_versionp[0] == 0 && minor_versionp[0] >= 8); + if (xDisplay !is null) { + int event_basep, error_basep; + if (OS.XRenderQueryExtension (xDisplay, &event_basep, &error_basep)) { + int major_version, minor_version; + OS.XRenderQueryVersion (xDisplay, &major_version, &minor_version); + useXRender = major_version > 0 || (major_version == 0 && minor_version >= 8); } } - if (debug) { - if (xDisplay != 0) { + if (debugging) { + if (xDisplay !is null) { /* Create the warning and error callbacks */ - Class clazz = getClass (); - synchronized (clazz) { + synchronized (CREATE_LOCK) { int index = 0; while (index < Devices.length) { if (Devices [index] != null) break; index++; } if (index == Devices.length) { - XErrorCallback = new Callback (clazz, "XErrorProc", 2); - XNullErrorProc = XErrorCallback.getAddress (); - if (XNullErrorProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - XIOErrorCallback = new Callback (clazz, "XIOErrorProc", 1); - XNullIOErrorProc = XIOErrorCallback.getAddress (); - if (XNullIOErrorProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - XErrorProc = OS.XSetErrorHandler (XNullErrorProc); - XIOErrorProc = OS.XSetIOErrorHandler (XNullIOErrorProc); + OS.XSetErrorHandler ( & XErrorProcFunc ); + OS.XSetIOErrorHandler ( & XIOErrorProcFunc ); } } OS.XSynchronize (xDisplay, true); @@ -605,22 +599,17 @@ } /* Create GTK warnings and error callbacks */ - if (xDisplay != 0) { - logCallback = new Callback (this, "logProc", 4); - logProc = logCallback.getAddress (); - if (logProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - + if (xDisplay !is null) { /* Set GTK warning and error handlers */ - if (debug) { + if (debugging) { int flags = OS.G_LOG_LEVEL_MASK | OS.G_LOG_FLAG_FATAL | OS.G_LOG_FLAG_RECURSION; for (int i=0; itrue if the device has been disposed, @@ -687,7 +676,7 @@ * * @return true when the device is disposed and false otherwise */ -public boolean isDisposed () { +public bool isDisposed () { return disposed; } @@ -707,52 +696,52 @@ * * @since 3.3 */ -public boolean loadFont (String path) { +public bool loadFont (char[] path) { checkDevice(); if (path == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - byte [] buffer = Converter.wcsToMbcs (null, path, true); - return OS.FcConfigAppFontAddFile (0, buffer); + return cast(bool) OS.FcConfigAppFontAddFile (null, toStringz(path)); } -int /*long*/ logProc (int /*long*/ log_domain, int /*long*/ log_level, int /*long*/ message, int /*long*/ user_data) { - if (warningLevel == 0) { - if (DEBUG || debug) { - new Error ().printStackTrace (); +private static extern(C) void logFunction (char* log_domain, GLogLevelFlags log_level, char* message, void* user_data) { + Device dev = cast(Device)user_data; + if (dev.warningLevel == 0) { + if (DEBUG || dev.debugging) { + foreach( msg; new TracedException ("") ){ + Stderr.formatln( "trc {}", msg ); + } } - OS.g_log_default_handler (log_domain, (int)/*64*/log_level, message, 0); + OS.g_log_default_handler (log_domain, log_level, message, user_data); } return 0; } void new_Object (Object object) { for (int i=0; i 0) { OS.gdk_colormap_free_colors(colormap, color, 1); --colorRefCount [i]; @@ -800,21 +789,20 @@ COLOR_DARK_MAGENTA = COLOR_DARK_CYAN = COLOR_GRAY = COLOR_DARK_GRAY = COLOR_RED = COLOR_GREEN = COLOR_YELLOW = COLOR_BLUE = COLOR_MAGENTA = COLOR_CYAN = COLOR_WHITE = null; - if (emptyTab != 0) OS.pango_tab_array_free(emptyTab); - emptyTab = 0; + if (emptyTab !is null ) OS.pango_tab_array_free(emptyTab); + emptyTab = null; /* Free the GTK error and warning handler */ - if (xDisplay != 0) { + if (xDisplay !is null) { for (int i=0; iERROR_DEVICE_DISPOSED - if the receiver has been disposed * */ -public void setWarnings (boolean warnings) { +public void setWarnings (bool warnings) { checkDevice (); if (warnings) { if (--warningLevel == 0) { - if (debug) return; - if (logProc != 0) { - for (int i=0; iDrawable can have a graphics context (GC) @@ -46,7 +46,7 @@ * @return the platform specific GC handle */ -public int /*long*/ internal_new_GC (GCData data); +public GdkGC* internal_new_GC (GCData data); /** * Invokes platform specific functionality to dispose a GC handle. @@ -61,6 +61,6 @@ * @param handle the platform specific GC handle * @param data the platform specific GC data */ -public void internal_dispose_GC (int /*long*/ handle, GCData data); +public void internal_dispose_GC (GdkGC* handle, GCData data); } diff -r 92223a4ecca7 -r b73b14942338 dwt/graphics/GC.d --- a/dwt/graphics/GC.d Mon Jan 07 03:41:50 2008 +0100 +++ b/dwt/graphics/GC.d Mon Jan 07 07:47:32 2008 +0100 @@ -14,12 +14,32 @@ class GC{ void drawImage(Image, int, int, int, int, int, int, int, int ){} + void dispose(){} } -/++++ -import dwt.internal.cairo.*; -import dwt.internal.gtk.*; -import dwt.internal.*; -import dwt.*; +/+++ + +import dwt.internal.cairo.Cairo; +import dwt.internal.gtk.OS; +import dwt.internal.gtk.c.gdktypes; +import dwt.internal.Converter; +import dwt.internal.Compatibility; +import dwt.SWT; +import dwt.graphics.Drawable; +import dwt.graphics.Resource; +import dwt.graphics.Device; +import dwt.graphics.Font; +import dwt.graphics.FontMetrics; +import dwt.graphics.GCData; +import dwt.graphics.Image; +import dwt.graphics.ImageData; +import dwt.graphics.Path; +import dwt.graphics.Pattern; +import dwt.graphics.Point; +import dwt.graphics.RGB; +import dwt.graphics.Rectangle; +import dwt.graphics.Region; +import dwt.graphics.Resource; +import dwt.graphics.Transform; /** * Class GC is where all of the drawing capabilities that are @@ -50,7 +70,7 @@ * * @see dwt.events.PaintEvent */ -public final class GC extends Resource { +public final class GC : Resource { /** * the handle to the OS device context * (Warning: This field is platform dependent) @@ -61,34 +81,34 @@ * platforms and should never be accessed from application code. *

*/ - public int /*long*/ handle; + public GdkGC* handle; Drawable drawable; GCData data; - final static int FOREGROUND = 1 << 0; - final static int BACKGROUND = 1 << 1; - final static int FONT = 1 << 2; - final static int LINE_STYLE = 1 << 3; - final static int LINE_CAP = 1 << 4; - final static int LINE_JOIN = 1 << 5; - final static int LINE_WIDTH = 1 << 6; - final static int LINE_MITERLIMIT = 1 << 7; - final static int BACKGROUND_BG = 1 << 8; - final static int DRAW_OFFSET = 1 << 9; - final static int DRAW = FOREGROUND | LINE_WIDTH | LINE_STYLE | LINE_CAP | LINE_JOIN | LINE_MITERLIMIT | DRAW_OFFSET; - final static int FILL = BACKGROUND; + const static int FOREGROUND = 1 << 0; + const static int BACKGROUND = 1 << 1; + const static int FONT = 1 << 2; + const static int LINE_STYLE = 1 << 3; + const static int LINE_CAP = 1 << 4; + const static int LINE_JOIN = 1 << 5; + const static int LINE_WIDTH = 1 << 6; + const static int LINE_MITERLIMIT = 1 << 7; + const static int BACKGROUND_BG = 1 << 8; + const static int DRAW_OFFSET = 1 << 9; + const static int DRAW = FOREGROUND | LINE_WIDTH | LINE_STYLE | LINE_CAP | LINE_JOIN | LINE_MITERLIMIT | DRAW_OFFSET; + const static int FILL = BACKGROUND; - static final float[] LINE_DOT = new float[]{1, 1}; - static final float[] LINE_DASH = new float[]{3, 1}; - static final float[] LINE_DASHDOT = new float[]{3, 1, 1, 1}; - static final float[] LINE_DASHDOTDOT = new float[]{3, 1, 1, 1, 1, 1}; - static final float[] LINE_DOT_ZERO = new float[]{3, 3}; - static final float[] LINE_DASH_ZERO = new float[]{18, 6}; - static final float[] LINE_DASHDOT_ZERO = new float[]{9, 6, 3, 6}; - static final float[] LINE_DASHDOTDOT_ZERO = new float[]{9, 3, 3, 3, 3, 3}; + static const float[] LINE_DOT = [1, 1]; + static const float[] LINE_DASH = [3, 1]; + static const float[] LINE_DASHDOT = [3, 1, 1, 1]; + static const float[] LINE_DASHDOTDOT = [3, 1, 1, 1, 1, 1]; + static const float[] LINE_DOT_ZERO = [3, 3]; + static const float[] LINE_DASH_ZERO = [18, 6]; + static const float[] LINE_DASHDOT_ZERO = [9, 6, 3, 6]; + static const float[] LINE_DASHDOTDOT_ZERO = [9, 3, 3, 3, 3, 3]; -GC() { +this() { } /** @@ -113,7 +133,7 @@ *
  • ERROR_THREAD_INVALID_ACCESS if not called from the thread that created the drawable
  • * */ -public GC(Drawable drawable) { +public this(Drawable drawable) { this(drawable, 0); } @@ -144,7 +164,7 @@ * * @since 2.1.2 */ -public GC(Drawable drawable, int style) { +public this(Drawable drawable, int style) { if (drawable == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); GCData data = new GCData(); data.style = checkStyle(style); @@ -3919,4 +3939,4 @@ } } -++++/ \ No newline at end of file ++++/ \ No newline at end of file diff -r 92223a4ecca7 -r b73b14942338 dwt/graphics/GCData.d --- a/dwt/graphics/GCData.d Mon Jan 07 03:41:50 2008 +0100 +++ b/dwt/graphics/GCData.d Mon Jan 07 07:47:32 2008 +0100 @@ -31,7 +31,7 @@ public int style, state = -1; public GdkColor* foreground; public GdkColor* background; - public int /*long*/ font; + public PangoFontDescription* font; public Pattern foregroundPattern; public Pattern backgroundPattern; public int /*long*/ clipRgn; @@ -50,7 +50,7 @@ public int /*long*/ layout; public int /*long*/ damageRgn; public Image image; - public int /*long*/ drawable; + public GdkDrawable* drawable; public int /*long*/ cairo; public double cairoXoffset, cairoYoffset; public bool disposeCairo; diff -r 92223a4ecca7 -r b73b14942338 dwt/graphics/Image.d --- a/dwt/graphics/Image.d Mon Jan 07 03:41:50 2008 +0100 +++ b/dwt/graphics/Image.d Mon Jan 07 07:47:32 2008 +0100 @@ -11,6 +11,7 @@ module dwt.graphics.Image; import dwt.internal.Converter; +import dwt.internal.cairo.Cairo; import dwt.internal.gtk.OS; import dwt.internal.gtk.c.cairotypes; import dwt.internal.gtk.c.gdktypes; @@ -27,12 +28,14 @@ import dwt.graphics.Rectangle; import dwt.graphics.Resource; +//version=STUB; +version(STUB){ class Image{ public this(Device,ImageData){} public void dispose(){} } +} else { -/+ import dwt.dwthelper.InputStream; import tango.text.convert.Format; @@ -747,13 +750,14 @@ } surfaceData = cast(cairo_surface_t*) OS.g_malloc(stride * height); memmove(surfaceData, pixels, stride * height); - surface = Cairo.cairo_image_surface_create_for_data(surfaceData, Cairo.CAIRO_FORMAT_ARGB32, width, height, stride); + surface = Cairo.cairo_image_surface_create_for_data(cast(ubyte*)surfaceData, cast(cairo_format_t)Cairo.CAIRO_FORMAT_ARGB32, width, height, stride); OS.g_object_unref(pixbuf); } else { auto xDisplay = OS.GDK_DISPLAY(); auto xDrawable = OS.GDK_PIXMAP_XID(pixmap); auto xVisual = OS.gdk_x11_visual_get_xvisual(OS.gdk_visual_get_system()); - surface = Cairo.cairo_xlib_surface_create(xDisplay, xDrawable, xVisual, width, height); + // PORTING_FIXME cast and types not good + surface = Cairo.cairo_xlib_surface_create(cast(dwt.internal.gtk.c.cairotypes.Display*)xDisplay, xDrawable, xVisual, width, height); } /* Destroy the image mask if the there is a GC created on the image */ if (transparentPixel != -1 && memGC != null) destroyMask(); @@ -763,9 +767,9 @@ * Destroy the receiver's mask if it exists. */ void destroyMask() { - if (mask == 0) return; + if (mask is null) return; OS.g_object_unref(mask); - mask = 0; + mask = null; } /** @@ -774,14 +778,17 @@ * they allocate. */ public void dispose () { - if (pixmap == 0) return; + if (pixmap is null) return; if (device.isDisposed()) return; if (memGC != null) memGC.dispose(); - if (pixmap != 0) OS.g_object_unref(pixmap); - if (mask != 0) OS.g_object_unref(mask); - if (surface != 0) Cairo.cairo_surface_destroy(surface); - if (surfaceData != 0) OS.g_free(surfaceData); - surfaceData = surface = pixmap = mask = 0; + if (pixmap !is null) OS.g_object_unref(pixmap); + if (mask !is null) OS.g_object_unref(mask); + if (surface !is null) Cairo.cairo_surface_destroy(surface); + if (surfaceData !is null) OS.g_free(surfaceData); + surfaceData = null; + surface = null; + pixmap = null; + mask = null; memGC = null; if (device.tracking) device.dispose_Object(this); device = null; @@ -847,9 +854,9 @@ if (width != -1 && height != -1) { return new Rectangle(0, 0, width, height); } - int[] w = new int[1]; int[] h = new int[1]; - OS.gdk_drawable_get_size(pixmap, w, h); - return new Rectangle(0, 0, width = w[0], height = h[0]); + int w; int h; + OS.gdk_drawable_get_size(pixmap, &w, &h); + return new Rectangle(0, 0, width = w, height = h); } /** @@ -869,17 +876,17 @@ public ImageData getImageData() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - int[] w = new int[1], h = new int[1]; - OS.gdk_drawable_get_size(pixmap, w, h); - int width = w[0], height = h[0]; - int /*long*/ pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, width, height); - if (pixbuf == 0) SWT.error(SWT.ERROR_NO_HANDLES); - int /*long*/ colormap = OS.gdk_colormap_get_system(); + int w, h; + OS.gdk_drawable_get_size(pixmap, &w, &h); + int width = w, height = h; + auto pixbuf = OS.gdk_pixbuf_new(cast(GdkColorspace)OS.GDK_COLORSPACE_RGB, false, 8, width, height); + if (pixbuf is null) SWT.error(SWT.ERROR_NO_HANDLES); + auto colormap = OS.gdk_colormap_get_system(); OS.gdk_pixbuf_get_from_drawable(pixbuf, pixmap, colormap, 0, 0, 0, 0, width, height); int stride = OS.gdk_pixbuf_get_rowstride(pixbuf); - int /*long*/ pixels = OS.gdk_pixbuf_get_pixels(pixbuf); + auto pixels = OS.gdk_pixbuf_get_pixels(pixbuf); byte[] srcData = new byte[stride * height]; - OS.memmove(srcData, pixels, srcData.length); + memmove(srcData.ptr, pixels, srcData.length); OS.g_object_unref(pixbuf); PaletteData palette = new PaletteData(0xFF0000, 0xFF00, 0xFF); @@ -887,14 +894,14 @@ data.data = srcData; data.bytesPerLine = stride; - if (transparentPixel == -1 && type == SWT.ICON && mask != 0) { + if (transparentPixel == -1 && type == SWT.ICON && mask !is null) { /* Get the icon mask data */ - int /*long*/ gdkImagePtr = OS.gdk_drawable_get_image(mask, 0, 0, width, height); - if (gdkImagePtr == 0) SWT.error(SWT.ERROR_NO_HANDLES); - GdkImage gdkImage = new GdkImage(); - OS.memmove(gdkImage, gdkImagePtr); + auto gdkImagePtr = OS.gdk_drawable_get_image(mask, 0, 0, width, height); + if (gdkImagePtr is null) SWT.error(SWT.ERROR_NO_HANDLES); + GdkImage* gdkImage = new GdkImage(); + memmove(gdkImage, gdkImagePtr, GdkImage.sizeof ); byte[] maskData = new byte[gdkImage.bpl * gdkImage.height]; - OS.memmove(maskData, gdkImage.mem, maskData.length); + memmove(maskData.ptr, gdkImage.mem, maskData.length); OS.g_object_unref(gdkImagePtr); int maskPad; for (maskPad = 1; maskPad < 128; maskPad++) { @@ -918,8 +925,7 @@ data.transparentPixel = transparentPixel; data.alpha = alpha; if (alpha == -1 && alphaData != null) { - data.alphaData = new byte[alphaData.length]; - System.arraycopy(alphaData, 0, data.alphaData, 0, alphaData.length); + data.alphaData = alphaData.dup; } return data; } @@ -945,8 +951,8 @@ if (device is null) device = Device.getDevice(); Image image = new Image(); image.type = type; - image.pixmap = pixmap; - image.mask = mask; + image.pixmap = cast(GdkDrawable*)pixmap; + image.mask = cast(GdkDrawable*)mask; image.device = device; return image; } @@ -973,13 +979,13 @@ this.type = SWT.BITMAP; /* Create the pixmap */ - this.pixmap = OS.gdk_pixmap_new(OS.GDK_ROOT_PARENT(), width, height, -1); - if (pixmap == 0) SWT.error(SWT.ERROR_NO_HANDLES); + this.pixmap = cast(GdkDrawable*) OS.gdk_pixmap_new(cast(GdkDrawable*)OS.GDK_ROOT_PARENT(), width, height, -1); + if (pixmap is null) SWT.error(SWT.ERROR_NO_HANDLES); /* Fill the bitmap with white */ - GdkColor white = new GdkColor(); - white.red = cast(short)0xFFFF; - white.green = cast(short)0xFFFF; - white.blue = cast(short)0xFFFF; + GdkColor* white = new GdkColor(); + white.red = 0xFFFF; + white.green = 0xFFFF; + white.blue = 0xFFFF; auto colormap = OS.gdk_colormap_get_system(); OS.gdk_colormap_alloc_color(colormap, white, true, true); auto gdkGC = OS.gdk_gc_new(pixmap); @@ -998,8 +1004,8 @@ if (!(((image.depth == 1 || image.depth == 2 || image.depth == 4 || image.depth == 8) && !palette.isDirect) || ((image.depth == 8) || (image.depth == 16 || image.depth == 24 || image.depth == 32) && palette.isDirect))) SWT.error (SWT.ERROR_UNSUPPORTED_DEPTH); - auto pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, width, height); - if (pixbuf == 0) SWT.error(SWT.ERROR_NO_HANDLES); + auto pixbuf = OS.gdk_pixbuf_new(cast(GdkColorspace) OS.GDK_COLORSPACE_RGB, false, 8, width, height); + if (pixbuf is null) SWT.error(SWT.ERROR_NO_HANDLES); int stride = OS.gdk_pixbuf_get_rowstride(pixbuf); auto data = OS.gdk_pixbuf_get_pixels(pixbuf); byte[] buffer = image.data; @@ -1031,12 +1037,12 @@ false, false); } } - OS.memmove(data, buffer, stride * height); - auto pixmap = OS.gdk_pixmap_new (OS.GDK_ROOT_PARENT(), width, height, -1); - if (pixmap == 0) SWT.error(SWT.ERROR_NO_HANDLES); + memmove(data, buffer.ptr, stride * height); + auto pixmap = cast(GdkDrawable*) OS.gdk_pixmap_new (cast(GdkDrawable*) OS.GDK_ROOT_PARENT(), width, height, -1); + if (pixmap is null) SWT.error(SWT.ERROR_NO_HANDLES); auto gdkGC = OS.gdk_gc_new(pixmap); - if (gdkGC == 0) SWT.error(SWT.ERROR_NO_HANDLES); - OS.gdk_pixbuf_render_to_drawable(pixbuf, pixmap, gdkGC, 0, 0, 0, 0, width, height, OS.GDK_RGB_DITHER_NORMAL, 0, 0); + if (gdkGC is null) SWT.error(SWT.ERROR_NO_HANDLES); + OS.gdk_pixbuf_render_to_drawable(pixbuf, pixmap, gdkGC, 0, 0, 0, 0, width, height, cast(GdkRgbDither)OS.GDK_RGB_DITHER_NORMAL, 0, 0); OS.g_object_unref(gdkGC); OS.g_object_unref(pixbuf); @@ -1055,8 +1061,8 @@ transparentPixel = rgb.red << 16 | rgb.green << 8 | rgb.blue; } } - int /*long*/ mask = createMask(image, isIcon); - if (mask == 0) SWT.error(SWT.ERROR_NO_HANDLES); + auto mask = createMask(image, isIcon); + if (mask is null) SWT.error(SWT.ERROR_NO_HANDLES); this.mask = mask; if (isIcon) { this.type = SWT.ICON; @@ -1065,11 +1071,10 @@ } } else { this.type = SWT.BITMAP; - this.mask = 0; + this.mask = null; this.alpha = image.alpha; if (image.alpha == -1 && image.alphaData != null) { - this.alphaData = new byte[image.alphaData.length]; - System.arraycopy(image.alphaData, 0, this.alphaData, 0, alphaData.length); + this.alphaData = image.alphaData.dup; } createAlphaMask(width, height); } @@ -1089,13 +1094,13 @@ * @param data the platform specific GC data * @return the platform specific GC handle */ -public int /*long*/ internal_new_GC (GCData data) { - if (pixmap == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (type != SWT.BITMAP || memGC != null) { +public GdkGC* internal_new_GC (GCData data) { + if (pixmap is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (type != SWT.BITMAP || memGC !is null) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } auto gdkGC = OS.gdk_gc_new(pixmap); - if (data != null) { + if (data !is null) { int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; if ((data.style & mask) == 0) { data.style |= SWT.LEFT_TO_RIGHT; @@ -1123,7 +1128,7 @@ * @param hDC the platform specific GC handle * @param data the platform specific GC data */ -public void internal_dispose_GC (int /*long*/ gdkGC, GCData data) { +public void internal_dispose_GC ( GdkGC* gdkGC, GCData data) { OS.g_object_unref(gdkGC); } @@ -1138,7 +1143,7 @@ * @return true when the image is disposed and false otherwise */ public bool isDisposed() { - return pixmap == 0; + return pixmap is null; } /** @@ -1195,4 +1200,4 @@ } } -+/ \ No newline at end of file +} \ No newline at end of file diff -r 92223a4ecca7 -r b73b14942338 dwt/internal/gtk/OS.d --- a/dwt/internal/gtk/OS.d Mon Jan 07 03:41:50 2008 +0100 +++ b/dwt/internal/gtk/OS.d Mon Jan 07 07:47:32 2008 +0100 @@ -32,6 +32,36 @@ private extern(C) GdkPixbuf* gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height); +private extern(C) PangoContext *gdk_pango_context_get(); +private extern(C) int XRenderQueryExtension (Display *dpy, int *event_basep, int *error_basep); +alias int Status; +private extern(C) Status XRenderQueryVersion (Display *dpy, + int *major_versionp, + int *minor_versionp); +struct FcConfig{}; +private extern(C) int FcConfigAppFontAddFile (FcConfig *config, char *file); + +alias extern(C) int function( dwt.internal.gtk.c.cairotypes.Display* ) XSynchronizeResult; +private extern(C) XSynchronizeResult function( dwt.internal.gtk.c.cairotypes.Display*, int ) XSynchronize; + +//struct Visual{} +//private extern(C) Visual* gdk_x11_visual_get_xvisual(GdkVisual* visual); + +GdkDisplay* GDK_DISPLAY(){ + return gtk_display; +} + +XID GDK_PIXMAP_XID(GdkDrawable* win){ + return gdk_x11_drawable_get_xid(win); +} + +struct XErrorEvent {} +public alias extern(C) int function(dwt.internal.gtk.c.cairotypes.Display*) XIOErrorHandler; +public alias extern(C) int function(dwt.internal.gtk.c.cairotypes.Display*, XErrorEvent *) XErrorHandler; + +extern (C) XIOErrorHandler XSetIOErrorHandler(XIOErrorHandler); +extern (C) XErrorHandler XSetErrorHandler(XErrorHandler); + template NameOfFunc(alias f) { // Note: highly dependent on the .stringof formatting @@ -674,7 +704,9 @@ // mixin ForwardGtkOsCFunc!(.Call); // mixin ForwardGtkOsCFunc!(.call ); mixin ForwardGtkOsCFunc!(GDK_WINDOWING_X11); +++/ mixin ForwardGtkOsCFunc!(.GDK_PIXMAP_XID); +/++ mixin ForwardGtkOsCFunc!(.XCheckMaskEvent); mixin ForwardGtkOsCFunc!(.XCheckWindowEvent); mixin ForwardGtkOsCFunc!(.XCheckIfEvent); @@ -689,10 +721,12 @@ mixin ForwardGtkOsCFunc!(.XListProperties); mixin ForwardGtkOsCFunc!(.XReconfigureWMWindow); mixin ForwardGtkOsCFunc!(.XSendEvent); + +/ mixin ForwardGtkOsCFunc!(.XSetIOErrorHandler); mixin ForwardGtkOsCFunc!(.XSetErrorHandler); - mixin ForwardGtkOsCFunc!(.XSetInputFocus); + //mixin ForwardGtkOsCFunc!(.XSetInputFocus); mixin ForwardGtkOsCFunc!(.XSynchronize); + /+ mixin ForwardGtkOsCFunc!(.XTestFakeButtonEvent); mixin ForwardGtkOsCFunc!(.XTestFakeKeyEvent); mixin ForwardGtkOsCFunc!(.XTestFakeMotionEvent); @@ -704,7 +738,9 @@ mixin ForwardGtkOsCFunc!(.gdk_x11_drawable_get_xid); mixin ForwardGtkOsCFunc!(.gdk_x11_screen_lookup_visual); mixin ForwardGtkOsCFunc!(.gdk_x11_screen_get_window_manager_name); + +/ mixin ForwardGtkOsCFunc!(.gdk_x11_visual_get_xvisual); + /+ mixin ForwardGtkOsCFunc!(.gdk_pixmap_foreign_new); mixin ForwardGtkOsCFunc!(.gdk_window_lookup); mixin ForwardGtkOsCFunc!(.gdk_window_add_filter); @@ -712,8 +748,10 @@ /** X render natives and constants */ // mixin ForwardGtkOsCFunc!(XRenderPictureAttributes_sizeof); + +/ mixin ForwardGtkOsCFunc!(.XRenderQueryExtension); mixin ForwardGtkOsCFunc!(.XRenderQueryVersion); + /+ mixin ForwardGtkOsCFunc!(.XRenderCreatePicture); mixin ForwardGtkOsCFunc!(.XRenderSetPictureClipRectangles); mixin ForwardGtkOsCFunc!(.XRenderSetPictureTransform); @@ -722,8 +760,8 @@ mixin ForwardGtkOsCFunc!(.XRenderFindStandardFormat); mixin ForwardGtkOsCFunc!(.XRenderFindVisualFormat); // mixin ForwardGtkOsCFunc!(Call ); + +/ mixin ForwardGtkOsCFunc!(.GDK_DISPLAY); - +/ mixin ForwardGtkOsCFunc!(.GDK_ROOT_PARENT); /+ mixin ForwardGtkOsCFunc!(.GDK_TYPE_COLOR); @@ -926,7 +964,7 @@ mixin ForwardGtkOsCFunc!(.gdk_keymap_translate_keyboard_state ); mixin ForwardGtkOsCFunc!(.gdk_keyval_to_lower); mixin ForwardGtkOsCFunc!(.gdk_keyval_to_unicode); -// mixin ForwardGtkOsCFunc!(.gdk_pango_context_get); + mixin ForwardGtkOsCFunc!(.gdk_pango_context_get); // mixin ForwardGtkOsCFunc!(.gdk_pango_context_set_colormap); // mixin ForwardGtkOsCFunc!(.gdk_pango_layout_get_clip_region); mixin ForwardGtkOsCFunc!(.gdk_pixbuf_copy_area); @@ -1112,7 +1150,7 @@ mixin ForwardGtkOsCFunc!(.gtk_entry_text_index_to_layout_index ); mixin ForwardGtkOsCFunc!(.gtk_entry_get_max_length); mixin ForwardGtkOsCFunc!(.gtk_entry_get_text); - //mixin ForwardGtkOsCFunc!(.FcConfigAppFontAddFile); + mixin ForwardGtkOsCFunc!(.FcConfigAppFontAddFile); mixin ForwardGtkOsCFunc!(.gtk_entry_get_visibility); mixin ForwardGtkOsCFunc!(.gtk_entry_new); mixin ForwardGtkOsCFunc!(.gtk_entry_set_activates_default); diff -r 92223a4ecca7 -r b73b14942338 dwt/internal/gtk/c/cairotypes.d --- a/dwt/internal/gtk/c/cairotypes.d Mon Jan 07 03:41:50 2008 +0100 +++ b/dwt/internal/gtk/c/cairotypes.d Mon Jan 07 07:47:32 2008 +0100 @@ -6,7 +6,7 @@ it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + gtkD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -28,8 +28,8 @@ private alias void* HDC; -//struct Display; // to support XLib surfaces -//struct Visual; // to support XLib surfaces +struct Display{}; // to support XLib surfaces +struct Visual; // to support XLib surfaces //struct Screen; // to support XLib surfaces //private alias void* Drawable; diff -r 92223a4ecca7 -r b73b14942338 dwt/internal/gtk/c/gdk.d --- a/dwt/internal/gtk/c/gdk.d Mon Jan 07 03:41:50 2008 +0100 +++ b/dwt/internal/gtk/c/gdk.d Mon Jan 07 07:47:32 2008 +0100 @@ -6,7 +6,7 @@ it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + gtkD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -36,7 +36,7 @@ static this() { - gdkLinker = new Linker( getLibraryPath ~ importLibs[LIBRARY.GDK], + gdkLinker = new Linker( getLibraryPath ~ importLibs[LIBRARY.GDK], getLibraryPath ~ importLibs[LIBRARY.GDKPIXBUF] ); gdkLinker.link( gdkLinks ); } @@ -54,10 +54,10 @@ ******************************************************************************/ -extern(C) -{ +extern(C) +{ // gdk.Gdk - + void function(gint* argc, gchar*** argv)gdk_init; gboolean function(gint* argc, gchar*** argv)gdk_init_check; void function(gint* argc, gchar*** argv)gdk_parse_args; @@ -86,9 +86,9 @@ void function(gboolean useXshm)gdk_set_use_xshm; void function()gdk_error_trap_push; gint function()gdk_error_trap_pop; - + // gdk.Display - + GdkDisplay* function(gchar* displayName)gdk_display_open; GdkDisplay* function()gdk_display_get_default; gchar* function(GdkDisplay* display)gdk_display_get_name; @@ -125,17 +125,17 @@ gboolean function(GdkDisplay* display)gdk_display_supports_shapes; gboolean function(GdkDisplay* display)gdk_display_supports_input_shapes; gboolean function(GdkDisplay* display)gdk_display_supports_composite; - + // gdk.DisplayManager - + GdkDisplayManager* function()gdk_display_manager_get; GdkDisplay* function(GdkDisplayManager* displayManager)gdk_display_manager_get_default_display; void function(GdkDisplayManager* displayManager, GdkDisplay* display)gdk_display_manager_set_default_display; GSList* function(GdkDisplayManager* displayManager)gdk_display_manager_list_displays; GdkDevice* function(GdkDisplay* display)gdk_display_get_core_pointer; - + // gdk.Screen - + GdkScreen* function()gdk_screen_get_default; GdkColormap* function(GdkScreen* screen)gdk_screen_get_default_colormap; void function(GdkScreen* screen, GdkColormap* colormap)gdk_screen_set_default_colormap; @@ -171,14 +171,14 @@ gboolean function(GdkScreen* screen, gchar* workingDirectory, gchar** argv, gchar** envp, GSpawnFlags flags, GSpawnChildSetupFunc childSetup, gpointer userData, gint* childPid, GError** error)gdk_spawn_on_screen; gboolean function(GdkScreen* screen, gchar* workingDirectory, gchar** argv, gchar** envp, GSpawnFlags flags, GSpawnChildSetupFunc childSetup, gpointer userData, gint* childPid, gint* standardInput, gint* standardOutput, gint* standardError, GError** error)gdk_spawn_on_screen_with_pipes; gboolean function(GdkScreen* screen, gchar* commandLine, GError** error)gdk_spawn_command_line_on_screen; - + // gdk.Rectangle - + gboolean function(GdkRectangle* src1, GdkRectangle* src2, GdkRectangle* dest)gdk_rectangle_intersect; void function(GdkRectangle* src1, GdkRectangle* src2, GdkRectangle* dest)gdk_rectangle_union; - + // gdk.Region - + GdkRegion* function()gdk_region_new; GdkRegion* function(GdkPoint* points, gint npoints, GdkFillRule fillRule)gdk_region_polygon; GdkRegion* function(GdkRegion* region)gdk_region_copy; @@ -198,9 +198,9 @@ void function(GdkRegion* source1, GdkRegion* source2)gdk_region_subtract; void function(GdkRegion* source1, GdkRegion* source2)gdk_region_xor; void function(GdkRegion* region, GdkSpan* spans, int nSpans, gboolean sorted, GdkSpanFunc funct, gpointer data)gdk_region_spans_intersect_foreach; - + // gdk.GC - + GdkGC* function(GdkDrawable* drawable)gdk_gc_new; GdkGC* function(GdkDrawable* drawable, GdkGCValues* values, GdkGCValuesMask valuesMask)gdk_gc_new_with_values; GdkScreen* function(GdkGC* gc)gdk_gc_get_screen; @@ -230,9 +230,9 @@ void function(GdkGC* gc, GdkColormap* colormap)gdk_gc_set_colormap; GdkColormap* function(GdkGC* gc)gdk_gc_get_colormap; void function(GdkGC* gc, gint xOffset, gint yOffset)gdk_gc_offset; - + // gdk.Drawable - + GdkDrawable* function(GdkDrawable* drawable)gdk_drawable_ref; void function(GdkDrawable* drawable)gdk_drawable_unref; void function(GdkDrawable* drawable, gchar* key, gpointer data, GDestroyNotify destroyFunc)gdk_drawable_set_data; @@ -269,22 +269,22 @@ void function(GdkDrawable* drawable, GdkGC* gc, GdkImage* image, gint xsrc, gint ysrc, gint xdest, gint ydest, gint width, gint height)gdk_draw_image; GdkImage* function(GdkDrawable* drawable, gint x, gint y, gint width, gint height)gdk_drawable_get_image; GdkImage* function(GdkDrawable* drawable, GdkImage* image, gint srcX, gint srcY, gint destX, gint destY, gint width, gint height)gdk_drawable_copy_to_image; - + // gdk.Pixmap - + GdkPixmap* function(GdkDrawable* drawable, gint width, gint height, gint depth)gdk_pixmap_new; GdkPixmap* function(GdkDrawable* drawable, gchar* data, gint width, gint height, gint depth, GdkColor* fg, GdkColor* bg)gdk_pixmap_create_from_data; GdkPixmap* function(GdkDrawable* drawable, GdkBitmap** mask, GdkColor* transparentColor, gchar* filename)gdk_pixmap_create_from_xpm; GdkPixmap* function(GdkDrawable* drawable, GdkColormap* colormap, GdkBitmap** mask, GdkColor* transparentColor, gchar* filename)gdk_pixmap_colormap_create_from_xpm; GdkPixmap* function(GdkDrawable* drawable, GdkBitmap** mask, GdkColor* transparentColor, gchar** data)gdk_pixmap_create_from_xpm_d; GdkPixmap* function(GdkDrawable* drawable, GdkColormap* colormap, GdkBitmap** mask, GdkColor* transparentColor, gchar** data)gdk_pixmap_colormap_create_from_xpm_d; - + // gdk.Bitmap - + GdkBitmap* function(GdkDrawable* drawable, gchar* data, gint width, gint height)gdk_bitmap_create_from_data; - + // gdk.RGB - + void function()gdk_rgb_init; void function(GdkDrawable* drawable, GdkGC* gc, gint x, gint y, gint width, gint height, GdkRgbDither dith, guchar* rgbBuf, gint rowstride)gdk_draw_rgb_image; void function(GdkDrawable* drawable, GdkGC* gc, gint x, gint y, gint width, gint height, GdkRgbDither dith, guchar* rgbBuf, gint rowstride, gint xdith, gint ydith)gdk_draw_rgb_image_dithalign; @@ -305,9 +305,9 @@ gboolean function()gdk_rgb_ditherable; gboolean function(GdkColormap* cmap)gdk_rgb_colormap_ditherable; void function(gboolean verbose)gdk_rgb_set_verbose; - + // gdk.ImageGdk - + GdkImage* function(GdkImageType type, GdkVisual* visual, gint width, gint height)gdk_image_new; GdkImage* function(GdkVisual* visual, gpointer data, gint width, gint height)gdk_image_new_bitmap; GdkImage* function(GdkDrawable* drawable, gint x, gint y, gint width, gint height)gdk_image_get; @@ -317,9 +317,9 @@ void function(GdkImage* image, GdkColormap* colormap)gdk_image_set_colormap; void function(GdkImage* image, gint x, gint y, guint32 pixel)gdk_image_put_pixel; guint32 function(GdkImage* image, gint x, gint y)gdk_image_get_pixel; - + // gdk.Pixbuf - + void function(GdkPixbuf* pixbuf, GdkBitmap* bitmap, int srcX, int srcY, int destX, int destY, int width, int height, int alphaThreshold)gdk_pixbuf_render_threshold_alpha; void function(GdkPixbuf* pixbuf, GdkDrawable* drawable, GdkGC* gc, int srcX, int srcY, int destX, int destY, int width, int height, GdkRgbDither dither, int xDither, int yDither)gdk_pixbuf_render_to_drawable; void function(GdkPixbuf* pixbuf, GdkDrawable* drawable, int srcX, int srcY, int destX, int destY, int width, int height, GdkPixbufAlphaMode alphaMode, int alphaThreshold, GdkRgbDither dither, int xDither, int yDither)gdk_pixbuf_render_to_drawable_alpha; @@ -363,9 +363,9 @@ void function(GdkPixbuf* src, GdkPixbuf* dest, gfloat saturation, gboolean pixelate)gdk_pixbuf_saturate_and_pixelate; GdkPixbuf* function(GdkPixbuf* src)gdk_pixbuf_apply_embedded_orientation; void function(GdkPixbuf* pixbuf, guint32 pixel)gdk_pixbuf_fill; - + // gdk.Colormap - + GdkColormap* function(GdkVisual* visual, gboolean allocate)gdk_colormap_new; GdkColormap* function(GdkColormap* cmap)gdk_colormap_ref; void function(GdkColormap* cmap)gdk_colormap_unref; @@ -381,9 +381,9 @@ void function(GdkColormap* colormap, GdkColor* colors, gint ncolors)gdk_colors_store; gint function(GdkColormap* colormap, gboolean contiguous, gulong* planes, gint nplanes, gulong* pixels, gint npixels)gdk_colors_alloc; void function(GdkColormap* colormap, gulong* pixels, gint npixels, gulong planes)gdk_colors_free; - + // gdk.Color - + GdkColor* function(GdkColor* color)gdk_color_copy; void function(GdkColor* color)gdk_color_free; gint function(GdkColormap* colormap, GdkColor* color)gdk_color_white; @@ -394,9 +394,9 @@ gboolean function(GdkColor* colora, GdkColor* colorb)gdk_color_equal; guint function(GdkColor* colora)gdk_color_hash; gchar* function(GdkColor* color)gdk_color_to_string; - + // gdk.Visual - + void function(gint** depths, gint* count)gdk_query_depths; void function(GdkVisualType** visualTypes, gint* count)gdk_query_visual_types; GList* function()gdk_list_visuals; @@ -408,9 +408,9 @@ GdkVisual* function(GdkVisualType visualType)gdk_visual_get_best_with_type; GdkVisual* function(gint depth, GdkVisualType visualType)gdk_visual_get_best_with_both; GdkScreen* function(GdkVisual* visual)gdk_visual_get_screen; - + // gdk.Font - + GdkFont* function(gchar* fontName)gdk_font_load; GdkFont* function(GdkDisplay* display, gchar* fontName)gdk_font_load_for_display; GdkFont* function(gchar* fontsetName)gdk_fontset_load; @@ -438,9 +438,9 @@ gint function(GdkFont* font, gchar character)gdk_char_height; gchar* function(GdkWChar* src)gdk_wcstombs; gint function(GdkWChar* dest, gchar* src, gint destMax)gdk_mbstowcs; - + // gdk.Cursor - + GdkCursor* function(GdkCursorType cursorType)gdk_cursor_new; GdkCursor* function(GdkPixmap* source, GdkPixmap* mask, GdkColor* fg, GdkColor* bg, gint x, gint y)gdk_cursor_new_from_pixmap; GdkCursor* function(GdkDisplay* display, GdkPixbuf* pixbuf, gint x, gint y)gdk_cursor_new_from_pixbuf; @@ -450,9 +450,9 @@ GdkPixbuf* function(GdkCursor* cursor)gdk_cursor_get_image; GdkCursor* function(GdkCursor* cursor)gdk_cursor_ref; void function(GdkCursor* cursor)gdk_cursor_unref; - + // gdk.Window - + GdkWindow* function(GdkWindow* parent, GdkWindowAttr* attributes, gint attributesMask)gdk_window_new; void function(GdkWindow* window)gdk_window_destroy; GdkWindowType function(GdkWindow* window)gdk_window_get_window_type; @@ -562,9 +562,9 @@ GList* function()gdk_window_get_toplevels; GdkWindow* function()gdk_get_default_root_window; GdkPointerHooks* function(GdkPointerHooks* newHooks)gdk_set_pointer_hooks; - + // gdk.Event - + gboolean function()gdk_events_pending; GdkEvent* function()gdk_event_peek; GdkEvent* function()gdk_event_get; @@ -589,12 +589,12 @@ void function(GdkEvent* event, GdkScreen* screen)gdk_event_set_screen; GdkScreen* function(GdkEvent* event)gdk_event_get_screen; gboolean function(gchar* name, GValue* value)gdk_setting_get; - + // gdk. - - + + // gdk.Keymap - + GdkKeymap* function()gdk_keymap_get_default; GdkKeymap* function(GdkDisplay* display)gdk_keymap_get_for_display; guint function(GdkKeymap* keymap, GdkKeymapKey* key)gdk_keymap_lookup_key; @@ -612,9 +612,9 @@ gboolean function(guint keyval)gdk_keyval_is_lower; guint32 function(guint keyval)gdk_keyval_to_unicode; guint function(guint32 wc)gdk_unicode_to_keyval; - + // gdk.Selection - + gboolean function(GdkWindow* owner, GdkAtom selection, guint32 time, gboolean sendEvent)gdk_selection_owner_set; gboolean function(GdkDisplay* display, GdkWindow* owner, GdkAtom selection, guint32 time, gboolean sendEvent)gdk_selection_owner_set_for_display; GdkWindow* function(GdkAtom selection)gdk_selection_owner_get; @@ -623,9 +623,9 @@ gboolean function(GdkWindow* requestor, guchar** data, GdkAtom* propType, gint* propFormat)gdk_selection_property_get; void function(guint32 requestor, GdkAtom selection, GdkAtom target, GdkAtom property, guint32 time)gdk_selection_send_notify; void function(GdkDisplay* display, guint32 requestor, GdkAtom selection, GdkAtom target, GdkAtom property, guint32 time)gdk_selection_send_notify_for_display; - + // gdk.DragContext - + GdkAtom function(GdkDragContext* context)gdk_drag_get_selection; void function(GdkDragContext* context, guint32 time)gdk_drag_abort; void function(GdkDragContext* context, gboolean ok, guint32 time)gdk_drop_reply; @@ -642,9 +642,9 @@ void function(GdkDragContext* context)gdk_drag_context_unref; void function(GdkDragContext* context, GdkDragAction action, guint32 time)gdk_drag_status; gboolean function(GdkDragContext* context)gdk_drag_drop_succeeded; - + // gdk. - + void function()gdk_threads_init; void function()gdk_threads_enter; void function()gdk_threads_leave; @@ -653,15 +653,15 @@ guint function(gint priority, GSourceFunc funct, gpointer data, GDestroyNotify notify)gdk_threads_add_idle_full; guint function(guint interval, GSourceFunc funct, gpointer data)gdk_threads_add_timeout; guint function(gint priority, guint interval, GSourceFunc funct, gpointer data, GDestroyNotify notify)gdk_threads_add_timeout_full; - + // gdk.Input - + gint function(gint source, GdkInputCondition condition, GdkInputFunction funct, gpointer data, GdkDestroyNotify destroy)gdk_input_add_full; gint function(gint source, GdkInputCondition condition, GdkInputFunction funct, gpointer data)gdk_input_add; void function(gint tag)gdk_input_remove; - + // gdk.Device - + GList* function()gdk_devices_list; void function(GdkDevice* device, GdkInputSource source)gdk_device_set_source; gboolean function(GdkDevice* device, GdkInputMode mode)gdk_device_set_mode; @@ -673,7 +673,7 @@ void function(GdkTimeCoord** events, gint nEvents)gdk_device_free_history; gboolean function(GdkDevice* device, gdouble* axes, GdkAxisUse use, gdouble* value)gdk_device_get_axis; void function(GdkWindow* window, gint mask, GdkExtensionMode mode)gdk_input_set_extension_events; - + // gdk.X11 /+ Manually disabled. Won't compile, yet. GdkVisual* function(VisualID xvisualid)gdkx_visual_get; @@ -728,7 +728,9 @@ int function(GdkScreen* screen)gdk_x11_screen_get_screen_number; Screen* function(GdkScreen* screen)gdk_x11_screen_get_xscreen; void function()gdk_x11_ungrab_server; + +/ Visual* function(GdkVisual* visual)gdk_x11_visual_get_xvisual; + /+ Atom function(GdkAtom atom)gdk_x11_atom_to_xatom; Atom function(GdkDisplay* display, GdkAtom atom)gdk_x11_atom_to_xatom_for_display; GdkAtom function(Atom xatom)gdk_x11_xatom_to_atom; @@ -738,9 +740,9 @@ gchar* function(Atom xatom)gdk_x11_get_xatom_name; gchar* function(GdkDisplay* display, Atom xatom)gdk_x11_get_xatom_name_for_display; +/ - + // gdk. - + cairo_t* function(GdkDrawable* drawable)gdk_cairo_create; void function(cairo_t* cr, GdkColor* color)gdk_cairo_set_source_color; void function(cairo_t* cr, GdkPixbuf* pixbuf, double pixbufX, double pixbufY)gdk_cairo_set_source_pixbuf; @@ -755,7 +757,7 @@ ******************************************************************************/ -Symbol[] gdkLinks = +Symbol[] gdkLinks = [ { "gdk_init", cast(void**)& gdk_init}, diff -r 92223a4ecca7 -r b73b14942338 dwt/internal/gtk/c/glibtypes.d --- a/dwt/internal/gtk/c/glibtypes.d Mon Jan 07 03:41:50 2008 +0100 +++ b/dwt/internal/gtk/c/glibtypes.d Mon Jan 07 07:47:32 2008 +0100 @@ -6,7 +6,7 @@ it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + gtkD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -3453,7 +3453,7 @@ * user data, set in g_log_set_handler(). */ // void (*GLogFunc) (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data); -public typedef extern(C) void function (char[], GLogLevelFlags, char[], void*) GLogFunc; +public typedef extern(C) void function (char*, GLogLevelFlags, char*, void*) GLogFunc; /* * Declares a type of function which takes no arguments and has no return value. diff -r 92223a4ecca7 -r b73b14942338 todo.txt --- a/todo.txt Mon Jan 07 03:41:50 2008 +0100 +++ b/todo.txt Mon Jan 07 07:47:32 2008 +0100 @@ -10,7 +10,7 @@ SWTError // OK SWTException // OK -internal/BidiUtil // OK (stub: GC, Runnable ) +internal/BidiUtil // OK (stub: Runnable ) internal/Callback // ?? hopefully not needed internal/CloneableCompatibility // OK (java.lang.Cloneable) internal/C // OK not needed @@ -26,19 +26,19 @@ graphics/Color // OK graphics/Cursor -graphics/Device deps: GCData, Font, +graphics/Device // OK graphics/DeviceData // OK (fld: debug->debugging) -graphics/Drawable // OK (stub GCData) +graphics/Drawable // OK graphics/Font // OK graphics/FontData // OK graphics/FontMetrics // OK graphics/GC graphics/GCData graphics/GlyphMetrics -graphics/Image +graphics/Image // OK graphics/ImageData // OK graphics/ImageDataLoader // OK -graphics/ImageLoader // OK (FileFormat) +graphics/ImageLoader // OK graphics/ImageLoaderEvent // OK graphics/ImageLoaderListener // OK graphics/LineAttributes // OK @@ -49,7 +49,7 @@ graphics/Point // OK graphics/Rectangle // OK (meth union->makeUnion) graphics/Region // OK -graphics/Resource // OK (stub: Display) +graphics/Resource // OK graphics/RGB // OK graphics/TextLayout graphics/TextStyle