projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Made all the "glutJoystickXXX" functions part of the freeglut extensions.
[freeglut]
/
src
/
freeglut_main.c
diff --git
a/src/freeglut_main.c
b/src/freeglut_main.c
index
2f95b63
..
8ade92b
100644
(file)
--- a/
src/freeglut_main.c
+++ b/
src/freeglut_main.c
@@
-413,7
+413,7
@@
static int fghHaveJoystick( void )
}
static void fghHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e)
{
}
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;
{
e->found = GL_TRUE;
e->data = w;
@@
-495,17
+495,17
@@
static void fghSleepForEvents( void )
#if TARGET_HOST_UNIX_X11
/*
#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;
{
int ret = 0;
- if( event->xkey.state & ( ShiftMask | LockMask ) )
+ if( state & ( ShiftMask | LockMask ) )
ret |= GLUT_ACTIVE_SHIFT;
ret |= GLUT_ACTIVE_SHIFT;
- if( event->xkey.state & ControlMask )
+ if( state & ControlMask )
ret |= GLUT_ACTIVE_CTRL;
ret |= GLUT_ACTIVE_CTRL;
- if( event->xkey.state & Mod1Mask )
+ if( state & Mod1Mask )
ret |= GLUT_ACTIVE_ALT;
return ret;
ret |= GLUT_ACTIVE_ALT;
return ret;
@@
-1099,14
+1099,6
@@
void FGAPIENTRY glutMainLoopEvent( void )
case VisibilityNotify:
{
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:
/*
* Sending this event, the X server can notify us that the window
* has just acquired one of the three possible visibility states:
@@
-1115,6
+1107,7
@@
void FGAPIENTRY glutMainLoopEvent( void )
* VisibilityNotify event when iconifying a window, we only get an
* UnmapNotify then.
*/
* VisibilityNotify event when iconifying a window, we only get an
* UnmapNotify then.
*/
+ GETWINDOW( xvisibility );
switch( event.xvisibility.state )
{
case VisibilityUnobscured:
switch( event.xvisibility.state )
{
case VisibilityUnobscured:
@@
-1180,14
+1173,15
@@
void FGAPIENTRY glutMainLoopEvent( void )
* XXX track ButtonPress/ButtonRelease events in our own
* XXX bit-mask?
*/
* 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 ) );
INVOKE_WCB( *window, Motion, ( event.xmotion.x,
event.xmotion.y ) );
- else
+ } else {
INVOKE_WCB( *window, Passive, ( event.xmotion.x,
event.xmotion.y ) );
INVOKE_WCB( *window, Passive, ( event.xmotion.x,
event.xmotion.y ) );
+ }
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
}
break;
@@
-1233,7
+1227,7
@@
void FGAPIENTRY glutMainLoopEvent( void )
! FETCH_WCB( *window, MouseWheel ) )
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 ) ) )
/* Finally execute the mouse or mouse wheel callback */
if( ( button < glutDeviceGet ( GLUT_NUM_MOUSE_BUTTONS ) ) || ( ! FETCH_WCB( *window, MouseWheel ) ) )
@@
-1268,9
+1262,7
@@
void FGAPIENTRY glutMainLoopEvent( void )
event.xbutton.y )
);
}
event.xbutton.y )
);
}
-
- /* Trash the modifiers state */
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
}
break;
@@
-1345,11
+1337,11
@@
void FGAPIENTRY glutMainLoopEvent( void )
if( keyboard_cb )
{
fgSetWindow( window );
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
);
keyboard_cb( asciiCode[ 0 ],
event.xkey.x, event.xkey.y
);
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
}
else
}
}
else
@@
-1399,9
+1391,9
@@
void FGAPIENTRY glutMainLoopEvent( void )
if( special_cb && (special != -1) )
{
fgSetWindow( window );
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 );
special_cb( special, event.xkey.x, event.xkey.y );
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
}
}
}
}
}
@@
-1599,13
+1591,13
@@
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
if( fgStructure.MenuContext )
wglMakeCurrent( window->Window.Device,
if( fgStructure.MenuContext )
wglMakeCurrent( window->Window.Device,
- fgStructure.MenuContext->Context
+ fgStructure.MenuContext->MContext
);
else
{
fgStructure.MenuContext =
(SFG_MenuContext *)malloc( sizeof(SFG_MenuContext) );
);
else
{
fgStructure.MenuContext =
(SFG_MenuContext *)malloc( sizeof(SFG_MenuContext) );
- fgStructure.MenuContext->Context =
+ fgStructure.MenuContext->MContext =
wglCreateContext( window->Window.Device );
}
wglCreateContext( window->Window.Device );
}
@@
-1770,7
+1762,7
@@
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
INVOKE_WCB( *window, Passive, ( window->State.MouseX,
window->State.MouseY ) );
INVOKE_WCB( *window, Passive, ( window->State.MouseX,
window->State.MouseY ) );
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
}
break;
@@
-1880,7
+1872,7
@@
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
)
);
)
);
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
}
break;
@@
-1947,7
+1939,7
@@
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
);
}
);
}
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break ;
}
break ;
@@
-2034,7
+2026,7
@@
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
window->State.MouseX, window->State.MouseY )
);
window->State.MouseX, window->State.MouseY )
);
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
}
break;
@@
-2117,7
+2109,7
@@
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
window->State.MouseX, window->State.MouseY )
);
window->State.MouseX, window->State.MouseY )
);
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
}
break;
@@
-2132,7
+2124,7
@@
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
( (char)wParam,
window->State.MouseX, window->State.MouseY )
);
( (char)wParam,
window->State.MouseX, window->State.MouseY )
);
- fgState.Modifiers = 0xffffffff;
+ fgState.Modifiers = INVALID_MODIFIERS;
}
break;
}
break;