2009-08-19 Christian Hoff <christian_hoff@gmx.net>
* glib/MainContext.cs: Add API to create new MainContexts. Add a few missing methods. * glib/MainLoop.cs: Allow creating MainLoops in non-default MainContexts. [Fixes #526232] * glib/MainContext.xml, glib/MainLoop.xml: Add docs for the new API. svn path=/trunk/gtk-sharp/; revision=140256
This commit is contained in:
parent
f317ded797
commit
ed804756cc
6 changed files with 397 additions and 18 deletions
|
@ -1,3 +1,10 @@
|
|||
2009-08-19 Christian Hoff <christian_hoff@gmx.net>
|
||||
|
||||
* glib/MainContext.cs: Add API to create new MainContexts. Add a few
|
||||
missing methods.
|
||||
* glib/MainLoop.cs: Allow creating MainLoops in non-default MainContexts.
|
||||
[Fixes #526232]
|
||||
|
||||
2009-08-18 Christian Hoff <christian_hoff@gmx.net>
|
||||
|
||||
* sample/GtkDemo/Makefile.am: Resurrect local Mono.Cairo build.
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2009-08-19 Christian Hoff <christian_hoff@gmx.net>
|
||||
|
||||
* glib/MainContext.xml, glib/MainLoop.xml: Add docs for the new API.
|
||||
|
||||
2008-03-17 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* en/Gtk/HBox.xml:
|
||||
|
|
|
@ -25,6 +25,21 @@
|
|||
<remarks>This is the default constructor for <see cref="T:GLib.MainContext" />.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Default">
|
||||
<MemberSignature Language="C#" Value="public static GLib.MainContext Default { get; }" />
|
||||
<MemberType>Property</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>GLib.MainContext</ReturnType>
|
||||
</ReturnValue>
|
||||
<Docs>
|
||||
<summary>Returns the default main context.</summary>
|
||||
<value>
|
||||
</value>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Depth">
|
||||
<MemberSignature Language="C#" Value="public static int Depth { get; }" />
|
||||
<MemberType>Property</MemberType>
|
||||
|
@ -37,6 +52,64 @@
|
|||
<remarks />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Equals">
|
||||
<MemberSignature Language="C#" Value="public override bool Equals (object o);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="o" Type="System.Object" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="o">To be added.</param>
|
||||
<summary>To be added.</summary>
|
||||
<returns>To be added.</returns>
|
||||
<remarks>To be added.</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Finalize">
|
||||
<MemberSignature Language="C#" Value="~MainContext ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>To be added.</summary>
|
||||
<remarks>To be added.</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="GetHashCode">
|
||||
<MemberSignature Language="C#" Value="public override int GetHashCode ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Int32</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>To be added.</summary>
|
||||
<returns>To be added.</returns>
|
||||
<remarks>To be added.</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="HasPendingEvents">
|
||||
<MemberSignature Language="C#" Value="public bool HasPendingEvents { get; }" />
|
||||
<MemberType>Property</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Docs>
|
||||
<summary>Checks if any sources have pending events for the given context.</summary>
|
||||
<value>An object of type <see cref="T:System.Boolean" /></value>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Iteration">
|
||||
<MemberSignature Language="C#" Value="public static bool Iteration ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
|
@ -51,19 +124,19 @@
|
|||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Iteration">
|
||||
<MemberSignature Language="C#" Value="public static bool Iteration (bool MayBlock);" />
|
||||
<MemberSignature Language="C#" Value="public static bool Iteration (bool may_block);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="MayBlock" Type="System.Boolean" />
|
||||
<Parameter Name="may_block" Type="System.Boolean" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="MayBlock">an object of type <see cref="T:System.Boolean" /></param>
|
||||
<param name="may_block">an object of type <see cref="T:System.Boolean" /></param>
|
||||
<summary>Runs a single iteration for the given main loop.</summary>
|
||||
<returns>an object of type <see cref="T:System.Boolean" /></returns>
|
||||
<remarks>This involves checking to see if any event sources are ready to be processed, then if no events sources are ready and <paramref name="may_block" /> is <see langword="true" />, waiting for a source to become ready, then dispatching the highest priority events sources that are ready. Note that even when <paramref name="may_block" /> is <see langword="true" />, it is still possible for g_main_context_iteration() to return <see langword="false" />, since the the wait may be interrupted for other reasons than an event source becoming ready.</remarks>
|
||||
<remarks>This is a convenience function for GLib.MainContext.Default.RunIteration(may_block).</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Pending">
|
||||
|
@ -76,7 +149,92 @@
|
|||
<Docs>
|
||||
<summary>Checks if any sources have pending events for the given context.</summary>
|
||||
<returns>an object of type <see cref="T:System.Boolean" /></returns>
|
||||
<remarks />
|
||||
<remarks>This is a convenince function for GLib.MainContext.Default.HasPendingEvents.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="PopThreadDefault">
|
||||
<MemberSignature Language="C#" Value="public void PopThreadDefault ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>To be added.</summary>
|
||||
<remarks>To be added.</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="PushThreadDefault">
|
||||
<MemberSignature Language="C#" Value="public void PushThreadDefault ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>To be added.</summary>
|
||||
<remarks>To be added.</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="RunIteration">
|
||||
<MemberSignature Language="C#" Value="public bool RunIteration ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>Runs a single iteration for the given main loop.</summary>
|
||||
<returns>
|
||||
<see langword="true" /> if successful.</returns>
|
||||
<remarks>This is a convenience overload for GLib.MainContext.Default.RunIteration(System.Boolean) with <see langword="false" /> passed in.</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="RunIteration">
|
||||
<MemberSignature Language="C#" Value="public bool RunIteration (bool may_block);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="may_block" Type="System.Boolean" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="may_block">To be added.</param>
|
||||
<summary>Runs a single iteration for the given main loop.</summary>
|
||||
<returns>
|
||||
<see langword="true" /> if successful.</returns>
|
||||
<remarks>This involves checking to see if any event sources are ready to be processed, then if no events sources are ready and <paramref name="may_block" /> is <see langword="true" />, waiting for a source to become ready, then dispatching the highest priority events sources that are ready. Note that even when <paramref name="may_block" /> is <see langword="true" />, it is still possible for g_main_context_iteration() to return <see langword="false" />, since the the wait may be interrupted for other reasons than an event source becoming ready.</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="ThreadDefault">
|
||||
<MemberSignature Language="C#" Value="public GLib.MainContext ThreadDefault { get; }" />
|
||||
<MemberType>Property</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>GLib.MainContext</ReturnType>
|
||||
</ReturnValue>
|
||||
<Docs>
|
||||
<summary>Returns the default MainContext for the current thread. If none exists, one will be created.</summary>
|
||||
<value>To be added.</value>
|
||||
<remarks>When being called from the Gtk# main loop, returns <see cref="P:GLib.MainContext.Default" />.</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Wakeup">
|
||||
<MemberSignature Language="C#" Value="public void Wakeup ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>To be added.</summary>
|
||||
<remarks>To be added.</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
</Members>
|
||||
|
|
|
@ -21,11 +21,69 @@
|
|||
<ReturnValue />
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>Default constructor</summary>
|
||||
<summary>Creates a new main loop in the default context.</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName=".ctor">
|
||||
<MemberSignature Language="C#" Value="public MainLoop (GLib.MainContext context);" />
|
||||
<MemberType>Constructor</MemberType>
|
||||
<Parameters>
|
||||
<Parameter Name="context" Type="GLib.MainContext" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="context">The context in which to create the main loop.</param>
|
||||
<summary>Creates a new main loop in the specified context.</summary>
|
||||
<remarks></remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName=".ctor">
|
||||
<MemberSignature Language="C#" Value="public MainLoop (GLib.MainContext context, bool is_running);" />
|
||||
<MemberType>Constructor</MemberType>
|
||||
<Parameters>
|
||||
<Parameter Name="context" Type="GLib.MainContext" />
|
||||
<Parameter Name="is_running" Type="System.Boolean" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="context">The context in which to create the main loop</param>
|
||||
<param name="is_running">Indicates whether the main loop is currently running.</param>
|
||||
<summary>Creates a new main loop.</summary>
|
||||
<remarks></remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Context">
|
||||
<MemberSignature Language="C#" Value="public GLib.MainContext Context { get; }" />
|
||||
<MemberType>Property</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>GLib.MainContext</ReturnType>
|
||||
</ReturnValue>
|
||||
<Docs>
|
||||
<summary>returns the <see cref="T:GLib.MainContext" /> in which this main loop was created.</summary>
|
||||
<value></value>
|
||||
<remarks></remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Equals">
|
||||
<MemberSignature Language="C#" Value="public override bool Equals (object o);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="o" Type="System.Object" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="o">To be added.</param>
|
||||
<summary>To be added.</summary>
|
||||
<returns>True if "o" and "this" are equal/share the same native handle.</returns>
|
||||
<remarks></remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Finalize">
|
||||
<MemberSignature Language="C#" Value="~MainLoop ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
|
@ -38,6 +96,20 @@
|
|||
<remarks />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="GetHashCode">
|
||||
<MemberSignature Language="C#" Value="public override int GetHashCode ();" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Int32</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>To be added.</summary>
|
||||
<returns>To be added.</returns>
|
||||
<remarks>To be added.</remarks>
|
||||
<since version="Gtk# 2.90" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="IsRunning">
|
||||
<MemberSignature Language="C#" Value="public bool IsRunning { get; }" />
|
||||
<MemberType>Property</MemberType>
|
||||
|
|
|
@ -25,32 +25,143 @@ namespace GLib {
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
public class MainContext {
|
||||
|
||||
IntPtr handle;
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern IntPtr g_main_context_new ();
|
||||
|
||||
public MainContext ()
|
||||
{
|
||||
handle = g_main_context_new ();
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern void g_main_context_ref (IntPtr raw);
|
||||
|
||||
internal MainContext (IntPtr raw)
|
||||
{
|
||||
handle = raw;
|
||||
g_main_context_ref (handle);
|
||||
}
|
||||
|
||||
internal IntPtr Handle {
|
||||
get {
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern void g_main_context_unref (IntPtr raw);
|
||||
|
||||
~MainContext ()
|
||||
{
|
||||
g_main_context_unref (handle);
|
||||
handle = IntPtr.Zero;
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern IntPtr g_main_context_default ();
|
||||
|
||||
public static MainContext Default {
|
||||
get {
|
||||
return new MainContext (g_main_context_default ());
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern IntPtr g_main_context_thread_default ();
|
||||
|
||||
public MainContext ThreadDefault {
|
||||
get {
|
||||
IntPtr raw = g_main_context_thread_default ();
|
||||
// NULL is returned if the thread-default main context is the default context. We'd rather not adopt this strange bahaviour.
|
||||
return raw == IntPtr.Zero ? Default : new MainContext (raw);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern void g_main_context_push_thread_default (IntPtr raw);
|
||||
|
||||
public void PushThreadDefault ()
|
||||
{
|
||||
g_main_context_push_thread_default (handle);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern void g_main_context_pop_thread_default (IntPtr raw);
|
||||
|
||||
public void PopThreadDefault ()
|
||||
{
|
||||
g_main_context_pop_thread_default (handle);
|
||||
}
|
||||
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern bool g_main_context_iteration (IntPtr raw, bool may_block);
|
||||
|
||||
public bool RunIteration (bool may_block)
|
||||
{
|
||||
return g_main_context_iteration (handle, may_block);
|
||||
}
|
||||
|
||||
public bool RunIteration ()
|
||||
{
|
||||
return RunIteration (false);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern bool g_main_context_pending (IntPtr raw);
|
||||
|
||||
public bool HasPendingEvents
|
||||
{
|
||||
get {
|
||||
return g_main_context_pending (handle);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern void g_main_context_wakeup (IntPtr raw);
|
||||
|
||||
public void Wakeup ()
|
||||
{
|
||||
g_main_context_wakeup (handle);
|
||||
}
|
||||
|
||||
|
||||
public override bool Equals (object o)
|
||||
{
|
||||
if (!(o is MainContext))
|
||||
return false;
|
||||
|
||||
return Handle == (o as MainContext).Handle;
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return Handle.GetHashCode ();
|
||||
}
|
||||
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern int g_main_depth ();
|
||||
public static int Depth {
|
||||
get { return g_main_depth (); }
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern bool g_main_context_iteration (IntPtr Raw, bool MayBlock);
|
||||
|
||||
public static bool Iteration ()
|
||||
{
|
||||
return g_main_context_iteration (IntPtr.Zero, false);
|
||||
return Iteration (false);
|
||||
}
|
||||
|
||||
public static bool Iteration (bool MayBlock)
|
||||
public static bool Iteration (bool may_block)
|
||||
{
|
||||
return g_main_context_iteration (IntPtr.Zero, MayBlock);
|
||||
return Default.RunIteration (may_block);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern bool g_main_context_pending (IntPtr Raw);
|
||||
|
||||
public static bool Pending ()
|
||||
{
|
||||
return g_main_context_pending (IntPtr.Zero);
|
||||
return Default.HasPendingEvents;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,13 @@ namespace GLib {
|
|||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern IntPtr g_main_loop_new (IntPtr context, bool isRunning);
|
||||
|
||||
public MainLoop ()
|
||||
public MainLoop () : this (MainContext.Default) { }
|
||||
|
||||
public MainLoop (MainContext context) : this (context, false) { }
|
||||
|
||||
public MainLoop (MainContext context, bool is_running)
|
||||
{
|
||||
handle = g_main_loop_new (IntPtr.Zero, false);
|
||||
handle = g_main_loop_new (context.Handle, is_running);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
|
@ -66,6 +70,29 @@ namespace GLib {
|
|||
{
|
||||
g_main_loop_quit (handle);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern IntPtr g_main_loop_get_context (IntPtr loop);
|
||||
|
||||
public MainContext Context {
|
||||
get {
|
||||
return new MainContext (g_main_loop_get_context (handle));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override bool Equals (object o)
|
||||
{
|
||||
if (!(o is MainLoop))
|
||||
return false;
|
||||
|
||||
return handle == (o as MainLoop).handle;
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return handle.GetHashCode ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue