GL_FALSE, /* GLDebugSwitch */
GL_FALSE, /* XSyncSwitch */
GLUT_KEY_REPEAT_ON, /* KeyRepeat */
- 0xffffffff, /* Modifiers */
+ INVALID_MODIFIERS, /* Modifiers */
0, /* FPSInterval */
0, /* SwapCount */
0, /* SwapTime */
fgState.ExecState = GLUT_EXEC_STATE_INIT;
fgState.KeyRepeat = GLUT_KEY_REPEAT_ON;
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
fgState.GameModeSize.X = 640;
fgState.GameModeSize.Y = 480;
#if TARGET_HOST_UNIX_X11
/*
- * Returns GLUT modifier mask for an XEvent.
+ * Returns GLUT modifier mask for the state field of an X11 event.
*/
-static int fghGetXModifiers( XEvent *event )
+static int fghGetXModifiers( int state )
{
int ret = 0;
- if( event->xkey.state & ( ShiftMask | LockMask ) )
+ if( state & ( ShiftMask | LockMask ) )
ret |= GLUT_ACTIVE_SHIFT;
- if( event->xkey.state & ControlMask )
+ if( state & ControlMask )
ret |= GLUT_ACTIVE_CTRL;
- if( event->xkey.state & Mod1Mask )
+ if( state & Mod1Mask )
ret |= GLUT_ACTIVE_ALT;
return ret;
* XXX track ButtonPress/ButtonRelease events in our own
* XXX bit-mask?
*/
-#define BUTTON_MASK \
- ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask )
- if ( event.xmotion.state & BUTTON_MASK )
+ fgState.Modifiers = fghGetXModifiers( event.xmotion.state );
+ if ( event.xmotion.state & ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) ) {
INVOKE_WCB( *window, Motion, ( event.xmotion.x,
event.xmotion.y ) );
- else
+ } else {
INVOKE_WCB( *window, Passive, ( event.xmotion.x,
event.xmotion.y ) );
+ }
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
! FETCH_WCB( *window, MouseWheel ) )
break;
- fgState.Modifiers = fghGetXModifiers( &event );
+ fgState.Modifiers = fghGetXModifiers( event.xbutton.state );
/* Finally execute the mouse or mouse wheel callback */
if( ( button < glutDeviceGet ( GLUT_NUM_MOUSE_BUTTONS ) ) || ( ! FETCH_WCB( *window, MouseWheel ) ) )
event.xbutton.y )
);
}
-
- /* Trash the modifiers state */
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
if( keyboard_cb )
{
fgSetWindow( window );
- fgState.Modifiers = fghGetXModifiers( &event );
+ fgState.Modifiers = fghGetXModifiers( event.xkey.state );
keyboard_cb( asciiCode[ 0 ],
event.xkey.x, event.xkey.y
);
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
}
else
if( special_cb && (special != -1) )
{
fgSetWindow( window );
- fgState.Modifiers = fghGetXModifiers( &event );
+ fgState.Modifiers = fghGetXModifiers( event.xkey.state );
special_cb( special, event.xkey.x, event.xkey.y );
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
}
}
INVOKE_WCB( *window, Passive, ( window->State.MouseX,
window->State.MouseY ) );
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
)
);
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
);
}
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break ;
window->State.MouseX, window->State.MouseY )
);
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
window->State.MouseX, window->State.MouseY )
);
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
( (char)wParam,
window->State.MouseX, window->State.MouseY )
);
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;