diff -r a50800b8372c modules/graphics/src/main/native-glass/lens/lensport/imx6Cursor.c --- a/modules/graphics/src/main/native-glass/lens/lensport/imx6Cursor.c Tue Mar 18 09:24:51 2014 -0400 +++ b/modules/graphics/src/main/native-glass/lens/lensport/imx6Cursor.c Wed Mar 19 13:05:01 2014 -0400 @@ -124,6 +124,16 @@ int cursorSize = cursor.width * cursor.height * bpp; int xShift = cursor.xShift; int yShift = cursor.yShift; + + if (!cursor.isVisible) { + return; + } + + if (lseek(cursor.fd, 0, SEEK_SET) == -1) { + GLASS_LOG_SEVERE("Cannot rewrite cursor image"); + return; + } + GLASS_LOG_FINEST("Cursor shift = (%i, %i) at (%i, %i)\n", xShift, yShift, cursor.x, cursor.y); if (xShift == 0 && yShift == 0) { @@ -389,16 +399,11 @@ } } - cursor.isVisible = 1; cursor.currentCursor = nativeCursorHandle; fbImx6AdjustShift(); - if (lseek(cursor.fd, 0, SEEK_SET) == -1) { - GLASS_LOG_SEVERE("Cannot rewrite cursor image"); - } else { - fbImx6WriteCursor(cursor.fd, cursorImage->buffer, use32bit ? 4 : 2); - } - } + fbImx6WriteCursor(cursor.fd, cursorImage->buffer, use32bit ? 4 : 2); + } } @@ -430,13 +435,9 @@ y -= cursor.yShift; if (xShift != cursor.xShift || yShift != cursor.yShift) { GLASS_LOG_FINEST("Calling lseek to rewind cursor fd"); - if (lseek(cursor.fd, 0, SEEK_SET) == -1) { - GLASS_LOG_SEVERE("Cannot rewrite cursor image"); - } else { - Imx6CursorImage *fbCursorImage = (Imx6CursorImage *) - jlong_to_ptr(cursor.currentCursor); - fbImx6WriteCursor(cursor.fd, fbCursorImage->buffer, use32bit ? 4 : 2); - } + Imx6CursorImage *fbCursorImage = (Imx6CursorImage *) + jlong_to_ptr(cursor.currentCursor); + fbImx6WriteCursor(cursor.fd, fbCursorImage->buffer, use32bit ? 4 : 2); } struct mxcfb_pos cpos = {x, y}; @@ -448,8 +449,8 @@ void fbImx6CursorClose() { - if (cursor.fd >= 0) { + fbImx6BlankCursor(); close(cursor.fd); cursor.fd = -1; cursor.isVisible = 0; @@ -462,7 +463,10 @@ static void fbImx6SetVisible(jboolean isVisible) { if (isVisible) { if (!cursor.isVisible && cursor.currentCursor != 0) { - fbImx6SetNativeCursor(cursor.currentCursor); + cursor.isVisible = 1; + Imx6CursorImage *fbCursorImage = (Imx6CursorImage *) + jlong_to_ptr(cursor.currentCursor); + fbImx6WriteCursor(cursor.fd, fbCursorImage->buffer, use32bit ? 4 : 2); } } else { if (cursor.isVisible) {