gdk: Fix dll name and use a const for all DllImports in custom code

In Windows builds of GTK+ 3.x, the dll filename for GDK is
libgdk-3-0.dll.

We use this opportunity to use a common const in the DllImport for all
custom code.
This commit is contained in:
Bertrand Lorentz 2014-05-04 17:30:26 +02:00
parent 016891bb7a
commit 30f758d984
17 changed files with 47 additions and 43 deletions

View file

@ -35,7 +35,7 @@ namespace Gdk {
Pixel = 0;
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern uint gdk_color_hash(ref Gdk.Color raw);
public override int GetHashCode() {

View file

@ -25,10 +25,10 @@ namespace Gdk {
public partial class Device {
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_device_free_history(IntPtr events, int n_events);
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern bool gdk_device_get_history(IntPtr device, IntPtr window, uint start, uint stop, out IntPtr events, out int n_events);
public TimeCoord[] GetHistory (Gdk.Window window, uint start, uint stop)

View file

@ -26,7 +26,7 @@ namespace Gdk {
public partial class Display {
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_display_get_pointer(IntPtr raw, IntPtr screen, out int x, out int y, out int mask);
[Obsolete]
@ -36,7 +36,7 @@ namespace Gdk {
mask = (Gdk.ModifierType) mask_as_int;
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_display_get_pointer(IntPtr raw, out IntPtr screen, out int x, out int y, out int mask);
public void GetPointer(out Gdk.Screen screen, out int x, out int y, out Gdk.ModifierType mask) {
@ -66,7 +66,7 @@ namespace Gdk {
GetPointer (out screen, out x, out y, out mod);
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_display_list_devices (IntPtr raw);
public Device[] ListDevices ()

View file

@ -25,7 +25,7 @@ namespace Gdk {
public partial class DisplayManager {
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_display_manager_list_displays (IntPtr raw);
public Display[] ListDisplays ()

View file

@ -39,7 +39,7 @@ namespace Gdk {
get { return raw; }
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_event_get_type ();
public static GLib.GType GType {

View file

@ -26,7 +26,9 @@ namespace Gdk {
public partial class Global {
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
internal const string GdkNativeDll = "libgdk-3-0.dll";
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_list_visuals ();
public static Visual[] ListVisuals ()
@ -105,7 +107,7 @@ namespace Gdk {
}
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern bool gdk_init_check(ref int argc, ref IntPtr argv);
public static bool InitCheck (ref string[] argv)
@ -119,7 +121,7 @@ namespace Gdk {
return result;
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_parse_args(ref int argc, ref IntPtr argv);
public static void ParseArgs (ref string[] argv)
@ -132,7 +134,7 @@ namespace Gdk {
argv = a.GetArgs (argc);
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_query_depths (out IntPtr depths, out int n_depths);
public static int[] QueryDepths ()
@ -144,7 +146,7 @@ namespace Gdk {
Marshal.Copy (ptr, result, 0, count);
return result;
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_query_visual_types (out IntPtr types, out int n_types);
public static VisualType[] QueryVisualTypes ()

View file

@ -26,7 +26,7 @@ namespace Gdk {
public partial class Keymap {
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
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)
@ -51,7 +51,7 @@ namespace Gdk {
}
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
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)

View file

@ -26,7 +26,7 @@ namespace Gdk {
public partial class Property {
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
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")]
@ -36,7 +36,7 @@ namespace Gdk {
return data;
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern bool gdk_property_get(IntPtr window, IntPtr property, IntPtr type, UIntPtr offset, UIntPtr length, bool 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) {

View file

@ -219,7 +219,7 @@ namespace Gdk {
return Offset (rect, dr.X, dr.Y);
}
[DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport(Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_rectangle_get_type();
public static GLib.GType GType {
@ -230,7 +230,7 @@ namespace Gdk {
}
}
[DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport(Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_rectangle_union (ref Rectangle src1, ref Rectangle src2, out Rectangle dest);
public Gdk.Rectangle Union (Gdk.Rectangle src)
@ -240,7 +240,7 @@ namespace Gdk {
return dest;
}
[DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport(Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern bool gdk_rectangle_intersect (ref Rectangle src1, ref Rectangle src2, out Rectangle dest);
public bool Intersect (Gdk.Rectangle src, out Gdk.Rectangle dest)

View file

@ -25,7 +25,7 @@ namespace Gdk {
public partial class Screen {
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_screen_get_toplevel_windows (IntPtr raw);
public Window[] ToplevelWindows
@ -42,7 +42,7 @@ namespace Gdk {
}
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_screen_list_visuals (IntPtr raw);
public Visual[] ListVisuals ()
@ -57,10 +57,10 @@ namespace Gdk {
return result;
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_screen_get_font_options(IntPtr raw);
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_screen_set_font_options(IntPtr raw, IntPtr options);
[GLib.Property ("font-options")]

View file

@ -26,7 +26,7 @@ namespace Gdk {
public class TextProperty {
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern int gdk_text_property_to_utf8_list_for_display(IntPtr display, IntPtr encoding, int format, byte[] text, int length, out IntPtr list);
public static string[] ToStringListForDisplay (Gdk.Display display, Gdk.Atom encoding, int format, byte[] text, int length)

View file

@ -32,10 +32,10 @@ namespace Gdk {
public Window (Gdk.Window parent, Gdk.WindowAttr attributes, Gdk.WindowAttributesType attributes_mask) : this (parent, attributes, (int)attributes_mask) {}
[DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport(Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_window_get_background_pattern(IntPtr raw);
[DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport(Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_window_set_background_pattern(IntPtr raw, IntPtr pattern);
public Cairo.Pattern BackgroundPattern {
@ -49,7 +49,7 @@ namespace Gdk {
}
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_window_get_children(IntPtr raw);
public Window[] Children {
@ -65,7 +65,7 @@ namespace Gdk {
}
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_window_set_icon_list(IntPtr raw, IntPtr pixbufs);
public Pixbuf[] IconList {
@ -80,7 +80,7 @@ namespace Gdk {
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr g_object_ref (IntPtr raw);
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_window_destroy(IntPtr raw);
public void Destroy ()
@ -97,10 +97,10 @@ namespace Gdk {
gdk_window_move_resize (Handle, rect.X, rect.Y, rect.Width, rect.Height);
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_window_get_user_data (IntPtr raw, out IntPtr data);
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_window_set_user_data(IntPtr raw, IntPtr user_data);
public IntPtr UserData {
get {
@ -113,10 +113,10 @@ namespace Gdk {
}
}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_window_add_filter (IntPtr handle, GdkSharp.FilterFuncNative wrapper, IntPtr data);
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (Global.GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern void gdk_window_remove_filter (IntPtr handle, GdkSharp.FilterFuncNative wrapper, IntPtr data);
static IDictionary<FilterFunc, GdkSharp.FilterFuncWrapper> filter_all_hash;

View file

@ -6,7 +6,7 @@
Please DO NOT MODIFY THIS FILE, modify .metadata files instead.
-->
<namespace name="Gdk" library="libgdk-win32-3.0-0.dll">
<namespace name="Gdk" library="libgdk-3-0.dll">
<enum name="AxisUse" cname="GdkAxisUse" gtype="gdk_axis_use_get_type" type="enum">
<member cname="GDK_AXIS_IGNORE" name="Ignore" />
<member cname="GDK_AXIS_X" name="X" />

View file

@ -2,6 +2,6 @@
<dllmap dll="libgio-2.0-0.dll" target="libgio-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
<dllmap dll="libglib-2.0-0.dll" target="libglib-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
<dllmap dll="libgobject-2.0-0.dll" target="libgobject-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
<dllmap dll="libgdk-win32-3.0-0.dll" target="libgdk-3@LIB_PREFIX@.0@LIB_SUFFIX@"/>
<dllmap dll="libgdk-3-0.dll" target="libgdk-3@LIB_PREFIX@.0@LIB_SUFFIX@"/>
<dllmap dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
</configuration>

View file

@ -30,22 +30,24 @@ using System.Runtime.InteropServices;
namespace Gtk.DotNet {
public class Graphics {
private const string GdkNativeDll = "libgdk-3-0.dll";
private Graphics () {}
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr gdk_win32_drawable_get_handle(IntPtr raw);
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr gdk_win32_hdc_get(IntPtr drawable, IntPtr gc, int usage);
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
internal static extern void gdk_win32_hdc_release(IntPtr drawable,IntPtr gc,int usage);
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr gdk_x11_drawable_get_xdisplay (IntPtr raw);
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport (GdkNativeDll, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr gdk_x11_drawable_get_xid (IntPtr raw);
public static System.Drawing.Graphics FromDrawable (Gdk.Window drawable)

View file

@ -1,3 +1,3 @@
<configuration>
<dllmap dll="libgdk-win32-3.0-0.dll" target="libgdk-3@LIB_PREFIX@.0@LIB_SUFFIX@"/>
<dllmap dll="libgdk-3-0.dll" target="libgdk-3@LIB_PREFIX@.0@LIB_SUFFIX@"/>
</configuration>

View file

@ -89,7 +89,7 @@
</library>
</api>
<api filename="../gdk/gdk-api.raw">
<library name="libgdk-win32-3.0-0.dll">
<library name="libgdk-3-0.dll">
<namespace name="Gdk">
<directory path="gtk+-3.0.0/gdk">
<exclude>gdkalias.h</exclude>