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