*/
/* these routines are written to access graphics memory directly, not using mesa
- to render the cursor, this is faster, and */
+ to render the cursor, this is faster, it would be good to use a hardware
+ cursor if it exists instead */
+#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
+#include <string.h>
#include <linux/fb.h>
unsigned char *src = MouseBuffer;
+ if(!MouseVisible || CurrentCursor < 0 || CurrentCursor >= NUM_CURSORS)
+ return;
+
for(i = 0; i<CURSOR_HEIGHT; i++) {
memcpy(BackBuffer + off, src, stride);
src += stride;
unsigned char *c;
const unsigned char *d;
- if(CurrentCursor < 0 || CurrentCursor >= NUM_CURSORS)
+ if(!MouseVisible || CurrentCursor < 0 || CurrentCursor >= NUM_CURSORS)
return;
px = MouseX - CursorsXOffset[CurrentCursor];
cstride /= 2;
for(i = yoff; i < ylen; i++) {
for(j = xoff; j < xlen; j++) {
- e[0] = ((((d[0] + (((int)(((e[0] >> 8) & 0xf8)
+ if(d[3] < 220)
+ e[0] = ((((d[0] + (((int)(((e[0] >> 8) & 0xf8)
| ((c[0] >> 11) & 0x7)) * d[3]) >> 8)) & 0xf8) << 8)
| (((d[1] + (((int)(((e[0] >> 3) & 0xfc)
| ((e[0] >> 5) & 0x3)) * d[3]) >> 8)) & 0xfc) << 3)
case 4:
for(i = yoff; i < ylen; i++) {
for(j = xoff; j < xlen; j++) {
- c[0] = d[0] + (((int)c[0] * d[3]) >> 8);
- c[1] = d[1] + (((int)c[1] * d[3]) >> 8);
- c[2] = d[2] + (((int)c[2] * d[3]) >> 8);
+ if(d[3] < 220) {
+ c[0] = d[0] + (((int)c[0] * d[3]) >> 8);
+ c[1] = d[1] + (((int)c[1] * d[3]) >> 8);
+ c[2] = d[2] + (((int)c[2] * d[3]) >> 8);
+ }
c+=bypp;
d+=4;
int miny = MIN(py, LastMouseY);
int sizey = abs(py - LastMouseY);
- DrawCursor();
- /* now update the portion of the screen that has changed */
+ if(MouseVisible)
+ DrawCursor();
- if(DisplayMode & GLUT_DOUBLE && (sizex || sizey)) {
+ /* now update the portion of the screen that has changed, this is also
+ used to hide the mouse if MouseVisible is 0 */
+ if(DisplayMode & GLUT_DOUBLE && ((sizex || sizey) || !MouseVisible)) {
int off, stride, i;
if(minx < 0)
minx = 0;
+ minx * VarInfo.bits_per_pixel / 8;
stride = (sizex + CURSOR_WIDTH) * VarInfo.bits_per_pixel / 8;
- for(i = 0; i< sizey + CURSOR_HEIGHT; i++) {
+ for(i = 0; i < sizey + CURSOR_HEIGHT; i++) {
memcpy(FrameBuffer+off, BackBuffer+off, stride);
off += FixedInfo.line_length;
}
{
if(cursor == GLUT_CURSOR_FULL_CROSSHAIR)
cursor = GLUT_CURSOR_CROSSHAIR;
- CurrentCursor = cursor;
- MouseEnabled = 1;
+
EraseCursor();
+ MouseVisible = 1;
+ CurrentCursor = cursor;
SwapCursor();
}