( HWND handle, int width, int height )
#endif
{
+ SFG_Window *current_window = fgStructure.Window ;
+
/*
* Find the window that received the reshape event
*/
* we resize the window.
*/
window->State.Redisplay = TRUE ;
+
+ /*
+ * If this is a menu, restore the active window
+ */
+ if ( window->IsMenu )
+ fgSetWindow ( current_window ) ;
}
/*
(window->State.Redisplay == TRUE) &&
(window->State.Visible == TRUE) )
{
+ SFG_Window *current_window = fgStructure.Window ;
+
/*
* OKi, this is the case: have the window set as the current one
*/
* And execute the display callback immediately after
*/
window->Callbacks.Display();
+
+ fgSetWindow ( current_window ) ;
}
#elif TARGET_HOST_WIN32
*/
if( window->State.NeedToResize )
{
+ SFG_Window *current_window = fgStructure.Window ;
+
fgSetWindow( window );
fghReshapeWindowByHandle(
* Never ever do that again:
*/
window->State.NeedToResize = FALSE;
+
+ fgSetWindow ( current_window ) ;
}
/*
/*
* Add the timer to the timed out timers list
*/
- fgListRemove( &fgState.Timers, &timer->Node );
+ fgListRemove( &fgState.Timers, &timer->Node );
fgListAppend( &timedOut, &timer->Node );
}
}
if( window->Callbacks.Entry != NULL )
{
/*
+ * Set the current window
+ */
+ fgSetWindow ( window ) ;
+
+ /*
* Yeah. Notify the window about having the mouse cursor over
*/
window->Callbacks.Entry( GLUT_ENTERED );
if( window->Callbacks.Entry != NULL )
{
/*
+ * Set the current window
+ */
+ fgSetWindow ( window ) ;
+
+ /*
* Yeah. Notify the window about having the mouse cursor over
*/
window->Callbacks.Entry( GLUT_LEFT );
/*
* Let's make the window redraw as a result of the mouse motion.
*/
- if ( window->IsMenu ) window->State.Redisplay = TRUE ;
+ window->State.Redisplay = TRUE ;
+
+ /*
+ * Since the window is a menu, make the parent window current
+ */
+ fgSetWindow ( window->ActiveMenu->ParentWindow ) ;
break;
}
/*
* Set the current window
*/
- fgStructure.Window = window ;
+ fgSetWindow ( window ) ;
/*
* Yup. Have it executed immediately
/*
* Set the current window
*/
- fgStructure.Window = window ;
+ fgSetWindow ( window ) ;
/*
* That's right, and there is a passive callback, too.
if ( pressed == TRUE ) fgDeactivateMenu ( window->ActiveMenu->ParentWindow ) ;
}
+ /*
+ * Let's make the window redraw as a result of the mouse click and menu activity.
+ */
+ window->State.Redisplay = TRUE ;
+
break ;
}
if ( ( window->Menu[ button ] != NULL ) && ( pressed == TRUE ) )
{
/*
+ * Let's make the window redraw as a result of the mouse click.
+ */
+ window->State.Redisplay = TRUE ;
+
+ /*
* Set the current window
*/
fgSetWindow( window );
/*
* Check if there is a mouse callback hooked to the window
*/
- if( fgStructure.Window->Callbacks.Mouse == NULL )
+ if( window->Callbacks.Mouse == NULL )
break;
/*
* Set the current window
*/
- fgSetWindow( window );
+ fgSetWindow ( window );
/*
* Remember the current modifiers state
len = XLookupString( &event.xkey, asciiCode, sizeof(asciiCode), &keySym, &composeStatus );
/*
- * Get ready to calling the keyboard/special callbacks
- */
- fgSetWindow( window );
-
- /*
* GLUT API tells us to have two separate callbacks...
*/
if( len > 0 )
if( keyboard_cb != NULL )
{
/*
+ * Set the current window
+ */
+ fgSetWindow( window );
+
+ /*
* Remember the current modifiers state
*/
modifiers = 0;
if( (special_cb != NULL) && (special != -1) )
{
/*
+ * Set the current window
+ */
+ fgSetWindow( window );
+
+ /*
* Remember the current modifiers state
*/
modifiers = 0;
/*
* No messages in the queue, which means we are idling...
*/
- if ( fgState.IdleCallback != NULL )
+ if( fgState.IdleCallback != NULL )
fgState.IdleCallback();
/*
/*
* No messages in the queue, which means we are idling...
*/
- if ( fgState.IdleCallback != NULL )
+ if( fgState.IdleCallback != NULL )
fgState.IdleCallback();
/*
while ( window != NULL )
{
if ( window->Callbacks.Visibility != NULL )
+ {
+ SFG_Window *current_window = fgStructure.Window ;
+
+ /*
+ * Set the current window
+ */
+ fgSetWindow( window );
+
window->Callbacks.Visibility ( window->State.Visible ) ;
+ /*
+ * Restore the current window
+ */
+ fgSetWindow( current_window );
+ }
+
window = (SFG_Window *)window->Node.Next ;
}
#endif
/*
* Let's make the window redraw as a result of the mouse motion.
*/
- if ( window->IsMenu ) window->State.Redisplay = TRUE ;
+ window->State.Redisplay = TRUE ;
+
+ /*
+ * Since the window is a menu, make the parent window current
+ */
+ fgSetWindow ( window->ActiveMenu->ParentWindow ) ;
break;
}
if ( pressed == TRUE ) fgDeactivateMenu ( window->ActiveMenu->ParentWindow ) ;
}
+ /*
+ * Let's make the window redraw as a result of the mouse click and menu activity.
+ */
+ if ( ! window->IsMenu ) window->State.Redisplay = TRUE ;
+
break ;
}
if ( ( window->Menu[ button ] != NULL ) && ( pressed == TRUE ) )
{
/*
+ * Let's make the window redraw as a result of the mouse click.
+ */
+ window->State.Redisplay = TRUE ;
+
+ /*
* Set the current window
*/
fgSetWindow( window );
/*
* Check if there is a mouse callback hooked to the window
*/
- if( fgStructure.Window->Callbacks.Mouse == NULL )
+ if( window->Callbacks.Mouse == NULL )
break;
/*
* Set the current window
*/
- fgSetWindow( window );
+ fgSetWindow ( window );
/*
* Remember the current modifiers state.
/*
* Finally execute the mouse callback
*/
- fgStructure.Window->Callbacks.Mouse(
+ window->Callbacks.Mouse(
button,
pressed == TRUE ? GLUT_DOWN : GLUT_UP,
window->State.MouseX,
break;
/*
- * Set the current window
- */
- fgSetWindow( window );
-
- /*
* Remember the current modifiers state. This is done here in order
* to make sure the VK_DELETE keyboard callback is executed properly.
*/
* The delete key should be treated as an ASCII keypress:
*/
if( window->Callbacks.Keyboard != NULL )
+ {
+ fgSetWindow( window );
window->Callbacks.Keyboard( 127, window->State.MouseX, window->State.MouseY );
+ }
}
/*
if( (keypress != -1) && (window->Callbacks.Special != NULL) )
{
/*
+ * Set the current window
+ */
+ fgSetWindow( window );
+
+ /*
* Have the special callback executed:
*/
window->Callbacks.Special( keypress, window->State.MouseX, window->State.MouseY );
POINT mouse_pos ;
/*
- * Set the current window
- */
- fgSetWindow( window );
-
- /*
* Remember the current modifiers state. This is done here in order
* to make sure the VK_DELETE keyboard callback is executed properly.
*/
* The delete key should be treated as an ASCII keypress:
*/
if( window->Callbacks.KeyboardUp != NULL )
+ {
+ fgSetWindow ( window ) ;
window->Callbacks.KeyboardUp( 127, window->State.MouseX, window->State.MouseY );
+ }
break ;
default:
wParam=code[ 0 ];
if( window->Callbacks.KeyboardUp != NULL )
+ {
+ /*
+ * Set the current window
+ */
+ fgSetWindow( window );
+
window->Callbacks.KeyboardUp( (char)wParam, window->State.MouseX, window->State.MouseY );
+ }
}
}
if( (keypress != -1) && (window->Callbacks.SpecialUp != NULL) )
{
/*
+ * Set the current window
+ */
+ fgSetWindow( window );
+
+ /*
* Have the special callback executed:
*/
window->Callbacks.SpecialUp( keypress, window->State.MouseX, window->State.MouseY );
if( window->Callbacks.Keyboard != NULL )
{
/*
+ * Set the current window
+ */
+ fgSetWindow( window );
+
+ /*
* Remember the current modifiers state
*/
window->State.Modifiers =
case WM_CAPTURECHANGED : /* User has finished resizing the window, force a redraw */
if ( window->Callbacks.Display )
+ {
+ /*
+ * Set the current window
+ */
+ fgSetWindow( window );
+
window->Callbacks.Display () ;
+ }
/* lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ) ; */
break ;