3
using System.Runtime.InteropServices;
5
namespace FSpot.Utils {
6
public class GdkUtils {
10
[DllImport("libgdk-2.0-0.dll")]
11
public static extern uint gdk_x11_drawable_get_xid (IntPtr d);
13
[DllImport("libgdk-2.0-0.dll")]
14
public static extern IntPtr gdk_x11_display_get_xdisplay (IntPtr d);
16
[DllImport("libgdk-2.0-0.dll")]
17
public static extern IntPtr gdk_x11_visual_get_xvisual (IntPtr d);
20
public static extern uint XVisualIDFromVisual(IntPtr visual);
22
[DllImport("libgdk-2.0-0.dll")]
23
public static extern IntPtr gdk_x11_screen_lookup_visual (IntPtr screen,
27
public static uint GetXid (Drawable d)
29
return NativeMethods.gdk_x11_drawable_get_xid (d.Handle);
32
public static uint GetXVisualId (Visual visual)
34
return NativeMethods.XVisualIDFromVisual (GetXVisual (visual));
37
public static IntPtr GetXDisplay (Display display)
39
return NativeMethods.gdk_x11_display_get_xdisplay (display.Handle);
42
public static IntPtr GetXVisual (Visual v)
44
return NativeMethods.gdk_x11_visual_get_xvisual (v.Handle);
47
public static Visual LookupVisual (Screen screen, uint visualid)
49
return (Gdk.Visual) GLib.Object.GetObject (NativeMethods.gdk_x11_screen_lookup_visual (screen.Handle, visualid));
52
public static Cursor CreateEmptyCursor (Display display)
55
Gdk.Pixbuf empty = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 1, 1);
56
empty.Fill (0x00000000);
57
return new Gdk.Cursor (display, empty, 0, 0);
58
} catch (System.Exception e){