Package org.apache.harmony.awt.nativebridge

Examples of org.apache.harmony.awt.nativebridge.Int32Pointer


    /**
     * @see org.apache.harmony.awt.wtk.NativeWindow#getScreenPos()
     */
    public Point getScreenPos() {

        Int32Pointer x = bridge.createInt32Pointer(1, false);
        Int32Pointer y = bridge.createInt32Pointer(1, false);
        Int32Pointer w = bridge.createInt32Pointer(1, false);
        Int32Pointer h = bridge.createInt32Pointer(1, false);
        CLongPointer root = bridge.createCLongPointer(1, false);
        Int32Pointer border = bridge.createInt32Pointer(1, false);
        Int32Pointer depth = bridge.createInt32Pointer(1, false);

        x11.XGetGeometry(display, windowID, root, x, y, w, h, border, depth);
        long rootID = root.get(0);

        CLongPointer childWindow = bridge.createCLongPointer(1, false);
View Full Code Here


     * @see org.apache.harmony.awt.wtk.WindowFactory#getWindowFromPoint(java.awt.Point)
     */
    public NativeWindow getWindowFromPoint(Point p) {
        long rootID = getRootWindow();
        long childID = rootID;
        Int32Pointer x = bridge.createInt32Pointer(1, false);
        Int32Pointer y = bridge.createInt32Pointer(1, false);
        CLongPointer childWindow = bridge.createCLongPointer(1, false);

        //recursevily ask for child containing p
        //until the deepest child is found
        //or until our top-level window is found
View Full Code Here

    /**
     * @see org.apache.harmony.awt.wtk.WindowFactory#getWindowSizeById(long)
     */
    public Dimension getWindowSizeById(long id) {
        Int32Pointer x = bridge.createInt32Pointer(1, false);
        Int32Pointer y = bridge.createInt32Pointer(1, false);
        Int32Pointer w = bridge.createInt32Pointer(1, false);
        Int32Pointer h = bridge.createInt32Pointer(1, false);
        CLongPointer root = bridge.createCLongPointer(1, false);
        Int32Pointer border = bridge.createInt32Pointer(1, false);
        Int32Pointer depth = bridge.createInt32Pointer(1, false);

        x11.XGetGeometry(display, id, root, x, y, w, h, border, depth);
        return new Dimension(w.get(0), h.get(0));
    }
View Full Code Here

        //in real configure events new position is reported relative to parent
        //so have to translate it for top-level(managed by WM)windows
        //to get root-related coords
        if (!child && !isSynthetic) {
            Int32Pointer x = bridge.createInt32Pointer(1, false);
            Int32Pointer y = bridge.createInt32Pointer(1, false);
            CLongPointer childWindow = bridge.createCLongPointer(1, false);

            long parentId = win.getParentID();
            x11.XTranslateCoordinates(win.getDisplay(), parentId,
                                      factory.getRootWindow(),
                                      windowRect.x, windowRect.y,
                                      x, y, childWindow);
            windowRect.setLocation(x.get(0), y.get(0));
        }

        boolean isContent = (win instanceof ContentWindow);

        if (!isContent && child && !windowRect.equals(win.getBounds())) {
View Full Code Here

    }

    private void processWindowStateEvent() {
        CLongPointer actualTypeReturn = bridge.createCLongPointer(1, false);
        Int32Pointer actualFormatReturn = bridge.createInt32Pointer(1, false);
        CLongPointer nitemsReturn = bridge.createCLongPointer(1, false);
        CLongPointer bytesAfterReturn = bridge.createCLongPointer(1, false);
        PointerPointer propReturn = bridge.createPointerPointer(1, false);

        x11.XGetWindowProperty(factory.getDisplay(), windowId,
                factory.wm.NET_WM_STATE, 0, Integer.MAX_VALUE, X11Defs.FALSE,
                X11Defs.AnyPropertyType, actualTypeReturn, actualFormatReturn,
                nitemsReturn, bytesAfterReturn, propReturn);

        int count = (int)nitemsReturn.get(0);
        if (count == 0) {
            return;
        }
        if (actualFormatReturn.get(0) == 32) {
            CLongPointer types = bridge.createCLongPointer(propReturn.get(0));
            deriveNewWindowState(count, types);
        } else {
            // awt.10=Only 32-bit format is supported for window state operations.
            throw new RuntimeException(Messages.getString("awt.10")); //$NON-NLS-1$
View Full Code Here

        // First get default visual ID
        long defVisualPtr = x11.XDefaultVisual(display, screen);
        long defVisId = x11.XVisualIDFromVisual(defVisualPtr);

        // Allocate one int to get number of visual infos by ref
        Int32Pointer numVisualInfosPtr =
                NativeBridge.getInstance().createInt32Pointer(1, true);

        // Create template visual to obtain visuals for current screen only
        X11.XVisualInfo vinfo_template = x11.createXVisualInfo(true);
        vinfo_template.set_screen(screen);

        // Obtain infos
        X11.XVisualInfo infosPtr = x11.XGetVisualInfo(
                display,
                X11Defs.VisualScreenMask,
                vinfo_template,
                numVisualInfosPtr
        );
        vinfo_template.free(); // Free template data

        int numVisualInfos = numVisualInfosPtr.get(0);
        numVisualInfosPtr.free();

        // Allocate array for configurations
        configs = new XGraphicsConfiguration[numVisualInfos];

        String opengl = System.getProperty("java2d.opengl"); //$NON-NLS-1$
View Full Code Here

        long hBMPColorMask =
            win32.CreateDIBSection(screenDC, bmi, WindowsDefs.DIB_RGB_COLORS, valuesPtr, null, 0);

        // copy rgb-array from BufferedImage to values array
        int[] rgb = bufImg.getRGB(0, 0, width, height, null, 0, width);
        Int32Pointer values = bridge.createInt32Pointer(valuesPtr.get(0));
        values.set(rgb, 0, size);

        long hBMPAlphaMask =
            win32.CreateDIBSection(screenDC, bmi, WindowsDefs.DIB_RGB_COLORS, valuesPtr, null, 0);

        win32.ReleaseDC(0, screenDC);

        // set bitmap mask
        int[] maskArray = new int[size];

        for(int i = 0; i < size; i++) {
            if ((rgb[i] & 0xFF000000) != 0) {
                maskArray[i] = 0xFFFFFF;
            } else {
                maskArray[i] = 0;
            }
        }
        values = bridge.createInt32Pointer(valuesPtr.get(0));
        values.set(maskArray, 0, size);

        // fill icon info
        Win32.ICONINFO iconInfo = win32.createICONINFO(false);
        iconInfo.set_fIcon(icon ? 1 : 0);
        if (!icon) {
View Full Code Here

        setIntProperty(propName, win32.GetSystemMetrics(idx), props);
    }
   
    private int getIntSPI(int idx) {
        NativeBridge bridge = NativeBridge.getInstance();
        Int32Pointer ptr = bridge.createInt32Pointer(1, false);
        win32.SystemParametersInfoW(idx, 0, ptr, 0);
        return ptr.get(0);
    }
View Full Code Here

            resolveEXT();
        }
        */
        activateTmpCtx();

        Int32Pointer nFormats = NativeBridge.getInstance().createInt32Pointer(1, true);
        Int32Pointer formatPtr = NativeBridge.getInstance().createInt32Pointer(1, true);
        Int32Pointer attribList = NativeBridge.getInstance().createInt32Pointer(13, true);

        // Fill in FB config attributes
        attribList.set(0, WGLDefs.WGL_PIXEL_TYPE_ARB);
        attribList.set(1, WGLDefs.WGL_TYPE_RGBA_ARB);
        attribList.set(2, WGLDefs.WGL_DRAW_TO_WINDOW_ARB);
        attribList.set(3, GLDefs.GL_TRUE);
        attribList.set(4, WGLDefs.WGL_DRAW_TO_PBUFFER_ARB);
        attribList.set(5, GLDefs.GL_TRUE);
        attribList.set(6, WGLDefs.WGL_STENCIL_BITS_ARB);
        attribList.set(7, 1);
        attribList.set(8, WGLDefs.WGL_ALPHA_BITS_ARB);
        attribList.set(9, 8);
        attribList.set(10, WGLDefs.WGL_ACCELERATION_ARB);
        attribList.set(11, WGLDefs.WGL_FULL_ACCELERATION_ARB);
        //attribList.set(12, WGLDefs.WGL_DOUBLE_BUFFER_ARB);
        //attribList.set(13, GLDefs.GL_TRUE);
        attribList.set(12, 0);

        wgl.wglChoosePixelFormatARB(hdc, attribList, null, 1, formatPtr, nFormats);

        int res = formatPtr.get(0);

        formatPtr.free();
        nFormats.free();
        attribList.free();

        return res;
    }
View Full Code Here

        long hwnd = getHWND();
        long hdc = w32.GetDC(hwnd);

        int pixelFormat = choosePixelFormatARB(hdc);

        Int32Pointer attribList = NativeBridge.getInstance().createInt32Pointer(1, true);
        attribList.set(0,0);
        long id = wgl.wglCreatePbufferARB(hdc, pixelFormat, w, h, attribList.lock());
        attribList.unlock();
        attribList.free();

        long buffHdc = wgl.wglGetPbufferDCARB(id);

        w32.ReleaseDC(hwnd, hdc);
        w32.DestroyWindow(hwnd);
View Full Code Here

TOP

Related Classes of org.apache.harmony.awt.nativebridge.Int32Pointer

Copyright © 2018 www.massapicom. 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.