Example #1
0
        internal unsafe static void Setup(Process aParent)
        {
            Server = new Pipe(PACKET_SIZE, 1000);

            Clients     = new IList <Pipe>();
            Windows     = new IList <Window>();
            Stacking    = new IList <Window>();
            RedrawRects = new IQueue <uint>();

            /* Mouse Surfaces */
            MouseIdleSurface = Cairo.ImageSurfaceFromPng(Marshal.C_String("disk0/cursor_idle.png"));
            MouseHelpSurface = Cairo.ImageSurfaceFromPng(Marshal.C_String("disk0/cursor_help.png"));
            MouseClipSurface = Cairo.ImageSurfaceFromPng(Marshal.C_String("disk0/cursor_clip.png"));
            MouseSurface     = MouseIdleSurface;

            int stride = Cairo.FormatStrideForWidth(VBE.Xres, ColorFormat.ARGB32);

            MainSurface  = Cairo.ImageSurfaceCreateForData(stride, VBE.Yres, VBE.Xres, ColorFormat.ARGB32, VBE.SecondaryBuffer);
            VideoSurface = Cairo.ImageSurfaceCreateForData(stride, VBE.Yres, VBE.Xres, ColorFormat.ARGB32, VBE.VirtualFrameBuffer);

            MainContext  = Cairo.Create(MainSurface);
            VideoContext = Cairo.Create(VideoSurface);

            new Thread(aParent, HandleRequest).Start();
            new Thread(aParent, HandleMouse).Start();
            new Thread(aParent, Renderer).Start();
        }
Example #2
0
        private static void Desktop()
        {
            var Data    = new byte[Compositor.PACKET_SIZE];
            var Request = (GuiRequest *)Data.GetDataOffset();

            Request->ClientID = 0;
            Request->Type     = RequestType.NewWindow;

            var Window = (NewWindow *)Request;

            Window->X      = 0;
            Window->Y      = 0;
            Window->Width  = VBE.Xres;
            Window->Height = VBE.Yres;

            Compositor.Server.Write(Data);
            Client.Read(Data);

            string HashCode = new string(Window->Buffer);
            var    aBuffer  = SHM.Obtain(HashCode, 0, false);

            DesktopID = Window->WindowID;

            uint surface = Cairo.ImageSurfaceCreateForData(Window->Width * 4, Window->Height, Window->Width, ColorFormat.ARGB32, aBuffer);
            uint context = Cairo.Create(surface);

            uint wallpaper = Cairo.ImageSurfaceFromPng(Marshal.C_String("disk0/wallpaper.png"));

            Cairo.SetSourceSurface(0, 0, wallpaper, context);
            Cairo.Paint(context);
            Cairo.SurfaceDestroy(wallpaper);

            Request->Type = RequestType.Redraw;
            var Redraw = (Redraw *)Request;

            Redraw->WindowID = DesktopID;
            Redraw->X        = 0;
            Redraw->Y        = 0;
            Redraw->Width    = VBE.Xres;
            Redraw->Height   = VBE.Yres;
            Compositor.Server.Write(Data);

            DesktopSurface = surface;
            DesktopContext = context;
            Heap.Free(Data);
        }