X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=progs%2Fdemos%2FCallbackMaker%2FCallbackMaker.c;h=2d310623902c7c04bd227d5fd759ac83f666db69;hb=eda45df83952e3e92ec4adacc8c942085e132077;hp=5abd8ee165bc33d0989272c32d04c0a1cae8a4af;hpb=0d2f235b5773e0403b7a121dd8bd1b4621b25abf;p=freeglut diff --git a/progs/demos/CallbackMaker/CallbackMaker.c b/progs/demos/CallbackMaker/CallbackMaker.c index 5abd8ee..2d31062 100644 --- a/progs/demos/CallbackMaker/CallbackMaker.c +++ b/progs/demos/CallbackMaker/CallbackMaker.c @@ -30,6 +30,8 @@ int mousewheel_number = -1, mousewheel_direction = -1, mousewheel_x = -1, mousew int motion_x = -1, motion_y = -1, motion_seq = -1 ; int passivemotion_x = -1, passivemotion_y = -1, passivemotion_seq = -1 ; +#define STRING_LENGTH 10 + static void bitmapPrintf (const char *fmt, ...) { @@ -143,25 +145,19 @@ Warning(const char *fmt, va_list ap) static void Error(const char *fmt, va_list ap) { -#define STRING_LENGTH 10 char dummy_string[STRING_LENGTH]; printf("%6d Error callback:\n"); /* print warning message */ vprintf(fmt, ap); - /* deInitialize the freeglut state */ - /* This all goes haywire of course when the error occurs during deinitialize, - * one might want to call exit directly as its possible freeglut is messed - * up internally when error is called. - */ - printf("Error callback: calling glutExit() to prepare for clean exit\n"); - glutExit(); - - /* terminate program */ + /* terminate program, after pause for input so user can see */ printf ( "Please enter something to exit: " ); fgets ( dummy_string, STRING_LENGTH, stdin ); + /* Call exit directly as freeglut is messed + * up internally when an error is called. + */ exit(1); } @@ -464,7 +460,6 @@ static void Idle ( void ) int main(int argc, char *argv[]) { -#define STRING_LENGTH 10 int freeglut_window, aux_window ; char dummy_string[STRING_LENGTH]; @@ -476,6 +471,7 @@ main(int argc, char *argv[]) glutInitWindowPosition ( 140, 140 ); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE ); glutInit(&argc, argv); + glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE,GLUT_ACTION_CONTINUE_EXECUTION); freeglut_window = glutCreateWindow( "Callback Demo" ); printf ( "Creating window %d as 'Callback Demo'\n", freeglut_window ) ;