aboutsummaryrefslogtreecommitdiffstats
path: root/src/glut
diff options
context:
space:
mode:
authorClaudio Ciccani <[email protected]>2006-06-09 15:19:05 +0000
committerClaudio Ciccani <[email protected]>2006-06-09 15:19:05 +0000
commit4812a59754802d6ec5d18dfab7d37ca947f5fa3d (patch)
tree917d6762a6cf304483516e0cd6086fe184b94f36 /src/glut
parent6acc6dd0c4955832f1f94d65d21d30ed53793cc5 (diff)
Enable setting invible cursors.
Diffstat (limited to 'src/glut')
-rw-r--r--src/glut/directfb/cursor.c62
1 files changed, 35 insertions, 27 deletions
diff --git a/src/glut/directfb/cursor.c b/src/glut/directfb/cursor.c
index 905fa5ee119..aca3fcc9215 100644
--- a/src/glut/directfb/cursor.c
+++ b/src/glut/directfb/cursor.c
@@ -32,10 +32,6 @@ glutSetCursor( int type )
const unsigned char *cursor;
DFBSurfaceDescription dsc;
IDirectFBSurface *shape;
- __u8 *src, *msk;
- void *dst;
- int pitch;
- int x, y;
if (!g_current || !g_current->window)
return;
@@ -104,44 +100,56 @@ glutSetCursor( int type )
case GLUT_CURSOR_BOTTOM_LEFT_CORNER:
cursor = &cur_bottom_left[0];
break;
+ case GLUT_CURSOR_NONE:
+ cursor = NULL;
+ break;
default:
cursor = &cur_right_arrow[0];
break;
}
dsc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
- dsc.width = cursor[0];
- dsc.height = cursor[0];
+ dsc.width =
+ dsc.height = cursor ? cursor[0] : 8;
dsc.pixelformat = DSPF_ARGB;
if (dfb->CreateSurface( dfb, &dsc, &shape ))
return;
+
+ if (cursor) {
+ __u8 *src = (__u8*) &cursor[3];
+ __u8 *msk = src + cursor[0]*cursor[0]/8;
+ void *dst;
+ int pitch;
+ int x, y;
- if (shape->Lock( shape, DSLF_WRITE, &dst, &pitch )) {
- shape->Release( shape );
- return;
- }
-
- src = (__u8*) &cursor[3];
- msk = src + cursor[0]*cursor[0]/8;
+ if (shape->Lock( shape, DSLF_WRITE, &dst, &pitch )) {
+ shape->Release( shape );
+ return;
+ }
- for (y = 0; y < cursor[0]; y++) {
- for (x = 0; x < cursor[0]; x++) {
- int p = x & 7;
+ for (y = 0; y < cursor[0]; y++) {
+ for (x = 0; x < cursor[0]; x++) {
+ ((__u32*)dst)[x] =
+ ((src[x>>3] & (0x80 >> (x&7))) ? 0 : 0x00ffffff) |
+ ((msk[x>>3] & (0x80 >> (x&7))) ? 0xff000000 : 0);
+ }
- ((__u32*)dst)[x] = ((src[x>>3] & (0x80 >> p)) ? 0 : 0x00ffffff) |
- ((msk[x>>3] & (0x80 >> p)) ? 0xff000000 : 0);
+ dst += pitch;
+ src += cursor[0]/8;
+ msk += cursor[0]/8;
}
-
- dst += pitch;
- src += 2;
- msk += 2;
- }
- shape->Unlock( shape );
-
- g_current->window->SetCursorShape( g_current->window,
- shape, cursor[1], cursor[2] );
+ shape->Unlock( shape );
+ }
+ else {
+ /* Invisible cursor */
+ shape->Clear( shape, 0, 0, 0, 0 );
+ }
+
+ g_current->window->SetCursorShape( g_current->window, shape,
+ cursor ? cursor[1] : 0,
+ cursor ? cursor[2] : 0 );
g_current->cursor = type;
shape->Release( shape );