Further normalized the style of the cursor code.

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@309 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
rkrolib 2003-11-07 06:25:20 +00:00
parent aeeabeff93
commit d8f572533b

View File

@ -55,7 +55,7 @@
*/
void FGAPIENTRY glutSetCursor( int cursorID )
{
freeglut_assert_ready;
freeglut_assert_ready; /* XXX WHY do we need the timer active for this? */
freeglut_assert_window;
#if TARGET_HOST_UNIX_X11
@ -74,7 +74,12 @@ void FGAPIENTRY glutSetCursor( int cursorID )
*/
{
Cursor cursor;
#define MAP_CURSOR(a,b) case a: cursor = XCreateFontCursor( fgDisplay.Display, b ); break;
#define MAP_CURSOR(a,b) \
case a: \
cursor = XCreateFontCursor( fgDisplay.Display, b ); \
break;
if( GLUT_CURSOR_FULL_CROSSHAIR == cursorID )
cursorID = GLUT_CURSOR_CROSSHAIR;
@ -108,9 +113,11 @@ void FGAPIENTRY glutSetCursor( int cursorID )
}
if( GLUT_CURSOR_INHERIT == cursorID )
XUndefineCursor( fgDisplay.Display, fgStructure.Window->Window.Handle );
XUndefineCursor( fgDisplay.Display,
fgStructure.Window->Window.Handle );
else
XDefineCursor( fgDisplay.Display, fgStructure.Window->Window.Handle, cursor );
XDefineCursor( fgDisplay.Display,
fgStructure.Window->Window.Handle, cursor );
}
#elif TARGET_HOST_WIN32
@ -119,12 +126,20 @@ void FGAPIENTRY glutSetCursor( int cursorID )
* This is a temporary solution only...
*/
/* Set the cursor AND change it for this window class. */
# define MAP_CURSOR(a,b) case a: SetCursor( LoadCursor( NULL, b ) ); \
SetClassLong(fgStructure.Window->Window.Handle,GCL_HCURSOR,(LONG)LoadCursor(NULL,b)); \
# define MAP_CURSOR(a,b) \
case a: \
SetCursor( LoadCursor( NULL, b ) ); \
SetClassLong( fgStructure.Window->Window.Handle, \
GCL_HCURSOR, \
( LONG )LoadCursor( NULL, b ) ); \
break;
/* Nuke the cursor AND change it for this window class. */
# define ZAP_CURSOR(a,b) case a: SetCursor( NULL ); \
SetClassLong(fgStructure.Window->Window.Handle,GCL_HCURSOR,(LONG)NULL); \
# define ZAP_CURSOR(a,b) \
case a: \
SetCursor( NULL ); \
SetClassLong( fgStructure.Window->Window.Handle, \
GCL_HCURSOR, ( LONG )NULL ); \
break;
switch( cursorID )
@ -155,7 +170,7 @@ void FGAPIENTRY glutSetCursor( int cursorID )
*/
void FGAPIENTRY glutWarpPointer( int x, int y )
{
freeglut_assert_ready;
freeglut_assert_ready; /* XXX WHY do we need the timer active for this? */
freeglut_assert_window;
#if TARGET_HOST_UNIX_X11
@ -167,7 +182,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y )
0, 0, 0, 0,
x, y
);
XFlush( fgDisplay.Display );
XFlush( fgDisplay.Display ); /* XXX Is this really necessary? */
#elif TARGET_HOST_WIN32