mirror / libX11

Xlib/libX11 mirror
http://www.x.org/releases/current/doc/libX11/libX11/libX11.html
Other
161 stars 62 forks source link

Very complicated with multiple shapes ( XArc, XRectangle, XLine, XPoint and XSegment etc ) #2

Open DeafMan1983 opened 4 years ago

DeafMan1983 commented 4 years ago

Hello everyone,

I have big problem if I am C# developer and I really want know how do I get successful method via DLLImport example:

[DllImport("libX11.so.6")]
extern public static void XDrawArcs(IntPtr display, IntPtr drawable, IntPtr gc, ref XArc[] arcs, int number_arcs);

But It can't show drawing to window/drawable. I have tried with pointer like XArc* or XArc with out or ref = no success.

I think It seems wrong with "*" Please fix with []

But I have workaround with multiple XDrawArc() = It is ok. Like I have made. But it looks unfair because I don't like to scam about wrong and legacy method like this:

        public static void XDrawArcs(IntPtr display, IntPtr drawable, IntPtr gc, XArc[] arcs, int number_arcs)
        {
            if (number_arcs == -1 || number_arcs < 0)
            {
                throw new IndexOutOfRangeException("Error: Index is out of range");
            }

            for (int i = 0; i < number_arcs; i++)
            {
                // Pick up from public method of XDrawArc(...)
                XDrawArc(display, drawable, gc, arcs[i].x, arcs[i].y,
                    arcs[i].width, arcs[i].height, arcs[i].angle1, arcs[i].angle2);
            }
        }

It is like not fair. How do I wish trusted method from DLL ( so file for Linux )

Does it work possible for next version with XArc[] better than XArc* If you would like try with DLLImport of Mono Runtime.

Thanks for fixing next version of XLib/X11