Fixed Win95 crash when getenv("DISPLAY") returned NULL ptr.
[freeglut] / freeglut-1.3 / freeglut_cursor.c
index 900e1c9..53ce750 100644 (file)
@@ -43,7 +43,6 @@
  *
  *  fgDisplayCursor()   -- this waits for better times
  *  glutSetCursor()     -- both X and Win32 mappings are incomplete
- *  glutWarpPointer()   -- check the Win32 version
  *
  * It would be good to use custom mouse cursor shapes, and introduce
  * an option to display them using glBitmap() and/or texture mapping,
@@ -112,7 +111,14 @@ void FGAPIENTRY glutSetCursor( int cursorID )
        /*
         * This is a temporary solution only...
         */
-#      define MAP_CURSOR(a,b) case a: SetCursor( LoadCursor( NULL, b ) ); break;
+       // 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)); \
+        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); \
+        break;
 
        switch( cursorID )
        {
@@ -126,10 +132,11 @@ void FGAPIENTRY glutSetCursor( int cursorID )
                MAP_CURSOR( GLUT_CURSOR_WAIT,            IDC_WAIT      );
                MAP_CURSOR( GLUT_CURSOR_TEXT,        IDC_UPARROW   );
                MAP_CURSOR( GLUT_CURSOR_CROSSHAIR,   IDC_CROSS     );
-               MAP_CURSOR( GLUT_CURSOR_NONE,        IDC_NO                );
+               //MAP_CURSOR( GLUT_CURSOR_NONE,        IDC_NO              );
+               ZAP_CURSOR( GLUT_CURSOR_NONE,        NULL          );
 
                default:
-               MAP_CURSOR( GLUT_CURSOR_UP_DOWN,         IDC_UPARROW   );
+               MAP_CURSOR( GLUT_CURSOR_UP_DOWN,     IDC_ARROW     );
        }
 
 #endif