Ejemplo n.º 1
0
        public void Init()
        {
            LibX11.XInitThreads();
            display = LibX11.XOpenDisplay(null);
            if (display == IntPtr.Zero)
            {
                throw new InvalidOperationException("Cannot open display.");
            }

            WM_PROTOCOLS               = LibX11.XInternAtom(display, "WM_PROTOCOLS", 0);
            WM_DELETE_WINDOW           = LibX11.XInternAtom(display, "WM_DELETE_WINDOW", 0);
            XA_NWINDOWS_PAINT_COMPLETE = LibX11.XInternAtom(display, "NWINDOWS_PAINT_COMPLETE", 0);

            graphics   = X11Graphics.Create(display);
            imageCodec = new GdkPixBufImageCodec(display, graphics.Visual, graphics.RootWindow);
            clipboard  = X11Clipboard.Create();
        }
Ejemplo n.º 2
0
        public static bool IsAvailable()
        {
            try
            {
                LibX11.XInitThreads();
                IntPtr display = LibX11.XOpenDisplay(null);
                if (display == IntPtr.Zero)
                {
                    return(false);
                }

                LibX11.XCloseDisplay(display);
                return(true);
            }
            catch (DllNotFoundException)
            {
                return(false);
            }
            catch (EntryPointNotFoundException)
            {
                return(false);
            }
        }