From 955cdcf123dce5eae684679bb6a9b42befa0ffae Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Sun, 30 Jan 2011 22:49:15 -0600 Subject: [PATCH] Update Gdk to the 2.99 API * cairo/Surface.cs: expose LookupSurface * cairo/cairo-api.xml: add surface mapping * gdk/*: updates and hobbling to get gdk building. lots of work to come. --- cairo/Surface.cs | 2 +- cairo/cairo-api.xml | 1 + gdk/Color.custom | 5 - gdk/Device.custom | 9 +- gdk/DragContext.custom | 38 - gdk/Event.cs | 1 - gdk/EventButton.cs | 4 + gdk/EventExpose.cs | 4 +- gdk/EventMotion.cs | 4 + gdk/Gdk.metadata | 4 +- gdk/Global.custom | 4 + gdk/Makefile.am | 5 +- gdk/Pixbuf.custom | 86 - gdk/Property.custom | 2 + gdk/Rectangle.cs | 236 +++ gdk/Rectangle.custom | 204 -- gdk/Window.custom | 2 + gdk/WindowAttr.custom | 9 - gdk/gdk-api.raw | 4148 ++++++++++++++++------------------------ gdk/gdk-symbols.xml | 1 + gdk/glue/Makefile.am | 1 - gdk/glue/dragcontext.c | 30 - generator/Parser.cs | 2 + 23 files changed, 1875 insertions(+), 2927 deletions(-) delete mode 100644 gdk/DragContext.custom create mode 100644 gdk/Rectangle.cs delete mode 100644 gdk/Rectangle.custom delete mode 100644 gdk/glue/dragcontext.c diff --git a/cairo/Surface.cs b/cairo/Surface.cs index e1a54da47..7a21b169a 100644 --- a/cairo/Surface.cs +++ b/cairo/Surface.cs @@ -68,7 +68,7 @@ namespace Cairo { } } - static internal Surface LookupSurface (IntPtr surface) + public static Surface LookupSurface (IntPtr surface) { SurfaceType st = NativeMethods.cairo_surface_get_type (surface); switch (st) { diff --git a/cairo/cairo-api.xml b/cairo/cairo-api.xml index c39d69dd0..393221176 100644 --- a/cairo/cairo-api.xml +++ b/cairo/cairo-api.xml @@ -3,4 +3,5 @@ + diff --git a/gdk/Color.custom b/gdk/Color.custom index fc733032e..e48d43a46 100644 --- a/gdk/Color.custom +++ b/gdk/Color.custom @@ -22,11 +22,6 @@ // Boston, MA 02111-1307, USA. -public override string ToString () -{ - return String.Format ("rgb:{0:x}/{1:x}/{2:x}", Red, Green, Blue); -} - public Color (byte r, byte g, byte b) { Red = (ushort) (r << 8 | r); diff --git a/gdk/Device.custom b/gdk/Device.custom index c53d78891..427bc50b2 100644 --- a/gdk/Device.custom +++ b/gdk/Device.custom @@ -19,9 +19,6 @@ // Boston, MA 02111-1307, USA. - [DllImport("gdksharpglue-3")] - static extern DeviceAxis gtksharp_gdk_device_get_device_axis (IntPtr device, uint axis); - [DllImport("gdksharpglue-3")] static extern DeviceKey gtksharp_gdk_device_get_device_key (IntPtr device, uint axis); @@ -29,17 +26,15 @@ static extern void gdk_device_get_state(IntPtr device, IntPtr window, double [] axes, out int maskAsInt); +#if FIXME30 public void GetState(Gdk.Window window, out double [] axes, out Gdk.ModifierType mask) { int maskAsInt; axes = new double [this.NumAxes]; gdk_device_get_state(Handle, window.Handle, axes, out maskAsInt); mask = (Gdk.ModifierType) maskAsInt; } +#endif - public Gdk.DeviceAxis GetDeviceAxis (uint axis) { - return gtksharp_gdk_device_get_device_axis (Handle, axis); - } - public Gdk.DeviceKey GetDeviceKey (uint axis) { return gtksharp_gdk_device_get_device_key (Handle, axis); } diff --git a/gdk/DragContext.custom b/gdk/DragContext.custom deleted file mode 100644 index 10147cb6c..000000000 --- a/gdk/DragContext.custom +++ /dev/null @@ -1,38 +0,0 @@ -// -// gdk/DragContext.custom -// -// Author: Ettore Perazzoli -// -// Copyright (C) 2003 Novell, Inc. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the Lesser GNU General -// Public License as published by the Free Software Foundation. -// -// This program 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 GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - - -[DllImport("gdksharpglue-3")] -static extern IntPtr gtksharp_drag_context_get_targets (IntPtr ptr); - -public Atom [] Targets { - get { - GLib.List list = new GLib.List (gtksharp_drag_context_get_targets (this.Handle), typeof (Atom)); - - Atom [] entries = new Atom [list.Count]; - - int i = 0; - foreach (Atom a in list) - entries [i ++] = a; - - return entries; - } -} diff --git a/gdk/Event.cs b/gdk/Event.cs index 1e85d0b1b..53fa77777 100644 --- a/gdk/Event.cs +++ b/gdk/Event.cs @@ -151,7 +151,6 @@ namespace Gdk { #endif case EventType.Map: case EventType.Unmap: - case EventType.NoExpose: case EventType.Delete: case EventType.Destroy: default: diff --git a/gdk/EventButton.cs b/gdk/EventButton.cs index bdb19d470..b7a2f2693 100644 --- a/gdk/EventButton.cs +++ b/gdk/EventButton.cs @@ -50,17 +50,21 @@ namespace Gdk { public double[] Axes { get { double[] result = null; +#if FIXME30 IntPtr axes = Native.axes; if (axes != IntPtr.Zero) { result = new double [Device.NumAxes]; Marshal.Copy (axes, result, 0, result.Length); } +#endif return result; } set { NativeStruct native = Native; +#if FIXME30 if (native.axes == IntPtr.Zero || value.Length != Device.NumAxes) throw new InvalidOperationException (); +#endif Marshal.Copy (value, 0, native.axes, value.Length); } } diff --git a/gdk/EventExpose.cs b/gdk/EventExpose.cs index 1adecb36d..be5f88ca3 100644 --- a/gdk/EventExpose.cs +++ b/gdk/EventExpose.cs @@ -51,8 +51,8 @@ namespace Gdk { } } - public Region Region { - get { return GLib.Opaque.GetOpaque (Native.region, typeof (Region), false) as Region; } + public Cairo.Region Region { + get { return new Cairo.Region (Native.region); } set { NativeStruct native = Native; native.region = value == null ? IntPtr.Zero : value.Handle; diff --git a/gdk/EventMotion.cs b/gdk/EventMotion.cs index 7b6dc9a7b..a631574d5 100644 --- a/gdk/EventMotion.cs +++ b/gdk/EventMotion.cs @@ -51,17 +51,21 @@ namespace Gdk { public double[] Axes { get { double[] result = null; +#if FIXME30 IntPtr axes = Native.axes; if (axes != IntPtr.Zero) { result = new double [Device.NumAxes]; Marshal.Copy (axes, result, 0, result.Length); } +#endif return result; } set { NativeStruct native = Native; +#if FIXME30 if (native.axes == IntPtr.Zero || value.Length != Device.NumAxes) throw new InvalidOperationException (); +#endif Marshal.Copy (value, 0, native.axes, value.Length); } } diff --git a/gdk/Gdk.metadata b/gdk/Gdk.metadata index 8083fcd93..d60253769 100644 --- a/gdk/Gdk.metadata +++ b/gdk/Gdk.metadata @@ -84,6 +84,7 @@ 1 DragProtocol 1 + GdkAtom* 1 1 1 @@ -143,7 +144,6 @@ true true 1 - GdkDrawable 1 1 1 @@ -205,5 +205,7 @@ 128 1 + + diff --git a/gdk/Global.custom b/gdk/Global.custom index 05dc6c17d..aaa6313b0 100644 --- a/gdk/Global.custom +++ b/gdk/Global.custom @@ -59,6 +59,7 @@ } } +#if FIXME30 public static Gdk.Window[] WindowManagerClientWindows { get { Gdk.Window [] windows; @@ -68,6 +69,7 @@ return windows; } } +#endif public static int NumberOfDesktops { get { @@ -89,6 +91,7 @@ } } +#if FIXME30 public static Gdk.Window ActiveWindow { get { Gdk.Window [] windows; @@ -98,6 +101,7 @@ return windows [0]; } } +#endif public static Gdk.Rectangle[] DesktopWorkareas { get { diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 93c8369aa..3f270eb78 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -1,5 +1,3 @@ -SUBDIRS = . glue - pkg = gdk SYMBOLS = gdk-symbols.xml INCLUDE_API = $(top_srcdir)/glib/glib-api.xml $(top_srcdir)/cairo/cairo-api.xml $(top_builddir)/gio/gio-api.xml $(top_builddir)/pango/pango-api.xml @@ -28,6 +26,7 @@ sources = \ EventVisibility.cs \ EventWindowState.cs \ Key.cs \ + Rectangle.cs \ Size.cs \ TextProperty.cs @@ -39,7 +38,6 @@ customs = \ DeviceAxis.custom \ Display.custom \ DisplayManager.custom \ - DragContext.custom \ Drawable.custom \ EdgeTable.custom \ GCValues.custom \ @@ -58,7 +56,6 @@ customs = \ Pixdata.custom \ Point.custom \ Property.custom \ - Rectangle.custom \ Region.custom \ RgbCmap.custom \ Screen.custom \ diff --git a/gdk/Pixbuf.custom b/gdk/Pixbuf.custom index eadc93929..46724d9e7 100644 --- a/gdk/Pixbuf.custom +++ b/gdk/Pixbuf.custom @@ -32,75 +32,6 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. - [DllImport ("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern IntPtr gdk_pixbuf_get_from_drawable(IntPtr raw, IntPtr src, IntPtr cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height); - - public Gdk.Pixbuf GetFromDrawable(Gdk.Drawable src, Gdk.Colormap cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) { - IntPtr raw_ret = gdk_pixbuf_get_from_drawable(Handle, src.Handle, cmap.Handle, src_x, src_y, dest_x, dest_y, width, height); - Gdk.Pixbuf ret; - if (raw_ret == IntPtr.Zero) - ret = null; - else - ret = (Gdk.Pixbuf) GLib.Object.GetObject(raw_ret); - return ret; - } - - [DllImport ("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern IntPtr gdk_pixbuf_get_from_image(IntPtr raw, IntPtr src, IntPtr cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height); - - public Gdk.Pixbuf GetFromImage(Gdk.Image src, Gdk.Colormap cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) { - IntPtr raw_ret = gdk_pixbuf_get_from_image(Handle, src.Handle, cmap.Handle, src_x, src_y, dest_x, dest_y, width, height); - Gdk.Pixbuf ret; - if (raw_ret == IntPtr.Zero) - ret = null; - else - ret = (Gdk.Pixbuf) GLib.Object.GetObject(raw_ret); - return ret; - } - - [DllImport ("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_pixbuf_render_pixmap_and_mask (IntPtr raw, out IntPtr pixmap_return, out IntPtr mask_return, int alpha_threshold); - - public void RenderPixmapAndMask (out Pixmap pixmap_return, out Pixmap mask_return, int alpha_threshold) - { - IntPtr mask_handle, pixmap_handle; - gdk_pixbuf_render_pixmap_and_mask (Handle, out pixmap_handle, out mask_handle, alpha_threshold); - pixmap_return = GLib.Object.GetObject (pixmap_handle) as Pixmap; - mask_return = GLib.Object.GetObject (mask_handle) as Pixmap; - } - - [DllImport ("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_pixbuf_render_pixmap_and_mask_for_colormap (IntPtr raw, IntPtr colormap, out IntPtr pixmap_return, out IntPtr mask_return, int alpha_threshold); - - public void RenderPixmapAndMaskForColormap (Colormap colormap, out Pixmap pixmap_return, out Pixmap mask_return, int alpha_threshold) - { - IntPtr mask_handle, pixmap_handle; - gdk_pixbuf_render_pixmap_and_mask_for_colormap (Handle, colormap == null ? IntPtr.Zero : colormap.Handle, out pixmap_handle, out mask_handle, alpha_threshold); - pixmap_return = GLib.Object.GetObject (pixmap_handle) as Pixmap; - mask_return = GLib.Object.GetObject (mask_handle) as Pixmap; - } - - [DllImport ("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_pixbuf_render_threshold_alpha(IntPtr raw, IntPtr bitmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_threshold); - - public void RenderThresholdAlpha(Gdk.Pixmap bitmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_threshold) { - gdk_pixbuf_render_threshold_alpha(Handle, bitmap.Handle, src_x, src_y, dest_x, dest_y, width, height, alpha_threshold); - } - - [DllImport ("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_pixbuf_render_to_drawable(IntPtr raw, IntPtr drawable, IntPtr gc, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int dither, int x_dither, int y_dither); - - public void RenderToDrawable(Gdk.Drawable drawable, Gdk.GC gc, int src_x, int src_y, int dest_x, int dest_y, int width, int height, Gdk.RgbDither dither, int x_dither, int y_dither) { - gdk_pixbuf_render_to_drawable(Handle, drawable.Handle, gc.Handle, src_x, src_y, dest_x, dest_y, width, height, (int) dither, x_dither, y_dither); - } - - [DllImport ("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_pixbuf_render_to_drawable_alpha(IntPtr raw, IntPtr drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_mode, int alpha_threshold, int dither, int x_dither, int y_dither); - - public void RenderToDrawableAlpha(Gdk.Drawable drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height, Gdk.PixbufAlphaMode alpha_mode, int alpha_threshold, Gdk.RgbDither dither, int x_dither, int y_dither) { - gdk_pixbuf_render_to_drawable_alpha(Handle, drawable.Handle, src_x, src_y, dest_x, dest_y, width, height, (int) alpha_mode, alpha_threshold, (int) dither, x_dither, y_dither); - } - public Pixbuf (System.IO.Stream stream) : base (IntPtr.Zero) { using (PixbufLoader pl = new PixbufLoader (stream)) { @@ -254,23 +185,6 @@ } -// -// These are factory versions of a couple of existing methods, but simplify -// the process by reducing the number of steps required. Here a single -// operation will create the Pixbuf instead of two -// - - public static Gdk.Pixbuf FromDrawable (Gdk.Drawable src, Gdk.Colormap cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) { - IntPtr raw_ret = gdk_pixbuf_get_from_drawable(IntPtr.Zero, src.Handle, cmap.Handle, src_x, src_y, dest_x, dest_y, width, height); - return new Pixbuf (raw_ret); - } - - [Obsolete ("Replaced by static FromDrawable method")] - public Gdk.Pixbuf CreateFromDrawable (Gdk.Drawable src, Gdk.Colormap cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) { - IntPtr raw_ret = gdk_pixbuf_get_from_drawable((IntPtr) 0, src.Handle, cmap.Handle, src_x, src_y, dest_x, dest_y, width, height); - return new Pixbuf (raw_ret); - } - // // the 'Pixels' property // diff --git a/gdk/Property.custom b/gdk/Property.custom index 98a37639b..764483873 100644 --- a/gdk/Property.custom +++ b/gdk/Property.custom @@ -136,6 +136,7 @@ return true; } +#if FIXME30 public static bool Get (Gdk.Window window, Gdk.Atom property, bool pdelete, out Gdk.Window[] windows) { return Get (window, property, 0, uint.MaxValue - 3, pdelete, out windows); } @@ -153,3 +154,4 @@ } return true; } +#endif diff --git a/gdk/Rectangle.cs b/gdk/Rectangle.cs new file mode 100644 index 000000000..af88cd530 --- /dev/null +++ b/gdk/Rectangle.cs @@ -0,0 +1,236 @@ +// Authors: +// Jasper van Putten +// Ben Maurer +// Contains lots of c&p from System.Drawing +// +// Copyright (c) 2002 Jasper van Putten +// Copyright (c) 2005 Novell, Inc +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the Lesser GNU General +// Public License as published by the Free Software Foundation. +// +// This program 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 GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + + +using System; +using System.Runtime.InteropServices; + +namespace Gdk { + + [StructLayout(LayoutKind.Sequential)] + public struct Rectangle { + + public int X; + public int Y; + public int Width; + public int Height; + + public Rectangle (int x, int y, int width, int height) + { + this.X = x; + this.Y = y; + this.Width = width; + this.Height = height; + } + + public Rectangle (Point loc, Size sz) : this (loc.X, loc.Y, sz.Width, sz.Height) {} + + public static Rectangle FromLTRB (int left, int top, int right, int bottom) + { + return new Rectangle (left, top, right - left, bottom - top); + } + + public override bool Equals (object o) + { + if (!(o is Rectangle)) + return false; + + return (this == (Rectangle) o); + } + + public override int GetHashCode () + { + return (Height + Width) ^ X + Y; + } + + public static bool operator == (Rectangle r1, Rectangle r2) + { + return ((r1.Location == r2.Location) && (r1.Size == r2.Size)); + } + + public static bool operator != (Rectangle r1, Rectangle r2) + { + return !(r1 == r2); + } + + public override string ToString () + { + return String.Format ("{0}x{1}+{2}+{3}", Width, Height, X, Y); + } + + // Hit Testing / Intersection / Union + public bool Contains (Rectangle rect) + { + return (rect == Intersect (this, rect)); + } + + public bool Contains (Point pt) + { + return Contains (pt.X, pt.Y); + } + + public bool Contains (int x, int y) + { + return ((x >= Left) && (x <= Right) && (y >= Top) && (y <= Bottom)); + } + + public bool IntersectsWith (Rectangle r) + { + return !((Left > r.Right) || (Right < r.Left) || + (Top > r.Bottom) || (Bottom < r.Top)); + } + + public static Rectangle Union (Rectangle r1, Rectangle r2) + { + return FromLTRB (Math.Min (r1.Left, r2.Left), + Math.Min (r1.Top, r2.Top), + Math.Max (r1.Right, r2.Right), + Math.Max (r1.Bottom, r2.Bottom)); + } + + public void Intersect (Rectangle r) + { + this = Intersect (this, r); + } + + public static Rectangle Intersect (Rectangle r1, Rectangle r2) + { + Rectangle r; + if (!r1.Intersect (r2, out r)) + return new Rectangle (); + + return r; + } + + // Position/Size + public int Top { + get { return Y; } + } + public int Bottom { + get { return Y + Height - 1; } + } + public int Right { + get { return X + Width - 1; } + } + public int Left { + get { return X; } + } + + public bool IsEmpty { + get { return (Width == 0) || (Height == 0); } + } + + public Size Size { + get { return new Size (Width, Height); } + set { + Width = value.Width; + Height = value.Height; + } + } + + public Point Location { + get { + return new Point (X, Y); + } + set { + X = value.X; + Y = value.Y; + } + } + + // Inflate and Offset + public void Inflate (Size sz) + { + Inflate (sz.Width, sz.Height); + } + + public void Inflate (int width, int height) + { + X -= width; + Y -= height; + Width += width * 2; + Height += height * 2; + } + + public static Rectangle Inflate (Rectangle rect, int x, int y) + { + Rectangle r = rect; + r.Inflate (x, y); + return r; + } + + public static Rectangle Inflate (Rectangle rect, Size sz) + { + return Inflate (rect, sz.Width, sz.Height); + } + + public void Offset (int dx, int dy) + { + X += dx; + Y += dy; + } + + public void Offset (Point dr) + { + Offset (dr.X, dr.Y); + } + + public static Rectangle Offset (Rectangle rect, int dx, int dy) + { + Rectangle r = rect; + r.Offset (dx, dy); + return r; + } + + public static Rectangle Offset (Rectangle rect, Point dr) + { + return Offset (rect, dr.X, dr.Y); + } + + [DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr gdk_rectangle_get_type(); + + public static GLib.GType GType { + get { + IntPtr raw_ret = gdk_rectangle_get_type(); + GLib.GType ret = new GLib.GType(raw_ret); + return ret; + } + } + + [DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gdk_rectangle_union (ref Rectangle src1, ref Rectangle src2, out Rectangle dest); + + public void Union (Gdk.Rectangle src, out Gdk.Rectangle dest) + { + gdk_rectangle_union (ref this, ref src, out dest); + } + + [DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool gdk_rectangle_intersect (ref Rectangle src1, ref Rectangle src2, out Rectangle dest); + + public bool Intersect (Gdk.Rectangle src, out Gdk.Rectangle dest) + { + return gdk_rectangle_intersect (ref this, ref src, out dest); + } + } +} diff --git a/gdk/Rectangle.custom b/gdk/Rectangle.custom deleted file mode 100644 index e17fc47ed..000000000 --- a/gdk/Rectangle.custom +++ /dev/null @@ -1,204 +0,0 @@ -// Gdk.Point.Rectangle - Gdk Rectangle class customizations -// -// Authors: -// Jasper van Putten -// Ben Maurer -// Contains lots of c&p from System.Drawing -// -// Copyright (c) 2002 Jasper van Putten -// Copyright (c) 2005 Novell, Inc -// -// This code is inserted after the automatically generated code. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the Lesser GNU General -// Public License as published by the Free Software Foundation. -// -// This program 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 GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - - -public override string ToString () -{ - return String.Format ("{0}x{1}+{2}+{3}", Width, Height, X, Y); -} - -// constructors -public Rectangle (int x, int y, int width, int height) -{ - this.X = x; - this.Y = y; - this.Width = width; - this.Height = height; -} - -public Rectangle (Point loc, Size sz) : this (loc.X, loc.Y, sz.Width, sz.Height) {} - -public static Rectangle FromLTRB (int left, int top, int right, int bottom) -{ - return new Rectangle (left, top, right - left, - bottom - top); -} - -// Equality -public override bool Equals (object o) -{ - if (!(o is Rectangle)) - return false; - - return (this == (Rectangle) o); -} - -public override int GetHashCode () -{ - return (Height + Width) ^ X + Y; -} - -public static bool operator == (Rectangle r1, Rectangle r2) -{ - return ((r1.Location == r2.Location) && (r1.Size == r2.Size)); -} - -public static bool operator != (Rectangle r1, Rectangle r2) -{ - return !(r1 == r2); -} - -// Hit Testing / Intersection / Union -public bool Contains (Rectangle rect) -{ - return (rect == Intersect (this, rect)); -} - -public bool Contains (Point pt) -{ - return Contains (pt.X, pt.Y); -} - -public bool Contains (int x, int y) -{ - return ((x >= Left) && (x <= Right) && - (y >= Top) && (y <= Bottom)); -} - -public bool IntersectsWith (Rectangle r) -{ - return !((Left > r.Right) || (Right < r.Left) || - (Top > r.Bottom) || (Bottom < r.Top)); -} - -public static Rectangle Union (Rectangle r1, Rectangle r2) -{ - return FromLTRB (Math.Min (r1.Left, r2.Left), - Math.Min (r1.Top, r2.Top), - Math.Max (r1.Right, r2.Right), - Math.Max (r1.Bottom, r2.Bottom)); -} - -public void Intersect (Rectangle r) -{ - this = Intersect (this, r); -} - -public static Rectangle Intersect (Rectangle r1, Rectangle r2) -{ - Rectangle r; - if (!r1.Intersect (r2, out r)) - return new Rectangle (); - - return r; -} - -// Position/Size -public int Top { - get { return Y; } -} -public int Bottom { - get { return Y + Height - 1; } -} -public int Right { - get { return X + Width - 1; } -} -public int Left { - get { return X; } -} - -public bool IsEmpty { - get { return (Width == 0) || (Height == 0); } -} - -public Size Size { - get { - return new Size (Width, Height); - } - set { - Width = value.Width; - Height = value.Height; - } -} - -public Point Location { - get { - return new Point (X, Y); - } - set { - X = value.X; - Y = value.Y; - } -} - -// Inflate and Offset -public void Inflate (Size sz) -{ - Inflate (sz.Width, sz.Height); -} - -public void Inflate (int width, int height) -{ - X -= width; - Y -= height; - Width += width * 2; - Height += height * 2; -} - -public static Rectangle Inflate (Rectangle rect, int x, int y) -{ - Rectangle r = rect; - r.Inflate (x, y); - return r; -} - -public static Rectangle Inflate (Rectangle rect, Size sz) -{ - return Inflate (rect, sz.Width, sz.Height); -} - -public void Offset (int dx, int dy) -{ - X += dx; - Y += dy; -} - -public void Offset (Point dr) -{ - Offset (dr.X, dr.Y); -} - -public static Rectangle Offset (Rectangle rect, int dx, int dy) -{ - Rectangle r = rect; - r.Offset (dx, dy); - return r; -} - -public static Rectangle Offset (Rectangle rect, Point dr) -{ - return Offset (rect, dr.X, dr.Y); -} diff --git a/gdk/Window.custom b/gdk/Window.custom index 59f356570..f2a4e3757 100644 --- a/gdk/Window.custom +++ b/gdk/Window.custom @@ -88,12 +88,14 @@ gdk_window_move_resize (Handle, rect.X, rect.Y, rect.Width, rect.Height); } +#if FIXME30 public void ClearArea (Gdk.Rectangle rect, bool expose) { if (expose) gdk_window_clear_area_e (Handle, rect.X, rect.Y, rect.Width, rect.Height); else gdk_window_clear_area (Handle, rect.X, rect.Y, rect.Width, rect.Height); } +#endif [DllImport ("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gdk_window_get_user_data (IntPtr raw, out IntPtr data); diff --git a/gdk/WindowAttr.custom b/gdk/WindowAttr.custom index 724142793..590a5e35f 100644 --- a/gdk/WindowAttr.custom +++ b/gdk/WindowAttr.custom @@ -38,15 +38,6 @@ set { _visual = value.Handle; } } - [Obsolete ("Replaced by Colormap property.")] - public Gdk.Colormap colormap { - get { - Gdk.Colormap ret = (Gdk.Colormap) GLib.Object.GetObject(_colormap); - return ret; - } - set { _colormap = value.Handle; } - } - [Obsolete ("Replaced by Cursor property.")] public Gdk.Cursor cursor { get { diff --git a/gdk/gdk-api.raw b/gdk/gdk-api.raw index a76f9291d..a1f9492a8 100644 --- a/gdk/gdk-api.raw +++ b/gdk/gdk-api.raw @@ -6,7 +6,7 @@ Please DO NOT MODIFY THIS FILE, modify .metadata files instead. --> - + @@ -21,12 +21,6 @@ - - - - - - @@ -114,8 +108,14 @@ + + + + + + @@ -189,75 +189,28 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -278,16 +231,6 @@ - - - - - - - - - - @@ -298,16 +241,7 @@ - - - - - - - - - - + @@ -337,11 +271,6 @@ - - - - - @@ -356,11 +285,6 @@ - - - - - @@ -379,10 +303,6 @@ - - - - @@ -418,15 +338,10 @@ - - - - - - - - - + + + + @@ -462,9 +377,9 @@ - + @@ -482,12 +397,10 @@ - - - - - - + + + + @@ -503,37 +416,26 @@ - - + + - - - - - - - - - - + + - - - - + - + - + @@ -564,89 +466,166 @@ - - + + + - - - - - - - - - - - + + + + + + + + - - - - - - - - - + + - - - - - + + - - - - - - - - - - - - - - - - - + - - - - + - - + - - + - - + + + + + + + + + + + + + + + + + + + - - - - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -654,6 +633,9 @@ + + + @@ -662,8 +644,28 @@ - - + + + + + + + + + + + + + + + + + + + + + + @@ -675,6 +677,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -686,6 +719,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -707,41 +773,138 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + - + @@ -759,6 +922,253 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -773,11 +1183,17 @@ + + + + + + - - + + @@ -791,6 +1207,9 @@ + + + @@ -807,7 +1226,7 @@ - + @@ -825,22 +1244,34 @@ - + - + + + + + + + - + + + + + + + @@ -853,10 +1284,10 @@ - + - + @@ -886,12 +1317,6 @@ - - - - - - @@ -925,7 +1350,7 @@ - + @@ -937,6 +1362,15 @@ + + + + + + + + + @@ -946,6 +1380,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -958,6 +1445,12 @@ + + + + + + @@ -968,1016 +1461,130 @@ + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - @@ -1986,6 +1593,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2015,6 +1698,9 @@ + + + @@ -2027,6 +1713,12 @@ + + + + + + @@ -2040,167 +1732,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - @@ -2215,6 +1783,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2227,9 +1942,6 @@ - - - @@ -2286,18 +1998,12 @@ + + + - - - - - - - - - @@ -2311,9 +2017,6 @@ - - - @@ -2347,12 +2050,6 @@ - - - - - - @@ -2373,20 +2070,9 @@ - - - - - - - - - - - - - - + + + @@ -2415,6 +2101,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2424,11 +2146,83 @@ + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2464,7 +2258,7 @@ - + @@ -2477,27 +2271,6 @@ - - - - - - - - - - - - - - - - - - - - - @@ -2512,6 +2285,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2524,25 +2323,18 @@ + + + + + + - - - - - - - - - - - - - @@ -2552,25 +2344,69 @@ + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2584,19 +2420,16 @@ - - - - - - - - + + + + + @@ -2623,6 +2456,15 @@ + + + + + + + + + @@ -2630,20 +2472,32 @@ + + + + + + + + + + + + - - + + - + @@ -2651,27 +2505,31 @@ + + + + + + + + + + + + - - - - - - - - - + @@ -2679,8 +2537,8 @@ - - + + @@ -2694,29 +2552,25 @@ - + + + + + + + + + + - - - - - - - - - - - - - @@ -2739,7 +2593,7 @@ - + @@ -2785,9 +2639,6 @@ - - - @@ -2803,6 +2654,13 @@ + + + + + + + @@ -2816,19 +2674,24 @@ - - - - - - - + + + + + + + + + + + + @@ -2859,6 +2722,20 @@ + + + + + + + + + + + + + + @@ -2890,26 +2767,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -2970,6 +2827,13 @@ + + + + + + + @@ -2982,6 +2846,12 @@ + + + + + + @@ -3012,18 +2882,10 @@ - - - - - - - - - + @@ -3056,58 +2918,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - @@ -3136,97 +2955,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -3292,9 +3023,10 @@ - + + @@ -3336,11 +3068,6 @@ - - - - - @@ -3409,78 +3136,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3494,248 +3149,86 @@ + + - - - - + + + - + - - - - - - + + + - + - - - - - - + + + - + + - - - - - - + + + + - - - + + + + + + + + + + + - + + - - - - - - - - - - - - - - + + + + + - + + + + + + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - @@ -3743,9 +3236,8 @@ - + - @@ -3753,59 +3245,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - @@ -3824,13 +3266,6 @@ - - - - - - - @@ -3846,23 +3281,8 @@ - - - - - - - + - - - - - - - - - @@ -3874,14 +3294,11 @@ - + - - - @@ -3908,19 +3325,10 @@ - - - - - - - - - - + @@ -3929,18 +3337,6 @@ - - - - - - - - - - - - @@ -3948,58 +3344,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - + + + + + @@ -4013,7 +3366,14 @@ - + + + + + + + + @@ -4027,7 +3387,13 @@ - + + + + + + + @@ -4046,73 +3412,20 @@ - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - + + + + @@ -4131,6 +3444,14 @@ + + + + + + + + @@ -4144,17 +3465,6 @@ - - - - - - - - - - - @@ -4167,13 +3477,6 @@ - - - - - - - @@ -4223,14 +3526,14 @@ - + - - + + @@ -4268,10 +3571,10 @@ - - + + - + @@ -4288,6 +3591,12 @@ + + + + + + @@ -4354,6 +3663,13 @@ + + + + + + + @@ -4361,59 +3677,46 @@ - - - - + + - - - - - - - - + + - - - + + + - - - - + + + - - + + - - - - - + + + + - - + + - + + + - - - - - - - + + - + @@ -4421,15 +3724,7 @@ - - - - - - - - - + @@ -4509,15 +3804,8 @@ - - - - - - - - + @@ -4527,7 +3815,7 @@ - + @@ -4538,105 +3826,29 @@ - + - - - + - - - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -4647,18 +3859,10 @@ - - - - - - - - - + - + @@ -4717,68 +3921,24 @@ - - + + + + + - + + + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -4825,7 +3985,7 @@ - + @@ -4855,149 +4015,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -5139,6 +4156,9 @@ + + + @@ -5147,6 +4167,9 @@ + + + @@ -5290,6 +4313,12 @@ + + + + + + @@ -5696,16 +4725,17 @@ + - - + + - + @@ -5715,8 +4745,21 @@ + + + + + + + + + + + + + @@ -5732,6 +4775,9 @@ + + + @@ -5760,6 +4806,18 @@ + + + + + + + + + + + + @@ -5797,5 +4855,19 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gdk/gdk-symbols.xml b/gdk/gdk-symbols.xml index 3d3d23020..8c87a4c34 100644 --- a/gdk/gdk-symbols.xml +++ b/gdk/gdk-symbols.xml @@ -23,5 +23,6 @@ + diff --git a/gdk/glue/Makefile.am b/gdk/glue/Makefile.am index 3b355dffe..14e5ce971 100644 --- a/gdk/glue/Makefile.am +++ b/gdk/glue/Makefile.am @@ -1,7 +1,6 @@ lib_LTLIBRARIES = libgdksharpglue-3.la libgdksharpglue_3_la_SOURCES = \ - dragcontext.c \ device.c \ vmglueheaders.h diff --git a/gdk/glue/dragcontext.c b/gdk/glue/dragcontext.c deleted file mode 100644 index a6b8dc02a..000000000 --- a/gdk/glue/dragcontext.c +++ /dev/null @@ -1,30 +0,0 @@ -/* dragcontext.c: Glue for accessing fields in a GdkDragContext. - * - * Author: Ettore Perazzoli - * - * Copyright (c) 2003 Novell, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the Lesser GNU General - * Public License as published by the Free Software Foundation. - * - * This program 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 GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -GList *gtksharp_drag_context_get_targets (GdkDragContext *context); - -GList * -gtksharp_drag_context_get_targets (GdkDragContext *context) -{ - return context->targets; -} diff --git a/generator/Parser.cs b/generator/Parser.cs index 85c13cb25..415647a2b 100644 --- a/generator/Parser.cs +++ b/generator/Parser.cs @@ -176,6 +176,8 @@ namespace GtkSharp.Generation { string call = symbol.GetAttribute ("call_fmt"); string from = symbol.GetAttribute ("from_fmt"); result = new MarshalGen (cname, name, mtype, call, from); + } else if (type == "struct") { + result = new ByRefGen (symbol.GetAttribute ("cname"), symbol.GetAttribute ("name")); } else Console.WriteLine ("Parser::ParseSymbol - Unexpected symbol type " + type);