extensive changes in callbackmaker: each of the two windows now has its

own events registered and displayed separately


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1465 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2012-11-22 04:38:03 +00:00
parent a85eaf5632
commit eb968382e8

View File

@ -13,24 +13,47 @@ static int sequence_number = 0 ;
int windows[2] = {0}; int windows[2] = {0};
int reshape_called = 0, key_called = 0, special_called = 0, visibility_called = 0, /* define status vars showing whether given callback has been called for given window */
keyup_called = 0, specialup_called = 0, joystick_called = 0, mouse_called = 0, #define CALLBACK_CALLED_VAR(name) int name##_called[2] = {0};
mousewheel_called = 0, motion_called = 0, passivemotion_called = 0, entry_called = 0, #define CALLBACK_1_VAR(name,field) int name##_##field[2], name##_seq[2] = {-1};
close_called = 0, overlaydisplay_called = 0, windowstatus_called = 0, #define CALLBACK_2_VARS(name,field1,field2) int name##_##field1[2], name##_##field2[2], name##_seq[2] = {-1};
spacemotion_called = 0, spacerotation_called = 0, spacebutton_called = 0, #define CALLBACK_3_VARS(name,field1,field2,field3) int name##_##field1[2], name##_##field2[2], name##_##field3[2], name##_seq[2] = {-1};
buttonbox_called = 0, dials_called = 0, tabletmotion_called = 0, tabletbutton_called = 0, #define CALLBACK_4_VARS(name,field1,field2,field3,field4) int name##_##field1[2], name##_##field2[2], name##_##field3[2], name##_##field4[2], name##_seq[2] = {-1};
menudestroy_called = 0, menustatus_called = 0 ; CALLBACK_CALLED_VAR(reshape);
int reshape_width = -1, reshape_height = -1, reshape_seq = -1 ; CALLBACK_2_VARS(reshape,width,height);
int key_key = -1, key_x = -1, key_y = -1, key_seq = -1 ; CALLBACK_CALLED_VAR(key);
int special_key = -1, special_x = -1, special_y = -1, special_seq = -1 ; CALLBACK_3_VARS(key,key,x,y);
int visibility_vis = -1, visibility_seq = -1 ; CALLBACK_CALLED_VAR(keyup);
int keyup_key = -1, keyup_x = -1, keyup_y = -1, keyup_seq = -1 ; CALLBACK_3_VARS(keyup,key,x,y);
int specialup_key = -1, specialup_x = -1, specialup_y = -1, specialup_seq = -1 ; CALLBACK_CALLED_VAR(special);
int joystick_a = -1, joystick_b = -1, joystick_c = -1, joystick_d = -1, joystick_seq = -1 ; /* Need meaningful names */ CALLBACK_3_VARS(special,key,x,y);
int mouse_button = -1, mouse_updown = -1, mouse_x = -1, mouse_y = -1, mouse_seq = -1 ; CALLBACK_CALLED_VAR(specialup);
int mousewheel_number = -1, mousewheel_direction = -1, mousewheel_x = -1, mousewheel_y = -1, mousewheel_seq = -1 ; CALLBACK_3_VARS(specialup,key,x,y);
int motion_x = -1, motion_y = -1, motion_seq = -1 ; CALLBACK_CALLED_VAR(visibility);
int passivemotion_x = -1, passivemotion_y = -1, passivemotion_seq = -1 ; CALLBACK_1_VAR(visibility,vis);
CALLBACK_CALLED_VAR(joystick);
CALLBACK_4_VARS(joystick,a,b,c,d);
CALLBACK_CALLED_VAR(mouse);
CALLBACK_4_VARS(mouse,button,updown,x,y);
CALLBACK_CALLED_VAR(mousewheel);
CALLBACK_4_VARS(mousewheel,number,direction,x,y);
CALLBACK_CALLED_VAR(motion);
CALLBACK_2_VARS(motion,x,y);
CALLBACK_CALLED_VAR(passivemotion);
CALLBACK_2_VARS(passivemotion,x,y);
CALLBACK_CALLED_VAR(entry);
CALLBACK_CALLED_VAR(close);
/*CALLBACK_CALLED_VAR(overlaydisplay);
CALLBACK_CALLED_VAR(windowstatus);
CALLBACK_CALLED_VAR(spacemotion);
CALLBACK_CALLED_VAR(spacerotation);
CALLBACK_CALLED_VAR(spacebutton);
CALLBACK_CALLED_VAR(buttonbox);
CALLBACK_CALLED_VAR(dials);
CALLBACK_CALLED_VAR(tabletmotion);
CALLBACK_CALLED_VAR(tabletbutton);
CALLBACK_CALLED_VAR(menustatus);*/
int menudestroy_called = 0 ; /* menudestroy is registered on menu, so don't use above */
#define STRING_LENGTH 10 #define STRING_LENGTH 10
@ -50,11 +73,22 @@ bitmapPrintf (const char *fmt, ...)
glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)buf ) ; glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)buf ) ;
} }
static int
getWindowAndIdx(int *winIdx)
{
int window = glutGetWindow();
if (winIdx)
(*winIdx) = window==windows[0]?0:1;
return window;
}
static void static void
Display(void) Display(void)
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
glClear ( GL_COLOR_BUFFER_BIT ); glClear ( GL_COLOR_BUFFER_BIT );
glDisable ( GL_DEPTH_TEST ); glDisable ( GL_DEPTH_TEST );
@ -69,59 +103,59 @@ Display(void)
glColor3ub ( 0, 0, 0 ); glColor3ub ( 0, 0, 0 );
glRasterPos2i ( 10, glutGet ( GLUT_WINDOW_HEIGHT ) - 20 ); /* 10pt margin above 10pt letters */ glRasterPos2i ( 10, glutGet ( GLUT_WINDOW_HEIGHT ) - 20 ); /* 10pt margin above 10pt letters */
if ( reshape_called ) if ( reshape_called[winIdx] )
{ {
bitmapPrintf ( "Reshape %d: %d %d\n", reshape_seq, reshape_width, reshape_height ); bitmapPrintf ( "Reshape %d: %d %d\n", reshape_seq[winIdx], reshape_width[winIdx], reshape_height[winIdx] );
} }
if ( key_called ) if ( key_called[winIdx] )
{ {
bitmapPrintf ( "Key %d: %d(%c) %d %d\n", key_seq, key_key, key_key, key_x, key_y ); bitmapPrintf ( "Key %d: %d(%c) %d %d\n", key_seq[winIdx], key_key[winIdx], key_key[winIdx], key_x[winIdx], key_y[winIdx] );
} }
if ( special_called ) if ( special_called[winIdx] )
{ {
bitmapPrintf ( "Special %d: %d(%c) %d %d\n", special_seq, special_key, special_key, special_x, special_y ); bitmapPrintf ( "Special %d: %d(%c) %d %d\n", special_seq[winIdx], special_key[winIdx], special_key[winIdx], special_x[winIdx], special_y[winIdx] );
} }
if ( visibility_called ) if ( visibility_called[winIdx] )
{ {
bitmapPrintf ( "Visibility %d: %d\n", visibility_seq, visibility_vis ); bitmapPrintf ( "Visibility %d: %d\n", visibility_seq[winIdx], visibility_vis[winIdx] );
} }
if ( keyup_called ) if ( keyup_called[winIdx] )
{ {
bitmapPrintf ( "Key Up %d: %d(%c) %d %d\n", keyup_seq, keyup_key, keyup_key, keyup_x, keyup_y ); bitmapPrintf ( "Key Up %d: %d(%c) %d %d\n", keyup_seq[winIdx], keyup_key[winIdx], keyup_key[winIdx], keyup_x[winIdx], keyup_y[winIdx] );
} }
if ( specialup_called ) if ( specialup_called[winIdx] )
{ {
bitmapPrintf ( "Special Up %d: %d(%c) %d %d\n", specialup_seq, specialup_key, specialup_key, specialup_x, specialup_y ); bitmapPrintf ( "Special Up %d: %d(%c) %d %d\n", specialup_seq[winIdx], specialup_key[winIdx], specialup_key[winIdx], specialup_x[winIdx], specialup_y[winIdx] );
} }
if ( joystick_called ) if ( joystick_called[winIdx] )
{ {
bitmapPrintf ( "Joystick %d: %d %d %d %d\n", joystick_seq, joystick_a, joystick_b, joystick_c, joystick_d ); bitmapPrintf ( "Joystick %d: %d %d %d %d\n", joystick_seq[winIdx], joystick_a[winIdx], joystick_b[winIdx], joystick_c[winIdx], joystick_d[winIdx] );
} }
if ( mouse_called ) if ( mouse_called[winIdx] )
{ {
bitmapPrintf ( "Mouse %d: %d %d %d %d\n", mouse_seq, mouse_button, mouse_updown, mouse_x, mouse_y ); bitmapPrintf ( "Mouse %d: %d %d %d %d\n", mouse_seq[winIdx], mouse_button[winIdx], mouse_updown[winIdx], mouse_x[winIdx], mouse_y[winIdx] );
} }
if ( mousewheel_called ) if ( mousewheel_called[winIdx] )
{ {
bitmapPrintf ( "Mouse Wheel %d: %d %d %d %d\n", mousewheel_seq, mousewheel_number, mousewheel_direction, mousewheel_x, mousewheel_y ); bitmapPrintf ( "Mouse Wheel %d: %d %d %d %d\n", mousewheel_seq[winIdx], mousewheel_number[winIdx], mousewheel_direction[winIdx], mousewheel_x[winIdx], mousewheel_y[winIdx] );
} }
if ( motion_called ) if ( motion_called[winIdx] )
{ {
bitmapPrintf ( "Motion %d: %d %d\n", motion_seq, motion_x, motion_y ); bitmapPrintf ( "Motion %d: %d %d\n", motion_seq[winIdx], motion_x[winIdx], motion_y[winIdx] );
} }
if ( passivemotion_called ) if ( passivemotion_called[winIdx] )
{ {
bitmapPrintf ( "Passive Motion %d: %d %d\n", passivemotion_seq, passivemotion_x, passivemotion_y ); bitmapPrintf ( "Passive Motion %d: %d %d\n", passivemotion_seq[winIdx], passivemotion_x[winIdx], passivemotion_y[winIdx] );
} }
glMatrixMode ( GL_PROJECTION ); glMatrixMode ( GL_PROJECTION );
@ -166,13 +200,14 @@ Error(const char *fmt, va_list ap)
static void static void
Reshape(int width, int height) Reshape(int width, int height)
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
printf ( "%6d Window %d Reshape Callback: %d %d\n", printf ( "%6d Window %d Reshape Callback: %d %d\n",
++sequence_number, window, width, height ) ; ++sequence_number, window, width, height ) ;
reshape_called = 1 ; reshape_called[winIdx] = 1 ;
reshape_width = width ; reshape_width[winIdx] = width ;
reshape_height = height ; reshape_height[winIdx] = height ;
reshape_seq = sequence_number ; reshape_seq[winIdx] = sequence_number ;
glViewport(0,0,width,height); glViewport(0,0,width,height);
glutPostRedisplay () ; glutPostRedisplay () ;
} }
@ -180,147 +215,156 @@ Reshape(int width, int height)
static void static void
Key(unsigned char key, int x, int y) Key(unsigned char key, int x, int y)
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
printf ( "%6d Window %d Keyboard Callback: %d %d %d\n", printf ( "%6d Window %d Keyboard Callback: %d %d %d\n",
++sequence_number, window, key, x, y ) ; ++sequence_number, window, key, x, y ) ;
key_called = 1 ; key_called[winIdx] = 1 ;
key_key = key ; key_key[winIdx] = key ;
key_x = x ; key_x[winIdx] = x ;
key_y = y ; key_y[winIdx] = y ;
key_seq = sequence_number ; key_seq[winIdx] = sequence_number ;
glutPostRedisplay () ; glutPostRedisplay () ;
} }
static void static void
Special(int key, int x, int y) Special(int key, int x, int y)
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
printf ( "%6d Window %d Special Key Callback: %d %d %d\n", printf ( "%6d Window %d Special Key Callback: %d %d %d\n",
++sequence_number, window, key, x, y ) ; ++sequence_number, window, key, x, y ) ;
special_called = 1 ; special_called[winIdx] = 1 ;
special_key = key ; special_key[winIdx] = key ;
special_x = x ; special_x[winIdx] = x ;
special_y = y ; special_y[winIdx] = y ;
special_seq = sequence_number ; special_seq[winIdx] = sequence_number ;
glutPostRedisplay () ; glutPostRedisplay () ;
} }
static void static void
Visibility(int vis) Visibility(int vis)
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
printf ( "%6d Window %d Visibility Callback: %d\n", printf ( "%6d Window %d Visibility Callback: %d\n",
++sequence_number, window, vis ) ; ++sequence_number, window, vis ) ;
visibility_called = 1 ; visibility_called[winIdx] = 1 ;
visibility_vis = vis ; visibility_vis[winIdx] = vis ;
visibility_seq = sequence_number ; visibility_seq[winIdx] = sequence_number ;
glutPostRedisplay () ; glutPostRedisplay () ;
} }
static void static void
KeyUp(unsigned char key, int x, int y) KeyUp(unsigned char key, int x, int y)
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
printf ( "%6d Window %d Key Release Callback: %d %d %d\n", printf ( "%6d Window %d Key Release Callback: %d %d %d\n",
++sequence_number, window, key, x, y ) ; ++sequence_number, window, key, x, y ) ;
keyup_called = 1 ; keyup_called[winIdx] = 1 ;
keyup_key = key ; keyup_key[winIdx] = key ;
keyup_x = x ; keyup_x[winIdx] = x ;
keyup_y = y ; keyup_y[winIdx] = y ;
keyup_seq = sequence_number ; keyup_seq[winIdx] = sequence_number ;
glutPostRedisplay () ; glutPostRedisplay () ;
} }
static void static void
SpecialUp(int key, int x, int y) SpecialUp(int key, int x, int y)
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
printf ( "%6d Window %d Special Key Release Callback: %d %d %d\n", printf ( "%6d Window %d Special Key Release Callback: %d %d %d\n",
++sequence_number, window, key, x, y ) ; ++sequence_number, window, key, x, y ) ;
specialup_called = 1 ; specialup_called[winIdx] = 1 ;
specialup_key = key ; specialup_key[winIdx] = key ;
specialup_x = x ; specialup_x[winIdx] = x ;
specialup_y = y ; specialup_y[winIdx] = y ;
specialup_seq = sequence_number ; specialup_seq[winIdx] = sequence_number ;
glutPostRedisplay () ; glutPostRedisplay () ;
} }
static void static void
Joystick( unsigned int a, int b, int c, int d) /* Need meaningful names */ Joystick( unsigned int a, int b, int c, int d) /* Need meaningful names */
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
printf ( "%6d Window %d Joystick Callback: %d %d %d %d\n", printf ( "%6d Window %d Joystick Callback: %d %d %d %d\n",
++sequence_number, window, a, b, c, d ) ; ++sequence_number, window, a, b, c, d ) ;
joystick_called = 1 ; joystick_called[winIdx] = 1 ;
joystick_a = a ; joystick_a[winIdx] = a ;
joystick_b = b ; joystick_b[winIdx] = b ;
joystick_c = c ; joystick_c[winIdx] = c ;
joystick_d = d ; joystick_d[winIdx] = d ;
joystick_seq = sequence_number ; joystick_seq[winIdx] = sequence_number ;
glutPostRedisplay () ; glutPostRedisplay () ;
} }
static void static void
Mouse(int button, int updown, int x, int y) Mouse(int button, int updown, int x, int y)
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
printf ( "%6d Window %d Mouse Click Callback: %d %d %d %d\n", printf ( "%6d Window %d Mouse Click Callback: %d %d %d %d\n",
++sequence_number, window, button, updown, x, y ) ; ++sequence_number, window, button, updown, x, y ) ;
mouse_called = 1 ; mouse_called[winIdx] = 1 ;
mouse_button = button ; mouse_button[winIdx] = button ;
mouse_updown = updown ; mouse_updown[winIdx] = updown ;
mouse_x = x ; mouse_x[winIdx] = x ;
mouse_y = y ; mouse_y[winIdx] = y ;
mouse_seq = sequence_number ; mouse_seq[winIdx] = sequence_number ;
glutPostRedisplay () ; glutPostRedisplay () ;
} }
static void static void
MouseWheel(int wheel_number, int direction, int x, int y) MouseWheel(int wheel_number, int direction, int x, int y)
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
printf ( "%6d Window %d Mouse Wheel Callback: %d %d %d %d\n", printf ( "%6d Window %d Mouse Wheel Callback: %d %d %d %d\n",
++sequence_number, window, wheel_number, direction, x, y ) ; ++sequence_number, window, wheel_number, direction, x, y ) ;
mousewheel_called = 1 ; mousewheel_called[winIdx] = 1 ;
mousewheel_number = wheel_number ; mousewheel_number[winIdx] = wheel_number ;
mousewheel_direction = direction ; mousewheel_direction[winIdx] = direction ;
mousewheel_x = x ; mousewheel_x[winIdx] = x ;
mousewheel_y = y ; mousewheel_y[winIdx] = y ;
mousewheel_seq = sequence_number ; mousewheel_seq[winIdx] = sequence_number ;
glutPostRedisplay () ; glutPostRedisplay () ;
} }
static void static void
Motion(int x, int y) Motion(int x, int y)
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
printf ( "%6d Window %d Mouse Motion Callback: %d %d\n", printf ( "%6d Window %d Mouse Motion Callback: %d %d\n",
++sequence_number, window, x, y ) ; ++sequence_number, window, x, y ) ;
motion_called = 1 ; motion_called[winIdx] = 1 ;
motion_x = x ; motion_x[winIdx] = x ;
motion_y = y ; motion_y[winIdx] = y ;
motion_seq = sequence_number ; motion_seq[winIdx] = sequence_number ;
glutPostRedisplay () ; glutPostRedisplay () ;
} }
static void static void
PassiveMotion(int x, int y) PassiveMotion(int x, int y)
{ {
int window = glutGetWindow () ; int winIdx;
int window = getWindowAndIdx(&winIdx);
printf ( "%6d Window %d Mouse Passive Motion Callback: %d %d\n", printf ( "%6d Window %d Mouse Passive Motion Callback: %d %d\n",
++sequence_number, window, x, y ) ; ++sequence_number, window, x, y ) ;
passivemotion_called = 1 ; passivemotion_called[winIdx] = 1 ;
passivemotion_x = x ; passivemotion_x[winIdx] = x ;
passivemotion_y = y ; passivemotion_y[winIdx] = y ;
passivemotion_seq = sequence_number ; passivemotion_seq[winIdx] = sequence_number ;
glutPostRedisplay () ; glutPostRedisplay () ;
} }
static void static void
Entry(int state) Entry(int state)
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
entry_called = 1 ;
printf ( "%6d Window %d Entry Callback: %d\n", printf ( "%6d Window %d Entry Callback: %d\n",
++sequence_number, window, state ) ; ++sequence_number, window, state ) ;
glutPostRedisplay () ; glutPostRedisplay () ;
@ -329,8 +373,7 @@ Entry(int state)
static void static void
Close(void) Close(void)
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
close_called = 1 ;
printf ( "%6d Window %d Close Callback\n", printf ( "%6d Window %d Close Callback\n",
++sequence_number, window ) ; ++sequence_number, window ) ;
} }
@ -338,8 +381,7 @@ Close(void)
static void static void
OverlayDisplay(void) OverlayDisplay(void)
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
overlaydisplay_called = 1 ;
printf ( "%6d Window %d OverlayDisplay Callback\n", printf ( "%6d Window %d OverlayDisplay Callback\n",
++sequence_number, window ) ; ++sequence_number, window ) ;
glutPostRedisplay () ; glutPostRedisplay () ;
@ -348,8 +390,7 @@ OverlayDisplay(void)
static void static void
WindowStatus(int state) WindowStatus(int state)
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
windowstatus_called = 1 ;
printf ( "%6d Window %d WindowStatus Callback: %d\n", printf ( "%6d Window %d WindowStatus Callback: %d\n",
++sequence_number, window, state ) ; ++sequence_number, window, state ) ;
glutPostRedisplay () ; glutPostRedisplay () ;
@ -358,8 +399,7 @@ WindowStatus(int state)
static void static void
SpaceMotion(int x, int y, int z) SpaceMotion(int x, int y, int z)
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
spacemotion_called = 1 ;
printf ( "%6d Window %d SpaceMotion Callback: %d %d %d\n", printf ( "%6d Window %d SpaceMotion Callback: %d %d %d\n",
++sequence_number, window, x, y, z ) ; ++sequence_number, window, x, y, z ) ;
glutPostRedisplay () ; glutPostRedisplay () ;
@ -368,8 +408,7 @@ SpaceMotion(int x, int y, int z)
static void static void
SpaceRotation(int x, int y, int z) SpaceRotation(int x, int y, int z)
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
spacerotation_called = 1 ;
printf ( "%6d Window %d SpaceRotation Callback: %d %d %d\n", printf ( "%6d Window %d SpaceRotation Callback: %d %d %d\n",
++sequence_number, window, x, y, z ) ; ++sequence_number, window, x, y, z ) ;
glutPostRedisplay () ; glutPostRedisplay () ;
@ -378,8 +417,7 @@ SpaceRotation(int x, int y, int z)
static void static void
SpaceButton(int button, int updown) SpaceButton(int button, int updown)
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
spacebutton_called = 1 ;
printf ( "%6d Window %d SpaceButton Callback: %d %d\n", printf ( "%6d Window %d SpaceButton Callback: %d %d\n",
++sequence_number, window, button, updown ) ; ++sequence_number, window, button, updown ) ;
glutPostRedisplay () ; glutPostRedisplay () ;
@ -388,8 +426,7 @@ SpaceButton(int button, int updown)
static void static void
Dials(int x, int y) Dials(int x, int y)
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
dials_called = 1 ;
printf ( "%6d Window %d Dials Callback: %d %d\n", printf ( "%6d Window %d Dials Callback: %d %d\n",
++sequence_number, window, x, y ) ; ++sequence_number, window, x, y ) ;
glutPostRedisplay () ; glutPostRedisplay () ;
@ -398,8 +435,7 @@ Dials(int x, int y)
static void static void
ButtonBox(int button, int updown) ButtonBox(int button, int updown)
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
buttonbox_called = 1 ;
printf ( "%6d Window %d ButtonBox Callback: %d %d\n", printf ( "%6d Window %d ButtonBox Callback: %d %d\n",
++sequence_number, window, button, updown ) ; ++sequence_number, window, button, updown ) ;
glutPostRedisplay () ; glutPostRedisplay () ;
@ -408,8 +444,7 @@ ButtonBox(int button, int updown)
static void static void
TabletMotion(int x, int y) TabletMotion(int x, int y)
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
tabletmotion_called = 1 ;
printf ( "%6d Window %d TabletMotion Callback: %d %d\n", printf ( "%6d Window %d TabletMotion Callback: %d %d\n",
++sequence_number, window, x, y ) ; ++sequence_number, window, x, y ) ;
glutPostRedisplay () ; glutPostRedisplay () ;
@ -418,8 +453,7 @@ TabletMotion(int x, int y)
static void static void
TabletButton(int button, int updown, int x, int y) TabletButton(int button, int updown, int x, int y)
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
tabletbutton_called = 1 ;
printf ( "%6d Window %d TabletButton Callback: %d %d %d %d\n", printf ( "%6d Window %d TabletButton Callback: %d %d %d %d\n",
++sequence_number, window, button, updown, x, y ) ; ++sequence_number, window, button, updown, x, y ) ;
glutPostRedisplay () ; glutPostRedisplay () ;
@ -428,7 +462,7 @@ TabletButton(int button, int updown, int x, int y)
static void static void
MenuCallback ( int menuID ) MenuCallback ( int menuID )
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
printf( "%6d Window %d MenuCallback - menuID is %d\n", printf( "%6d Window %d MenuCallback - menuID is %d\n",
++sequence_number, window, menuID ); ++sequence_number, window, menuID );
} }
@ -436,7 +470,7 @@ MenuCallback ( int menuID )
static void static void
MenuDestroy( void ) MenuDestroy( void )
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
menudestroy_called = 1 ; menudestroy_called = 1 ;
printf ( "%6d Window %d MenuDestroy Callback\n", printf ( "%6d Window %d MenuDestroy Callback\n",
++sequence_number, window ) ; ++sequence_number, window ) ;
@ -448,7 +482,7 @@ MenuDestroy( void )
static void static void
MenuStatus( int status, int x, int y ) MenuStatus( int status, int x, int y )
{ {
int window = glutGetWindow () ; int window = getWindowAndIdx(NULL);
menudestroy_called = 1 ; menudestroy_called = 1 ;
printf ( "%6d Window %d MenuStatus Callback: %d %d %d\n", printf ( "%6d Window %d MenuStatus Callback: %d %d %d\n",
++sequence_number, window, status, x, y ) ; ++sequence_number, window, status, x, y ) ;