public static Surface CreateSurface(Gdk.Drawable d)
        {
            int width, height;

            d.GetSize(out width, out height);
            XlibSurface surface = new XlibSurface(GdkUtils.GetXDisplay(d.Display),
                                                  (IntPtr)GdkUtils.GetXid(d),
                                                  GdkUtils.GetXVisual(d.Visual),
                                                  width, height);

            return(surface);
        }
        public static void SetSourceDrawable(Context ctx, Gdk.Drawable d, double x, double y)
        {
            try {
                gdk_cairo_set_source_pixmap(ctx.Handle, d.Handle, x, y);
            } catch (EntryPointNotFoundException) {
                int width, height;
                d.GetSize(out width, out height);
                XlibSurface surface = new XlibSurface(GdkUtils.GetXDisplay(d.Display),
                                                      (IntPtr)GdkUtils.GetXid(d),
                                                      GdkUtils.GetXVisual(d.Visual),
                                                      width, height);

                SurfacePattern p = new SurfacePattern(surface);
                Matrix         m = new Matrix();
                m.Translate(-x, -y);
                p.Matrix   = m;
                ctx.Source = p;
            }
        }