glut/test/glut/test6.c
/* XXX Warning, sometimes an X window manager will intercept
   some keystroke like Alt-F2.  Be careful about window manager
   interference when running test6. */
XXX Warning, sometimes an X window manager will intercept
some keystroke like Alt-F2.  Be careful about window manager
interference when running test6.
XXX Warning sometimes an X window manager will intercept some keystroke like Alt - F2 . Be careful about window manager interference when running test6 .
void
special(int key, int x, int y)
{
  printf("key=%d, x=%d, y=%d, modifiers=0x%x\n",
    key, x, y, glutGetModifiers());
  switch (smode) {
  case 0:
    if (key != GLUT_KEY_F2) {
      printf("FAIL: special expected F2\n");
      exit(1);
    }
    if (glutGetModifiers() != 0) {
      printf("FAIL: special expected no modifier\n");
      exit(1);
    }
    break;
  case 1:
    if (key != GLUT_KEY_F2) {
      printf("FAIL: special expected F2\n");
      exit(1);
    }
    if (glutGetModifiers() != GLUT_ACTIVE_SHIFT) {
      printf("FAIL: special expected shift modifier\n");
      exit(1);
    }
    break;
  case 2:
    if (key != GLUT_KEY_F2) {
      printf("FAIL: special expected F2\n");
      exit(1);
    }
    if (glutGetModifiers() != GLUT_ACTIVE_CTRL) {
      printf("FAIL: special expected ctrl modifier\n");
      exit(1);
    }
    break;
  case 3:
    if (key != GLUT_KEY_F2) {
      printf("FAIL: special expected F2\n");
      exit(1);
    }
    if (glutGetModifiers() != GLUT_ACTIVE_ALT) {
      printf("FAIL: special expected alt modifier\n");
      exit(1);
    }
    glutSpecialFunc(NULL);
    glutTimerFunc(1000, time2, 2);
    break;
  default:
    printf("FAIL: special called with bad mode: %d\n", smode);
    exit(1);
  }
  smode++;
}
void special ( int key , int x , int y ) { printf ( " \n " , key , x , y , glutGetModifiers ( ) ) ; switch ( smode ) { case 0 : if ( key != GLUT_KEY_F2 ) { printf ( " \n " ) ; exit ( 1 ) ; } if ( glutGetModifiers ( ) != 0 ) { printf ( " \n " ) ; exit ( 1 ) ; } break ; case 1 : if ( key != GLUT_KEY_F2 ) { printf ( " \n " ) ; exit ( 1 ) ; } if ( glutGetModifiers ( ) != GLUT_ACTIVE_SHIFT ) { printf ( " \n " ) ; exit ( 1 ) ; } break ; case 2 : if ( key != GLUT_KEY_F2 ) { printf ( " \n " ) ; exit ( 1 ) ; } if ( glutGetModifiers ( ) != GLUT_ACTIVE_CTRL ) { printf ( " \n " ) ; exit ( 1 ) ; } break ; case 3 : if ( key != GLUT_KEY_F2 ) { printf ( " \n " ) ; exit ( 1 ) ; } if ( glutGetModifiers ( ) != GLUT_ACTIVE_ALT ) { printf ( " \n " ) ; exit ( 1 ) ; } glutSpecialFunc ( NULL ) ; glutTimerFunc ( 1000 , time2 , 2 ) ; break ; default : printf ( " \n " , smode ) ; exit ( 1 ) ; } smode ++ ; }
XXX Warning, sometimes an X window manager will intercept
some keystroke like Alt-F2.
XXX Warning sometimes an X window manager will intercept some keystroke like Alt - F2 .