Windows platforms only: Merged some cursor-related code from John Fay
(with minor changes) git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@562 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
b1e9a6e16d
commit
29e57cdace
@ -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 -------------------------------------------------- */
|
||||
|
||||
@ -187,13 +189,25 @@ void FGAPIENTRY glutSetCursor( int cursorID )
|
||||
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_TEXT, IDC_IBEAM );
|
||||
MAP_CURSOR( GLUT_CURSOR_CROSSHAIR, IDC_CROSS );
|
||||
/* MAP_CURSOR( GLUT_CURSOR_NONE, IDC_NO ); */
|
||||
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
|
||||
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user