Пример #1
0
        public Gdk.Colormap GetColormap(Gdk.Screen screen, )
        {
            DrawableFormat template = new DrawableFormat();

            template.Color = new ColorFormat();
            FormatMask mask = FormatMask.None;
            int        num  = screen.Number;

            IntPtr dformat = GlitzAPI.glitz_glx_find_window_format(GdkUtils.GetXDisplay(screen.Display),
                                                                   num,
                                                                   mask,
                                                                   ref template,
                                                                   0);

            visual_info = GlitzAPI.glitz_glx_get_visual_info_from_format(dpy, scr, dformat);
            Gdk.Visual visual = new Gdk.Visual(gdkx_visual_get(XVisualIDFromVisual(vinfo)));
            new Gdk.Colormap(visual, true);
            * /
        }
Пример #2
0
		public Gdk.Colormap GetColormap (Gdk.Screen screen, )
		{
			DrawableFormat template = new DrawableFormat ();
			template.Color = new ColorFormat ();
			FormatMask mask = FormatMask.None;
			int num = screen.Number;
			
			IntPtr dformat = GlitzAPI.glitz_glx_find_window_format (GdkUtils.GetXDisplay (screen.Display), 
										num, 
										mask, 
										ref template,
										0);
			
			visual_info = GlitzAPI.glitz_glx_get_visual_info_from_format (dpy, scr, dformat);
			Gdk.Visual visual = new Gdk.Visual (gdkx_visual_get (XVisualIDFromVisual (vinfo)));					
			new Gdk.Colormap (visual, true);
			*/
		}
Пример #3
0
    public static Cairo.Surface Realize(Widget widget)
    {
        IntPtr dpy = gdk_x11_get_default_xdisplay();
        int    scr = gdk_x11_get_default_screen();

        DrawableFormat template = new DrawableFormat();

        template.Color = new ColorFormat();
        FormatMask mask = FormatMask.None;
        //template.Doublebuffer = doublebuffer;
        //mask |= FormatMask.Doublebuffer;
        IntPtr dformat = GlitzAPI.glitz_glx_find_window_format(dpy, scr, mask, ref template, 0);

        if (dformat == IntPtr.Zero)
        {
            throw new Exception("Could not find a usable GL visual");
        }

        IntPtr vinfo = GlitzAPI.glitz_glx_get_visual_info_from_format(dpy, scr, dformat);

        widget.DoubleBuffered = false;

        Gdk.WindowAttr attributes = new Gdk.WindowAttr();
        attributes.Mask = widget.Events |
                          (Gdk.EventMask.ExposureMask |
                           Gdk.EventMask.KeyPressMask |
                           Gdk.EventMask.KeyReleaseMask |
                           Gdk.EventMask.EnterNotifyMask |
                           Gdk.EventMask.LeaveNotifyMask |
                           Gdk.EventMask.StructureMask);
        //attributes.X = widget.Allocation.X;
        //attributes.Y = widget.Allocation.Y;
        attributes.X          = 0;
        attributes.Y          = 0;
        attributes.Width      = 100;
        attributes.Height     = 100;
        attributes.Wclass     = Gdk.WindowClass.InputOutput;
        attributes.Visual     = new Gdk.Visual(gdkx_visual_get(XVisualIDFromVisual(vinfo)));
        attributes.Colormap   = new Gdk.Colormap(attributes.Visual, true);
        attributes.WindowType = Gdk.WindowType.Child;
        Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Visual | Gdk.WindowAttributesType.Colormap;

        widget.GdkWindow          = new Gdk.Window(widget.ParentWindow, attributes, attributes_mask);
        widget.GdkWindow.UserData = widget.Handle;
        uint xid = gdk_x11_drawable_get_xid(widget.GdkWindow.Handle);

        attributes.Width  = 100;
        attributes.Height = 100;

        IntPtr glitz_drawable = GlitzAPI.glitz_glx_create_drawable_for_window(dpy, scr, dformat, xid, (uint)attributes.Width, (uint)attributes.Height);

        ggd = new NDesk.Glitz.Drawable(glitz_drawable);

        IntPtr glitz_format = ggd.FindStandardFormat(FormatName.ARGB32);

        ggs = new NDesk.Glitz.Surface(ggd, glitz_format, (uint)attributes.Width, (uint)attributes.Height, 0, IntPtr.Zero);
        Console.WriteLine(ggd.Features);
        ggs.Attach(ggd, doublebuffer ? DrawableBuffer.BackColor : DrawableBuffer.FrontColor);

        //GlitzAPI.glitz_drawable_destroy (glitz_drawable);

        GlitzSurface gs = new GlitzSurface(ggs.Handle);

        return(gs);
    }