X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_spaceball.c;h=7c9d0731066c8877dcdada259cbd16b64a3cf908;hb=1fd9514b5c5df8a4bf974787f26f6cc3dd84c1cc;hp=154e52dce64fffee4addf476a6d327005dc8150f;hpb=5510bc295094794b4804bb97db4bb58ebba3c5b0;p=freeglut diff --git a/src/freeglut_spaceball.c b/src/freeglut_spaceball.c index 154e52d..7c9d073 100644 --- a/src/freeglut_spaceball.c +++ b/src/freeglut_spaceball.c @@ -10,6 +10,8 @@ #include #include "freeglut_internal.h" +/* -- PRIVATE FUNCTIONS --------------------------------------------------- */ + #if TARGET_HOST_POSIX_X11 #include @@ -143,11 +145,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); @@ -216,7 +220,7 @@ OF SUCH DAMAGE. #include #include -#if HAVE_ERRNO_H +#ifdef HAVE_ERRNO_H #include #endif