Ryujinx-GtkSharp/glib/GLibSharp.SourceDummyMarshalNative.cs
Stephan Sundermann 6ab620d689 generator,glib: added GPollFD and GSource types
GSource type was already there (but was not mapped by
the generator yet) so then the autogenerated methods
have been added manually inside the class after the
custom methods.

Other Source-related class are also generated and added
(but not mapped in the SymbolTable) to glib.
2013-10-09 19:41:21 +02:00

93 lines
2.1 KiB
C#

// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace GLibSharp {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void SourceDummyMarshalNative();
internal class SourceDummyMarshalInvoker {
SourceDummyMarshalNative native_cb;
IntPtr __data;
GLib.DestroyNotify __notify;
~SourceDummyMarshalInvoker ()
{
if (__notify == null)
return;
__notify (__data);
}
internal SourceDummyMarshalInvoker (SourceDummyMarshalNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
internal SourceDummyMarshalInvoker (SourceDummyMarshalNative native_cb, IntPtr data) : this (native_cb, data, null) {}
internal SourceDummyMarshalInvoker (SourceDummyMarshalNative native_cb, IntPtr data, GLib.DestroyNotify notify)
{
this.native_cb = native_cb;
__data = data;
__notify = notify;
}
internal GLib.SourceDummyMarshal Handler {
get {
return new GLib.SourceDummyMarshal(InvokeNative);
}
}
void InvokeNative ()
{
native_cb ();
}
}
internal class SourceDummyMarshalWrapper {
public void NativeCallback ()
{
try {
managed ();
if (release_on_call)
gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
bool release_on_call = false;
GCHandle gch;
public void PersistUntilCalled ()
{
release_on_call = true;
gch = GCHandle.Alloc (this);
}
internal SourceDummyMarshalNative NativeDelegate;
GLib.SourceDummyMarshal managed;
public SourceDummyMarshalWrapper (GLib.SourceDummyMarshal managed)
{
this.managed = managed;
if (managed != null)
NativeDelegate = new SourceDummyMarshalNative (NativeCallback);
}
public static GLib.SourceDummyMarshal GetManagedDelegate (SourceDummyMarshalNative native)
{
if (native == null)
return null;
SourceDummyMarshalWrapper wrapper = (SourceDummyMarshalWrapper) native.Target;
if (wrapper == null)
return null;
return wrapper.managed;
}
}
#endregion
}