mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-26 04:45:37 +00:00
0c857a906c
* gdk/Gdk.metadata : hide Property.Get for manual impl. * gdk/Property.custom : manually marshal the data param in Get. svn path=/trunk/gtk-sharp/; revision=80684
51 lines
2.6 KiB
Plaintext
51 lines
2.6 KiB
Plaintext
// Gdk.Property.custom - Custom implementation for Property class
|
|
//
|
|
// Authors: Mike Kestner <mkestner@novell.com>
|
|
//
|
|
// Copyright (c) 2007 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.
|
|
|
|
|
|
[DllImport("libgdk-win32-2.0-0.dll")]
|
|
static extern void gdk_property_change(IntPtr window, IntPtr property, IntPtr type, int format, int mode, out byte data, int nelements);
|
|
|
|
[Obsolete ("Replaced by corrected overload with data parameter")]
|
|
public static byte Change(Gdk.Window window, Gdk.Atom property, Gdk.Atom type, int format, Gdk.PropMode mode, int nelements) {
|
|
byte data;
|
|
gdk_property_change(window == null ? IntPtr.Zero : window.Handle, property == null ? IntPtr.Zero : property.Handle, type == null ? IntPtr.Zero : type.Handle, format, (int) mode, out data, nelements);
|
|
return data;
|
|
}
|
|
|
|
[DllImport("libgdk-win32-2.0-0.dll")]
|
|
static extern bool gdk_property_get(IntPtr window, IntPtr property, IntPtr type, UIntPtr offset, UIntPtr length, int pdelete, out IntPtr actual_property_type, out int actual_format, out int actual_length, out IntPtr data);
|
|
|
|
public static bool Get(Gdk.Window window, Gdk.Atom property, Gdk.Atom type, ulong offset, ulong length, int pdelete, out Gdk.Atom actual_property_type, out int actual_format, out int actual_length, out byte[] data) {
|
|
IntPtr actual_property_type_as_native;
|
|
IntPtr actual_data;
|
|
bool raw_ret = gdk_property_get(window == null ? IntPtr.Zero : window.Handle, property == null ? IntPtr.Zero : property.Handle, type == null ? IntPtr.Zero : type.Handle, new UIntPtr (offset), new UIntPtr (length), pdelete, out actual_property_type_as_native, out actual_format, out actual_length, out actual_data);
|
|
data = null;
|
|
if (raw_ret) {
|
|
data = new byte [actual_length];
|
|
Marshal.Copy (actual_data, data, 0, actual_length);
|
|
GLib.Marshaller.Free (actual_data);
|
|
}
|
|
|
|
bool ret = raw_ret;
|
|
actual_property_type = actual_property_type_as_native == IntPtr.Zero ? null : (Gdk.Atom) GLib.Opaque.GetOpaque (actual_property_type_as_native, typeof (Gdk.Atom), false);
|
|
return ret;
|
|
}
|
|
|