}
static void fghHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e)
{
- if( w->State.Redisplay )
+ if( w->State.Redisplay && w->State.Visible )
{
e->found = GL_TRUE;
e->data = w;
#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;
case VisibilityNotify:
{
- GETWINDOW( xvisibility );
- /*
- * XXX INVOKE_WCB() does this check for us.
- */
- if( ! FETCH_WCB( *window, WindowStatus ) )
- break;
- fgSetWindow( window );
-
/*
* Sending this event, the X server can notify us that the window
* has just acquired one of the three possible visibility states:
* VisibilityNotify event when iconifying a window, we only get an
* UnmapNotify then.
*/
+ GETWINDOW( xvisibility );
switch( event.xvisibility.state )
{
case VisibilityUnobscured:
* 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;
}
}
}
if( fgStructure.MenuContext )
wglMakeCurrent( window->Window.Device,
- fgStructure.MenuContext->Context
+ fgStructure.MenuContext->MContext
);
else
{
fgStructure.MenuContext =
(SFG_MenuContext *)malloc( sizeof(SFG_MenuContext) );
- fgStructure.MenuContext->Context =
+ fgStructure.MenuContext->MContext =
wglCreateContext( window->Window.Device );
}
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;