Examples of NativeLong


Examples of com.sun.jna.NativeLong

    }

    public static int munmap(Pointer addr, long len) throws IOException {

        int result = Delegate.munmap(addr, new NativeLong(len));

        if(result != 0) {
            if(logger.isDebugEnabled())
                logger.debug(errno.strerror());
        }
View Full Code Here

Examples of com.sun.jna.NativeLong

    }

    public static void mlock(Pointer addr, long len) throws IOException {

        int res = Delegate.mlock(addr, new NativeLong(len));
        if(res != 0) {
            if(logger.isDebugEnabled()) {
                logger.debug("Mlock failed probably because of insufficient privileges, errno:"
                             + errno.strerror() + ", return value:" + res);
            }
View Full Code Here

Examples of com.sun.jna.NativeLong

    /**
     * Unlock the given region, throw an IOException if we fail.
     */
    public static void munlock(Pointer addr, long len) throws IOException {

        if(Delegate.munlock(addr, new NativeLong(len)) != 0) {
            if(logger.isDebugEnabled())
                logger.debug("munlocking failed with errno:" + errno.strerror());
        } else {
            if(logger.isDebugEnabled())
                logger.debug("munlocking region");
View Full Code Here

Examples of com.sun.jna.NativeLong

        }
    }
    class AtomByReference extends ByReference {
        public AtomByReference() { super(XID.SIZE); }
        public Atom getValue() {
            NativeLong value = getPointer().getNativeLong(0);
            return (Atom)new Atom().fromNative(value, null);
        }
View Full Code Here

Examples of com.sun.jna.NativeLong

        }
    }
    class WindowByReference extends ByReference {
        public WindowByReference() { super(XID.SIZE); }
        public Window getValue() {
            NativeLong value = getPointer().getNativeLong(0);
            return value.longValue() == X11.None ? Window.None : new Window(value.longValue());
        }
View Full Code Here

Examples of com.sun.jna.NativeLong

        }
    }
    class AtomByReference extends ByReference {
        public AtomByReference() { super(XID.SIZE); }
        public Atom getValue() {
            NativeLong value = getPointer().getNativeLong(0);
            return (Atom)new Atom().fromNative(value, null);
        }
View Full Code Here

Examples of com.sun.jna.NativeLong

        }
    }
    class WindowByReference extends ByReference {
        public WindowByReference() { super(XID.SIZE); }
        public Window getValue() {
            NativeLong value = getPointer().getNativeLong(0);
            return value.longValue() == X11.None
                ? Window.None : new Window(value.longValue());
        }
View Full Code Here

Examples of com.sun.jna.NativeLong

    // TODO: define structure
    class Visual extends PointerType {
        public NativeLong getVisualID() {
            if (getPointer() != null)
                return getPointer().getNativeLong(Native.POINTER_SIZE);
            return new NativeLong(0);
        }
View Full Code Here

Examples of com.sun.jna.NativeLong

                                 double arg8, NativeLong arg9,
                                 NativeLong arg10, NativeLong arg11) {
                called[0] = true;
            }
        };
        int value = testlib.callBugCallback(cb, new NativeLong(1),
                                            2, 3, "four", "five",
                                            6, new NativeLong(7),
                                            8, new NativeLong(9),
                                            new NativeLong(10),
                                            new NativeLong(11));
        assertTrue("stdcall callback not called", called[0]);
        if (value == -1) {
            fail("stdcall callback did not restore the stack pointer");
        }
    }
View Full Code Here

Examples of com.sun.jna.NativeLong

            final X11 x11 = X11.INSTANCE;
            Rectangle bounds = raster.getBounds();
            int width = bounds.x + bounds.width;
            int height = bounds.y + bounds.height;
            final Pixmap pm = x11.XCreatePixmap(dpy, win, width, height, 1);
            final GC gc = x11.XCreateGC(dpy, pm, new NativeLong(0), null);
            if (gc == null) {
                return null;
            }
            x11.XSetForeground(dpy, gc, new NativeLong(0));
            x11.XFillRectangle(dpy, pm, gc, 0, 0, width, height);
            final List<Rectangle> rlist = new ArrayList<Rectangle>();
            try {
                RasterRangesUtils.outputOccupiedRanges(raster, new RasterRangesUtils.RangesOutput() {
                    public boolean outputRange(int x, int y, int w, int h) {
                        rlist.add(new Rectangle(x, y, w, h));
                        return true;
                    }
                });
                X11.XRectangle[] rects = (X11.XRectangle[])
                    new X11.XRectangle().toArray(rlist.size());
                for (int i=0;i < rects.length;i++) {
                    Rectangle r = rlist.get(i);
                    rects[i].x = (short)r.x;
                    rects[i].y = (short)r.y;
                    rects[i].width = (short)r.width;
                    rects[i].height = (short)r.height;
                    // Optimization: write directly to native memory
                    Pointer p = rects[i].getPointer();
                    p.setShort(0, (short)r.x);
                    p.setShort(2, (short)r.y);
                    p.setShort(4, (short)r.width);
                    p.setShort(6, (short)r.height);
                    rects[i].setAutoSynch(false);
                    // End optimization
                }
                final int UNMASKED = 1;
                x11.XSetForeground(dpy, gc, new NativeLong(UNMASKED));
                x11.XFillRectangles(dpy, pm, gc, rects, rects.length);
            }
            finally {
                x11.XFreeGC(dpy, gc);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.