diff --git a/ChangeLog b/ChangeLog index 8c0700a4a..08e49b7ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-09-14 Mike Kestner + + * gdk/* : remaining API audit fixes. + 2004-09-09 Mike Kestner * gdk/Device.custom : manual GetHistory impl. diff --git a/gdk/Gdk.metadata b/gdk/Gdk.metadata index f676498fe..a2eaf78c9 100644 --- a/gdk/Gdk.metadata +++ b/gdk/Gdk.metadata @@ -12,11 +12,16 @@ 1 out out + 1 EventHelper const-gchar* 1 1 + 1 1 + 1 + 1 + 1 PangoHelper 1 1 @@ -24,6 +29,8 @@ out out 1 + 1 + 1 1 InputOutput InputOnly @@ -51,6 +58,8 @@ 1 1 out + 1 + 1 1 1 1 @@ -79,8 +88,10 @@ 1 out out + gchar* out out + gchar* out 1 1 @@ -123,6 +134,7 @@ 1 1 1 + 1 1 1 out diff --git a/gdk/Global.custom b/gdk/Global.custom index f8176d308..306ffea60 100644 --- a/gdk/Global.custom +++ b/gdk/Global.custom @@ -135,3 +135,55 @@ return workareas; } } + + [DllImport("libgdk-win32-2.0-0.dll")] + static extern bool gdk_init_check(ref int argc, ref IntPtr argv); + + public static bool InitCheck (ref string[] argv) + { + IntPtr ptr = GLib.Marshaller.ArgvToArrayPtr (argv); + int count = argv.Length; + bool result = gdk_init_check (ref count, ref ptr); + argv = GLib.Marshaller.ArrayPtrToArgv (ptr, count); + return result; + } + + [DllImport("libgdk-win32-2.0-0.dll")] + static extern void gdk_parse_args(ref int argc, ref IntPtr argv); + + public static void ParseArgs (ref string[] argv) + { + IntPtr ptr = GLib.Marshaller.ArgvToArrayPtr (argv); + int count = argv.Length; + gdk_parse_args (ref count, ref ptr); + argv = GLib.Marshaller.ArrayPtrToArgv (ptr, count); + } + + [DllImport("libgdk-win32-2.0-0.dll")] + static extern void gdk_query_depths (out IntPtr depths, out int n_depths); + + public static int[] QueryDepths () + { + IntPtr ptr; + int count; + gdk_query_depths (out ptr, out count); + int[] result = new int [count]; + Marshal.Copy (ptr, result, 0, count); + return result; + } + [DllImport("libgdk-win32-2.0-0.dll")] + static extern void gdk_query_visual_types (out IntPtr types, out int n_types); + + public static VisualType[] QueryVisualTypes () + { + IntPtr ptr; + int count; + gdk_query_visual_types (out ptr, out count); + int[] tmp = new int [count]; + Marshal.Copy (ptr, tmp, 0, count); + VisualType[] result = new VisualType [count]; + for (int i = 0; i < count; i++) + result [i] = (VisualType) tmp [i]; + return result; + } + diff --git a/gdk/Keymap.custom b/gdk/Keymap.custom new file mode 100644 index 000000000..701e5ba11 --- /dev/null +++ b/gdk/Keymap.custom @@ -0,0 +1,68 @@ +// Keymap.custom - customizations to Gdk.Keymap +// +// Authors: Mike Kestner +// +// Copyright (c) 2004 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("libglib-2.0-0.dll")] + static extern void g_free(IntPtr ptr); + + [DllImport("libgdk-win32-2.0-0.dll")] + static extern bool gdk_keymap_get_entries_for_keycode(IntPtr raw, uint hardware_keycode, out IntPtr keys, out IntPtr keyvals, out int n_entries); + + public void GetEntriesForKeycode(uint hardware_keycode, out Gdk.KeymapKey[] keys, out uint[] keyvals) + { + IntPtr key_ptr, keyval_ptr; + int count; + if (gdk_keymap_get_entries_for_keycode(Handle, hardware_keycode, out key_ptr, out keyval_ptr, out count)) { + keys = new KeymapKey [count]; + keyvals = new uint [count]; + int[] tmp = new int [count]; + Marshal.Copy (keyval_ptr, tmp, 0, count); + for (int i = 0; i < count; i++) { + IntPtr ptr = new IntPtr ((long) key_ptr + i * Marshal.SizeOf (typeof (KeymapKey))); + keyvals [i] = (uint) tmp [i]; + keys [i] = KeymapKey.New (ptr); + } + g_free (key_ptr); + g_free (keyval_ptr); + } else { + keys = new KeymapKey [0]; + keyvals = new uint [0]; + } + } + + [DllImport("libgdk-win32-2.0-0.dll")] + static extern bool gdk_keymap_get_entries_for_keyval(IntPtr raw, uint keyval, out IntPtr keys, out int n_keys); + + public KeymapKey[] GetEntriesForKeyval (uint keyval) + { + IntPtr key_ptr; + int count; + if (gdk_keymap_get_entries_for_keyval(Handle, keyval, out key_ptr, out count)) { + KeymapKey[] result = new KeymapKey [count]; + for (int i = 0; i < count; i++) { + IntPtr ptr = new IntPtr ((long) key_ptr + i * Marshal.SizeOf (typeof (KeymapKey))); + result [i] = KeymapKey.New (ptr); + } + g_free (key_ptr); + return result; + } else + return new KeymapKey [0]; + } + diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 165734963..a16b2671e 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -50,6 +50,7 @@ customs = \ DragContext.custom \ Drawable.custom \ Global.custom \ + Keymap.custom \ Pixbuf.custom \ PixbufLoader.custom \ Pixdata.custom \