Windows platforms only: Merged some cursor-related code from John Fay
authorSven Panne <sven.panne@aedion.de>
Sun, 23 Jan 2005 17:38:33 +0000 (17:38 +0000)
committerSven Panne <sven.panne@aedion.de>
Sun, 23 Jan 2005 17:38:33 +0000 (17:38 +0000)
(with minor changes)

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@562 7f0cb862-5218-0410-a997-914c9d46530a

src/freeglut_cursor.c
src/freeglut_main.c

index db033ed..e473e16 100644 (file)
@@ -43,6 +43,7 @@
 
 /* -- INTERNAL FUNCTIONS --------------------------------------------------- */
 
+#if TARGET_HOST_UNIX_X11
 /*
  * A factory method for an empty cursor
  */
@@ -101,6 +102,7 @@ static cursorCacheEntry cursorCache[] = {
     { XC_bottom_right_corner, None }, /* GLUT_CURSOR_BOTTOM_RIGHT_CORNER */
     { XC_bottom_left_corner,  None }  /* GLUT_CURSOR_BOTTOM_LEFT_CORNER */
 };
+#endif
 
 /* -- INTERFACE FUNCTIONS -------------------------------------------------- */
 
@@ -179,21 +181,33 @@ void FGAPIENTRY glutSetCursor( int cursorID )
 
     switch( cursorID )
     {
-        MAP_CURSOR( GLUT_CURSOR_RIGHT_ARROW, IDC_ARROW     );
-        MAP_CURSOR( GLUT_CURSOR_LEFT_ARROW,  IDC_ARROW     );
-        MAP_CURSOR( GLUT_CURSOR_INFO,        IDC_HELP      );
-        MAP_CURSOR( GLUT_CURSOR_DESTROY,     IDC_CROSS     );
-        MAP_CURSOR( GLUT_CURSOR_HELP,        IDC_HELP      );
-        MAP_CURSOR( GLUT_CURSOR_CYCLE,       IDC_SIZEALL   );
-        MAP_CURSOR( GLUT_CURSOR_SPRAY,       IDC_CROSS     );
-        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        ); */
-        ZAP_CURSOR( GLUT_CURSOR_NONE,        NULL           );
+        MAP_CURSOR( GLUT_CURSOR_RIGHT_ARROW,         IDC_ARROW     );
+        MAP_CURSOR( GLUT_CURSOR_LEFT_ARROW,          IDC_ARROW     );
+        MAP_CURSOR( GLUT_CURSOR_INFO,                IDC_HELP      );
+        MAP_CURSOR( GLUT_CURSOR_DESTROY,             IDC_CROSS     );
+        MAP_CURSOR( GLUT_CURSOR_HELP,                IDC_HELP      );
+        MAP_CURSOR( GLUT_CURSOR_CYCLE,               IDC_SIZEALL   );
+        MAP_CURSOR( GLUT_CURSOR_SPRAY,               IDC_CROSS     );
+        MAP_CURSOR( GLUT_CURSOR_WAIT,                IDC_WAIT      );
+        MAP_CURSOR( GLUT_CURSOR_TEXT,                IDC_IBEAM     );
+        MAP_CURSOR( GLUT_CURSOR_CROSSHAIR,           IDC_CROSS     );
+        MAP_CURSOR( GLUT_CURSOR_UP_DOWN,             IDC_SIZENS    );
+        MAP_CURSOR( GLUT_CURSOR_LEFT_RIGHT,          IDC_SIZEWE    );
+        MAP_CURSOR( GLUT_CURSOR_TOP_SIDE,            IDC_ARROW     ); /* XXX ToDo */
+        MAP_CURSOR( GLUT_CURSOR_BOTTOM_SIDE,         IDC_ARROW     ); /* XXX ToDo */
+        MAP_CURSOR( GLUT_CURSOR_LEFT_SIDE,           IDC_ARROW     ); /* XXX ToDo */
+        MAP_CURSOR( GLUT_CURSOR_RIGHT_SIDE,          IDC_ARROW     ); /* XXX ToDo */
+        MAP_CURSOR( GLUT_CURSOR_TOP_LEFT_CORNER,     IDC_SIZENWSE  );
+        MAP_CURSOR( GLUT_CURSOR_TOP_RIGHT_CORNER,    IDC_SIZENESW  );
+        MAP_CURSOR( GLUT_CURSOR_BOTTOM_RIGHT_CORNER, IDC_SIZENWSE  );
+        MAP_CURSOR( GLUT_CURSOR_BOTTOM_LEFT_CORNER,  IDC_SIZENESW  );
+        MAP_CURSOR( GLUT_CURSOR_INHERIT,             IDC_ARROW     ); /* XXX ToDo */
+        ZAP_CURSOR( GLUT_CURSOR_NONE,                NULL          );
+        MAP_CURSOR( GLUT_CURSOR_FULL_CROSSHAIR,      IDC_CROSS     ); /* XXX ToDo */
 
     default:
-        MAP_CURSOR( GLUT_CURSOR_UP_DOWN,     IDC_ARROW     );
+        fgError( "Unknown cursor type: %d", cursorID );
+        break;
     }
 #endif
 
index 4763411..0ab70ec 100644 (file)
@@ -1225,7 +1225,6 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
     case WM_ACTIVATE:
         if (LOWORD(wParam) != WA_INACTIVE)
         {
-            /* glutSetCursor( fgStructure.Window->State.Cursor ); */
 /*            printf("WM_ACTIVATE: glutSetCursor( %p, %d)\n", window,
                    window->State.Cursor ); */
             glutSetCursor( window->State.Cursor );
@@ -1244,38 +1243,9 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
          * XXX and implementing a nested case in-line.
          */
     case WM_SETCURSOR:
-        /* Set the cursor AND change it for this window class. */
-#define MAP_CURSOR(a,b)                 \
-    case a:                             \
-    SetCursor( LoadCursor( NULL, b ) ); \
-    break;
-
-        /* Nuke the cursor AND change it for this window class. */
-#define ZAP_CURSOR(a,b) \
-    case a:             \
-    SetCursor( NULL );  \
-    break;
-
 /*      printf ( "Cursor event %x %x %x %x\n", window, window->State.Cursor, lParam, wParam ) ; */
         if( LOWORD( lParam ) == HTCLIENT )
-            switch( window->State.Cursor )
-            {
-                MAP_CURSOR( GLUT_CURSOR_RIGHT_ARROW, IDC_ARROW     );
-                MAP_CURSOR( GLUT_CURSOR_LEFT_ARROW,  IDC_ARROW     );
-                MAP_CURSOR( GLUT_CURSOR_INFO,        IDC_HELP      );
-                MAP_CURSOR( GLUT_CURSOR_DESTROY,     IDC_CROSS     );
-                MAP_CURSOR( GLUT_CURSOR_HELP,        IDC_HELP      );
-                MAP_CURSOR( GLUT_CURSOR_CYCLE,       IDC_SIZEALL   );
-                MAP_CURSOR( GLUT_CURSOR_SPRAY,       IDC_CROSS     );
-                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         ); */
-                ZAP_CURSOR( GLUT_CURSOR_NONE,        NULL          );
-
-            default:
-                MAP_CURSOR( GLUT_CURSOR_UP_DOWN,     IDC_ARROW     );
-            }
+            glutSetCursor ( window->State.Cursor ) ;
         else
             lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
         break;