mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-23 17:35:33 +00:00
2004-02-16 Mike Kestner <mkestner@ximian.com>
* glib/TypeConverter.cs : check for GType prop on all types, not just value types, before we fall back to managed values. * glib/Value.cs : use handle to set_boxed for IWrappers. svn path=/trunk/gtk-sharp/; revision=23158
This commit is contained in:
parent
320c4f713d
commit
46b9b156a4
|
@ -1,3 +1,9 @@
|
|||
2004-02-16 Mike Kestner <mkestner@ximian.com>
|
||||
|
||||
* glib/TypeConverter.cs : check for GType prop on all types,
|
||||
not just value types, before we fall back to managed values.
|
||||
* glib/Value.cs : use handle to set_boxed for IWrappers.
|
||||
|
||||
2004-02-16 Mike Kestner <mkestner@ximian.com>
|
||||
|
||||
* gdk/EventKey.cs : add a Key prop to return casted KeyVals.
|
||||
|
|
|
@ -39,13 +39,11 @@ namespace GLibSharp {
|
|||
return GType.UInt;
|
||||
if (type.IsSubclassOf (typeof (GLib.Object)))
|
||||
return GType.Object;
|
||||
if (type.IsValueType) {
|
||||
PropertyInfo pi = type.GetProperty ("GType");
|
||||
if (pi == null)
|
||||
return GType.Pointer;
|
||||
else
|
||||
return (GType) pi.GetValue (null, null);
|
||||
}
|
||||
PropertyInfo pi = type.GetProperty ("GType", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
|
||||
if (pi != null)
|
||||
return (GType) pi.GetValue (null, null);
|
||||
if (type.IsValueType)
|
||||
return GType.Pointer;
|
||||
|
||||
return GType.None;
|
||||
}
|
||||
|
|
|
@ -372,7 +372,7 @@ namespace GLib {
|
|||
} else {
|
||||
_val = gtksharp_value_create (type.Val);
|
||||
}
|
||||
|
||||
|
||||
if (type == GType.None)
|
||||
g_value_set_boxed (_val, ManagedValue.WrapObject (obj));
|
||||
else if (type == GType.String)
|
||||
|
@ -396,6 +396,10 @@ namespace GLib {
|
|||
Marshal.StructureToPtr (obj, buf, false);
|
||||
g_value_set_pointer (_val, buf);
|
||||
} else if (g_type_is_a (type.Val, GLib.GType.Boxed.Val)) {
|
||||
if (obj is IWrapper) {
|
||||
g_value_set_boxed (_val, ((IWrapper)obj).Handle);
|
||||
return;
|
||||
}
|
||||
buf = Marshal.AllocHGlobal (Marshal.SizeOf (obj.GetType()));
|
||||
Marshal.StructureToPtr (obj, buf, false);
|
||||
g_value_set_boxed (_val, buf);
|
||||
|
|
Loading…
Reference in a new issue