From a39a739bcae1991085fd640564629b54a978e3e2 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Sun, 16 Nov 2008 04:39:23 +0000 Subject: [PATCH] 2008-11-15 Mike Kestner * gdk/Event.cs: add EventOwnerChange to GetEvent. * gdk/EventOwnerChange.cs: manual subclass of Gdk.Event. * gdk/Gdk.metadata: hide EventOwnerChange. * gdk/Makefile.am: add EventOwnerChange.cs. * gdk/gdk-symbols.xml: add EventOwnerChange. svn path=/trunk/gtk-sharp/; revision=118953 --- ChangeLog | 8 ++++ gdk/Event.cs | 4 ++ gdk/EventOwnerChange.cs | 95 +++++++++++++++++++++++++++++++++++++++++ gdk/Gdk.metadata | 1 + gdk/Makefile.am | 1 + gdk/gdk-symbols.xml | 1 + 6 files changed, 110 insertions(+) create mode 100644 gdk/EventOwnerChange.cs diff --git a/ChangeLog b/ChangeLog index cdf211306..2a83e89e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-11-15 Mike Kestner + + * gdk/Event.cs: add EventOwnerChange to GetEvent. + * gdk/EventOwnerChange.cs: manual subclass of Gdk.Event. + * gdk/Gdk.metadata: hide EventOwnerChange. + * gdk/Makefile.am: add EventOwnerChange.cs. + * gdk/gdk-symbols.xml: add EventOwnerChange. + 2008-11-15 Mike Kestner * gtk/Gtk.metadata: mark the SpinButton::Output signal as manually diff --git a/gdk/Event.cs b/gdk/Event.cs index 14ccee8e2..5d80f748b 100644 --- a/gdk/Event.cs +++ b/gdk/Event.cs @@ -133,6 +133,10 @@ namespace Gdk { return new EventWindowState (raw); case EventType.Setting: return new EventSetting (raw); +#if GTK_SHARP_2_6 + case EventType.OwnerChange: + return new EventOwnerChange (raw); +#endif #if GTK_SHARP_2_8 case EventType.GrabBroken: return new EventGrabBroken (raw); diff --git a/gdk/EventOwnerChange.cs b/gdk/EventOwnerChange.cs new file mode 100644 index 000000000..e2aafd992 --- /dev/null +++ b/gdk/EventOwnerChange.cs @@ -0,0 +1,95 @@ +// Gdk.EventOwnerChange.cs - Custom OwnerChange event wrapper +// +// Author: Mike Kestner +// +// Copyright (c) 2008 Novell, Inc. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the Lesser GNU General +// Public License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + + +namespace Gdk { + + using System; + using System.Runtime.InteropServices; + + public class EventOwnerChange : Event { + + public EventOwnerChange (IntPtr handle) : base (handle) {} + + struct NativeStruct { + public Gdk.EventType type; + public IntPtr window; + public sbyte send_event; + public uint owner; + public Gdk.OwnerChange reason; + public IntPtr selection; + public uint time; + public uint selection_time; + } + + NativeStruct Native { + get { return (NativeStruct) Marshal.PtrToStructure (Handle, typeof (NativeStruct)); } + } + + public uint Owner { + get { return Native.owner; } + set { + NativeStruct native = Native; + native.owner = value; + Marshal.StructureToPtr (native, Handle, false); + } + } + + public OwnerChange Reason { + get { return Native.reason; } + set { + NativeStruct native = Native; + native.reason = value; + Marshal.StructureToPtr (native, Handle, false); + } + } + + public Gdk.Atom Selection { + get { + IntPtr sel = Native.selection; + return sel == IntPtr.Zero ? null : (Gdk.Atom) GLib.Opaque.GetOpaque (sel, typeof (Gdk.Atom), false); + } + set { + NativeStruct native = Native; + native.selection = value == null ? IntPtr.Zero : value.Handle; + Marshal.StructureToPtr (native, Handle, false); + } + } + + public uint Time { + get { return Native.time; } + set { + NativeStruct native = Native; + native.time = value; + Marshal.StructureToPtr (native, Handle, false); + } + } + + public uint SelectionTime { + get { return Native.selection_time; } + set { + NativeStruct native = Native; + native.selection_time = value; + Marshal.StructureToPtr (native, Handle, false); + } + } + } +} + diff --git a/gdk/Gdk.metadata b/gdk/Gdk.metadata index 22c9ede61..45598b7ec 100644 --- a/gdk/Gdk.metadata +++ b/gdk/Gdk.metadata @@ -177,6 +177,7 @@ 1 1 1 + 1 1 1 1 diff --git a/gdk/Makefile.am b/gdk/Makefile.am index f74b3ce7e..43175cbc0 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -25,6 +25,7 @@ sources = \ EventGrabBroken.cs \ EventKey.cs \ EventMotion.cs \ + EventOwnerChange.cs \ EventProperty.cs \ EventProximity.cs \ EventScroll.cs \ diff --git a/gdk/gdk-symbols.xml b/gdk/gdk-symbols.xml index 9693f883e..3d3d23020 100644 --- a/gdk/gdk-symbols.xml +++ b/gdk/gdk-symbols.xml @@ -19,6 +19,7 @@ +