1 /***********************************************************
2 * Copyright (C) 1997, Be Inc. All rights reserved.
6 * DESCRIPTION: code for handling custom mouse cursors
7 ***********************************************************/
9 /***********************************************************
11 ***********************************************************/
14 #include "glutState.h"
15 #include "glutCursors.h"
17 static const unsigned char *cursorTable
[] = {
18 XC_arrow
, /* GLUT_CURSOR_RIGHT_ARROW */
19 XC_top_left_arrow
, /* GLUT_CURSOR_LEFT_ARROW */
20 XC_hand1
, /* GLUT_CURSOR_INFO */
21 XC_pirate
, /* GLUT_CURSOR_DESTROY */
22 XC_question_arrow
, /* GLUT_CURSOR_HELP */
23 XC_exchange
, /* GLUT_CURSOR_CYCLE */
24 XC_spraycan
, /* GLUT_CURSOR_SPRAY */
25 XC_watch
, /* GLUT_CURSOR_WAIT */
26 XC_xterm
, /* GLUT_CURSOR_TEXT */
27 XC_crosshair
, /* GLUT_CURSOR_CROSSHAIR */
28 XC_sb_v_double_arrow
, /* GLUT_CURSOR_UP_DOWN */
29 XC_sb_h_double_arrow
, /* GLUT_CURSOR_LEFT_RIGHT */
30 XC_top_side
, /* GLUT_CURSOR_TOP_SIDE */
31 XC_bottom_side
, /* GLUT_CURSOR_BOTTOM_SIDE */
32 XC_left_side
, /* GLUT_CURSOR_LEFT_SIDE */
33 XC_right_side
, /* GLUT_CURSOR_RIGHT_SIDE */
34 XC_top_left_corner
, /* GLUT_CURSOR_TOP_LEFT_CORNER */
35 XC_top_right_corner
, /* GLUT_CURSOR_TOP_RIGHT_CORNER */
36 XC_bottom_right_corner
, /* GLUT_CURSOR_BOTTOM_RIGHT_CORNER */
37 XC_bottom_left_corner
, /* GLUT_CURSOR_BOTTOM_LEFT_CORNER */
40 /***********************************************************
41 * FUNCTION: glutSetCursor (4.13)
43 * DESCRIPTION: set a new mouse cursor for current window
44 ***********************************************************/
45 void glutSetCursor(int cursor
) {
46 gState
.currentWindow
->Window()->Lock();
47 gState
.currentWindow
->cursor
= cursor
;
48 __glutSetCursor(cursor
);
49 gState
.currentWindow
->Window()->Unlock();
52 /***********************************************************
53 * FUNCTION: __glutSetCursor
55 * DESCRIPTION: the actual cursor changing routine
56 ***********************************************************/
57 void __glutSetCursor(int cursor
) {
58 int realcursor
= cursor
;
59 if (cursor
< 0 || cursor
> GLUT_CURSOR_BOTTOM_LEFT_CORNER
) {
61 case GLUT_CURSOR_INHERIT
:
62 return; // don't change cursor
63 case GLUT_CURSOR_NONE
:
64 // this hides the cursor until the user moves the mouse
65 // change it to HideCursor() AT YOUR OWN RISK!
66 be_app
->ObscureCursor();
68 case GLUT_CURSOR_FULL_CROSSHAIR
:
69 realcursor
= GLUT_CURSOR_CROSSHAIR
;
72 __glutWarning("unknown cursor\n");
76 be_app
->SetCursor(cursorTable
[realcursor
]);
79 /***********************************************************
80 * FUNCTION: glutWarpPointer (x.xx)
82 * DESCRIPTION: move the mouse pointer to a new location
83 * (note: can't do this in BeOS!)
84 ***********************************************************/
85 void glutWarpPointer(int x
, int y
) { }