diff --git a/freeglut/freeglut/src/freeglut_spaceball.c b/freeglut/freeglut/src/freeglut_spaceball.c index 154e52d..a2e70ed 100644 --- a/freeglut/freeglut/src/freeglut_spaceball.c +++ b/freeglut/freeglut/src/freeglut_spaceball.c @@ -143,11 +143,13 @@ int fgIsSpaceballXEvent(const XEvent *xev) { spnav_event sev; + if(spnav_win != fgStructure.CurrentWindow) { + /* this will also initialize spaceball if needed (first call) */ + fgSpaceballSetWindow(fgStructure.CurrentWindow); + } + if(!sball_initialized) { - fgInitialiseSpaceball(); - if(!sball_initialized) { - return 0; - } + return 0; } return spnav_x11_event(xev, &sev); diff --git a/freeglut/freeglut/src/freeglut_window.c b/freeglut/freeglut/src/freeglut_window.c index e19eaff..f0e0754 100644 --- a/freeglut/freeglut/src/freeglut_window.c +++ b/freeglut/freeglut/src/freeglut_window.c @@ -600,9 +600,6 @@ void fgSetWindow ( SFG_Window *window ) window->Window.Handle, window->Window.Context ); - - /* also register this window to receive spaceball events */ - fgSpaceballSetWindow(window); } #elif TARGET_HOST_MS_WINDOWS if( fgStructure.CurrentWindow )