2005-01-11 Mike Kestner <mkestner@novell.com>

* gdk/Window.custom : add AddFilterForAll and RemoveFilterForAll
	methods to handle the window==null native case.
	[Fixes #71065]

svn path=/trunk/gtk-sharp/; revision=38730
This commit is contained in:
Mike Kestner 2005-01-11 20:52:52 +00:00
parent b6b39dbbfe
commit 81c7552808
3 changed files with 62 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2005-01-11 Mike Kestner <mkestner@novell.com>
* gdk/Window.custom : add AddFilterForAll and RemoveFilterForAll
methods to handle the window==null native case.
[Fixes #71065]
2005-01-11 Mike Kestner <mkestner@novell.com>
* glib/Argv.cs : add automatic progname handling.

View file

@ -1946,5 +1946,35 @@ The color must be allocated;
<remarks>Area includes window manager titlebar/borders if any. The frame position is given in root window coordinates. To get the position of the window itself (rather than the frame) in root window coordinates, use <see cref="M:Gdk.Window.GetOrigin" />.</remarks>
</Docs>
</Member>
<Member MemberName="AddFilterForAll">
<MemberSignature Language="C#" Value="public static void AddFilterForAll (Gdk.FilterFunc func);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="func" Type="Gdk.FilterFunc" />
</Parameters>
<Docs>
<summary>Adds an event filtering function for all Windows.</summary>
<param name="func">a <see cref="T:Gdk.FilterFunc" /></param>
<remarks>It is possible to do significant damage to Gdk's built in event processing using this capability if used improperly.</remarks>
</Docs>
</Member>
<Member MemberName="RemoveFilterForAll">
<MemberSignature Language="C#" Value="public static void RemoveFilterForAll (Gdk.FilterFunc func);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="func" Type="Gdk.FilterFunc" />
</Parameters>
<Docs>
<summary>Removes an event filtering function for all Windows.</summary>
<param name="func">a <see cref="T:Gdk.FilterFunc" /></param>
<remarks />
</Docs>
</Member>
</Members>
</Type>
</Type>

View file

@ -104,6 +104,31 @@
}
}
static Hashtable filter_all_hash;
static Hashtable FilterAllHash {
get {
if (filter_all_hash == null)
filter_all_hash = new Hashtable ();
return filter_all_hash;
}
}
public static void AddFilterForAll (FilterFunc func)
{
GdkSharp.FilterFuncWrapper wrapper = new GdkSharp.FilterFuncWrapper (func, null);
FilterAllHash [func] = wrapper;
gdk_window_add_filter (IntPtr.Zero, wrapper.NativeDelegate, IntPtr.Zero);
}
public static void RemoveFilterForAll (FilterFunc func)
{
GdkSharp.FilterFuncWrapper wrapper = FilterAllHash [func] as GdkSharp.FilterFuncWrapper;
if (wrapper == null)
return;
FilterAllHash.Remove (func);
gdk_window_remove_filter (IntPtr.Zero, wrapper.NativeDelegate, IntPtr.Zero);
}
#if MANLY_ENOUGH_TO_INCLUDE
public Cairo.Graphics CairoGraphics (out int offset_x, out int offset_y)
{