modules/graphics/src/main/java/com/sun/glass/ui/monocle/mx6/MX6Cursor.java

Print this page

        

*** 60,69 **** --- 60,70 ---- private int screenHeight; private LinuxSystem system; private MXCFBPos pos = new MXCFBPos(); private MXCFBGblAlpha alpha = new MXCFBGblAlpha(); private long fd = -1; + private boolean isVisible = false; private static class MXCFBColorKey extends C.Structure { private final IntBuffer data; MXCFBColorKey() { b.order(ByteOrder.nativeOrder());
*** 172,184 **** --- 173,188 ---- public void setVisibility(boolean visibility) { alpha.setEnable(1); alpha.setAlpha(visibility ? 255 : 0); int MXCFB_SET_GBL_ALPHA = system.IOW('F', 0x21, alpha.sizeof()); system.ioctl(fd, MXCFB_SET_GBL_ALPHA, alpha.p); + isVisible = visibility; + updateImage(true); } private void updateImage(boolean always) { + if (isVisible && cursorBuffer != null) { //skip until cursor is fully initialized int newOffsetX, newOffsetY; newOffsetX = Math.max(0, CURSOR_WIDTH + cursorX - screenWidth); newOffsetY = Math.max(0, CURSOR_HEIGHT + cursorY - screenHeight); if (newOffsetX != offsetX || newOffsetY != offsetY || always) { NativeCursors.offsetCursor(cursorBuffer, offsetCursorBuffer,
*** 193,202 **** --- 197,207 ---- System.err.println("Failed to write to i.MX6 cursor: " + system.getErrorMessage()); } } } + } @Override public void setImage(byte[] cursorImage) { // Convert the cursor to the color-keyed format ByteBuffer bb = ByteBuffer.allocate(cursorImage.length);