GLUT_CURSOR_INHERIT now works, also implemented another cursor

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1523 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2013-02-27 09:35:38 +00:00
parent 0d353df338
commit 5fe69bdac1
2 changed files with 20 additions and 3 deletions

View File

@ -702,6 +702,8 @@ main(int argc, char *argv[])
/* callbacks and menus for this window */ /* callbacks and menus for this window */
SetWindowCallbacks( 0 ); SetWindowCallbacks( 0 );
glutSetCursor(GLUT_CURSOR_INHERIT); /* Inherit cursor look from parent (this is default on window creation) - comment the below to see in action */
glutSetCursor(GLUT_CURSOR_CYCLE);
printf ( "Please enter something to continue: " ); printf ( "Please enter something to continue: " );

View File

@ -71,7 +71,7 @@ void fgPlatformSetCursor ( SFG_Window *window, int cursorID )
switch( cursorID ) switch( cursorID )
{ {
MAP_CURSOR( GLUT_CURSOR_RIGHT_ARROW, IDC_ARROW ); MAP_CURSOR( GLUT_CURSOR_RIGHT_ARROW, IDC_ARROW );
MAP_CURSOR( GLUT_CURSOR_LEFT_ARROW, IDC_ARROW ); MAP_CURSOR( GLUT_CURSOR_LEFT_ARROW, IDC_ARROW ); /* XXX ToDo */
MAP_CURSOR( GLUT_CURSOR_INFO, IDC_HELP ); MAP_CURSOR( GLUT_CURSOR_INFO, IDC_HELP );
MAP_CURSOR( GLUT_CURSOR_DESTROY, IDC_CROSS ); MAP_CURSOR( GLUT_CURSOR_DESTROY, IDC_CROSS );
MAP_CURSOR( GLUT_CURSOR_HELP, IDC_HELP ); MAP_CURSOR( GLUT_CURSOR_HELP, IDC_HELP );
@ -82,7 +82,7 @@ void fgPlatformSetCursor ( SFG_Window *window, int cursorID )
MAP_CURSOR( GLUT_CURSOR_CROSSHAIR, IDC_CROSS ); MAP_CURSOR( GLUT_CURSOR_CROSSHAIR, IDC_CROSS );
MAP_CURSOR( GLUT_CURSOR_UP_DOWN, IDC_SIZENS ); MAP_CURSOR( GLUT_CURSOR_UP_DOWN, IDC_SIZENS );
MAP_CURSOR( GLUT_CURSOR_LEFT_RIGHT, IDC_SIZEWE ); MAP_CURSOR( GLUT_CURSOR_LEFT_RIGHT, IDC_SIZEWE );
MAP_CURSOR( GLUT_CURSOR_TOP_SIDE, IDC_ARROW ); /* XXX ToDo */ MAP_CURSOR( GLUT_CURSOR_TOP_SIDE, IDC_UPARROW );
MAP_CURSOR( GLUT_CURSOR_BOTTOM_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_LEFT_SIDE, IDC_ARROW ); /* XXX ToDo */
MAP_CURSOR( GLUT_CURSOR_RIGHT_SIDE, IDC_ARROW ); /* XXX ToDo */ MAP_CURSOR( GLUT_CURSOR_RIGHT_SIDE, IDC_ARROW ); /* XXX ToDo */
@ -90,9 +90,24 @@ void fgPlatformSetCursor ( SFG_Window *window, int cursorID )
MAP_CURSOR( GLUT_CURSOR_TOP_RIGHT_CORNER, IDC_SIZENESW ); MAP_CURSOR( GLUT_CURSOR_TOP_RIGHT_CORNER, IDC_SIZENESW );
MAP_CURSOR( GLUT_CURSOR_BOTTOM_RIGHT_CORNER, IDC_SIZENWSE ); MAP_CURSOR( GLUT_CURSOR_BOTTOM_RIGHT_CORNER, IDC_SIZENWSE );
MAP_CURSOR( GLUT_CURSOR_BOTTOM_LEFT_CORNER, IDC_SIZENESW ); MAP_CURSOR( GLUT_CURSOR_BOTTOM_LEFT_CORNER, IDC_SIZENESW );
MAP_CURSOR( GLUT_CURSOR_INHERIT, IDC_ARROW ); /* XXX ToDo */
ZAP_CURSOR( GLUT_CURSOR_NONE, NULL ); ZAP_CURSOR( GLUT_CURSOR_NONE, NULL );
MAP_CURSOR( GLUT_CURSOR_FULL_CROSSHAIR, IDC_CROSS ); /* XXX ToDo */ MAP_CURSOR( GLUT_CURSOR_FULL_CROSSHAIR, IDC_CROSS ); /* XXX ToDo */
case GLUT_CURSOR_INHERIT:
{
SFG_Window *temp_window = window;
while (temp_window->Parent)
{
temp_window = temp_window->Parent;
if (temp_window->State.Cursor != GLUT_CURSOR_INHERIT)
{
fgPlatformSetCursor(window,temp_window->State.Cursor);
return;
}
}
/* No parent, or no parent with cursor type set. Fall back to default */
fgPlatformSetCursor(window,GLUT_CURSOR_LEFT_ARROW);
}
break;
default: default:
fgError( "Unknown cursor type: %d", cursorID ); fgError( "Unknown cursor type: %d", cursorID );