diff options
author | Sean D'Epagnier <[email protected]> | 2006-11-30 03:25:28 +0000 |
---|---|---|
committer | Sean D'Epagnier <[email protected]> | 2006-11-30 03:25:28 +0000 |
commit | 10cbd089aeb1087a277baf3a7ef0b4d9223970dc (patch) | |
tree | c1da62da8dabacce0ad67b548ebe872f44fefc13 /src/glut/fbdev/cursor.c | |
parent | 21cf414489af84b8bb374f76c36db8f0f1919733 (diff) |
the following improvements to linux-fbdev:
1. updated makefiles to build libOSMesa as well as libGL
these are improvements to fbdev-glut
1. mouse cursor will timeout and be invisible if not being used
2. do not restore colormaps to truecolor targets, this causes problems at
exit on my g450
3. fixed a crash when cleaning up from failure by munmaping what had not
yet been mmaped
4. Resize event handling is improved, the resize function is not invoked
from a signal handler now.
5. The main loop can detect if it is running very fast (greater than 2khz)
6. keyboard up and special up events are generated from stdin input mode
and if it is also not redrawing, it sleeps
7. corrections in escape sequences for function keys for stdin input
Diffstat (limited to 'src/glut/fbdev/cursor.c')
-rw-r--r-- | src/glut/fbdev/cursor.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/glut/fbdev/cursor.c b/src/glut/fbdev/cursor.c index 6cd087e93c8..4bb2b7fba01 100644 --- a/src/glut/fbdev/cursor.c +++ b/src/glut/fbdev/cursor.c @@ -66,6 +66,9 @@ void EraseCursor(void) 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; @@ -110,7 +113,7 @@ void DrawCursor(void) 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]; @@ -212,10 +215,12 @@ void SwapCursor(void) 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; @@ -230,7 +235,7 @@ void SwapCursor(void) + 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; } @@ -260,11 +265,8 @@ void glutSetCursor(int cursor) if(cursor == GLUT_CURSOR_FULL_CROSSHAIR) cursor = GLUT_CURSOR_CROSSHAIR; - if(CurrentCursor >= 0 && CurrentCursor < NUM_CURSORS) - EraseCursor(); - + EraseCursor(); + MouseVisible = 1; CurrentCursor = cursor; - - MouseEnabled = 1; SwapCursor(); } |