diff --git a/ChangeLog b/ChangeLog index 265b73ece..c8bb7265d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-09-16 Mike Kestner + + * gtk/Gtk.metadata: hide StatusIcon.GetGeometry for custom impl. + * gtk/StatusIcon.custom: custom GetGeometry implementation to avoid + marshaling exceptions on win32. [Fixes #518169] + 2009-09-11 Mike Kestner * glib/Object.cs: add support for native instantiation of diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index c0341f29f..09fccae48 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -592,8 +592,7 @@ GtkWidget* 1 true - out - out + 1 SetStock SetPixbuf SetIconName diff --git a/gtk/StatusIcon.custom b/gtk/StatusIcon.custom index 61482e569..bd0a103d4 100644 --- a/gtk/StatusIcon.custom +++ b/gtk/StatusIcon.custom @@ -77,4 +77,25 @@ } } + [DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern bool gtk_status_icon_get_geometry(IntPtr raw, out IntPtr screen, IntPtr area, out int orientation); + + public bool GetGeometry(out Gdk.Screen screen, out Gdk.Rectangle area, out Gtk.Orientation orientation) + { + IntPtr native_screen; + IntPtr native_area = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gdk.Rectangle))); + int native_orientation; + bool ret = gtk_status_icon_get_geometry(Handle, out native_screen, native_area, out native_orientation); + if (ret) { + screen = GLib.Object.GetObject(native_screen) as Gdk.Screen; + area = Gdk.Rectangle.New (native_area); + orientation = (Gtk.Orientation) native_orientation; + } else { + screen = null; + area = Gdk.Rectangle.Zero; + orientation = Gtk.Orientation.Horizontal; + } + Marshal.FreeHGlobal (native_area); + return ret; + }