X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_cursor.c;h=93b6b2056c55f1b4595091e74aa30ad34ffd3d17;hb=e9ebb8053106d2504605c70a1fd777a52f1d9da4;hp=d32ba5cda12ea853eaea915610d2e2c851d09f02;hpb=ee8ce6fea5a32912ff394081fea9af8971536726;p=freeglut diff --git a/src/freeglut_cursor.c b/src/freeglut_cursor.c index d32ba5c..93b6b20 100644 --- a/src/freeglut_cursor.c +++ b/src/freeglut_cursor.c @@ -28,7 +28,7 @@ #include #include "freeglut_internal.h" -#if TARGET_HOST_UNIX_X11 +#if TARGET_HOST_POSIX_X11 #include #endif @@ -43,7 +43,7 @@ /* -- PRIVATE FUNCTIONS --------------------------------------------------- */ -#if TARGET_HOST_UNIX_X11 +#if TARGET_HOST_POSIX_X11 /* * A factory method for an empty cursor */ @@ -111,7 +111,7 @@ static cursorCacheEntry cursorCache[] = { */ void fgSetCursor ( SFG_Window *window, int cursorID ) { -#if TARGET_HOST_UNIX_X11 +#if TARGET_HOST_POSIX_X11 { Cursor cursor; /* @@ -147,19 +147,22 @@ void fgSetCursor ( SFG_Window *window, int cursorID ) } } - if ( ( cursorIDToUse != GLUT_CURSOR_NONE ) && ( cursor == None ) ) { + if ( cursorIDToUse == GLUT_CURSOR_INHERIT ) { + XUndefineCursor( fgDisplay.Display, window->Window.Handle ); + } else if ( cursor != None ) { + XDefineCursor( fgDisplay.Display, window->Window.Handle, cursor ); + } else if ( cursorIDToUse != GLUT_CURSOR_NONE ) { fgError( "Failed to create cursor" ); } - XDefineCursor( fgDisplay.Display, - window->Window.Handle, cursor ); } -#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE +#elif TARGET_HOST_MS_WINDOWS /* - * This is a temporary solution only... + * Joe Krahn is re-writing the following code. */ /* Set the cursor AND change it for this window class. */ +#if _MSC_VER <= 1200 # define MAP_CURSOR(a,b) \ case a: \ SetCursor( LoadCursor( NULL, b ) ); \ @@ -167,7 +170,6 @@ void fgSetCursor ( SFG_Window *window, int cursorID ) GCL_HCURSOR, \ ( LONG )LoadCursor( NULL, b ) ); \ break; - /* Nuke the cursor AND change it for this window class. */ # define ZAP_CURSOR(a,b) \ case a: \ @@ -175,6 +177,22 @@ void fgSetCursor ( SFG_Window *window, int cursorID ) SetClassLong( window->Window.Handle, \ GCL_HCURSOR, ( LONG )NULL ); \ break; +#else +# define MAP_CURSOR(a,b) \ + case a: \ + SetCursor( LoadCursor( NULL, b ) ); \ + SetClassLongPtr( window->Window.Handle, \ + GCLP_HCURSOR, \ + ( LONG )( LONG_PTR )LoadCursor( NULL, b ) ); \ + break; + /* Nuke the cursor AND change it for this window class. */ +# define ZAP_CURSOR(a,b) \ + case a: \ + SetCursor( NULL ); \ + SetClassLongPtr( window->Window.Handle, \ + GCLP_HCURSOR, ( LONG )( LONG_PTR )NULL ); \ + break; +#endif switch( cursorID ) { @@ -232,7 +250,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y ) FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWarpPointer" ); FREEGLUT_EXIT_IF_NO_WINDOW ( "glutWarpPointer" ); -#if TARGET_HOST_UNIX_X11 +#if TARGET_HOST_POSIX_X11 XWarpPointer( fgDisplay.Display, @@ -244,7 +262,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y ) /* Make the warp visible immediately. */ XFlush( fgDisplay.Display ); -#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE +#elif TARGET_HOST_MS_WINDOWS { POINT coords;