X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_spaceball.c;h=7c9d0731066c8877dcdada259cbd16b64a3cf908;hb=a160acfee096bef8a8c51194efa8e2262e719125;hp=a36008e08038c6a4ab9794d3ff31fc8ac3333149;hpb=8507764d48cceb8461f9d0194915fa0b7fb58447;p=freeglut diff --git a/src/freeglut_spaceball.c b/src/freeglut_spaceball.c index a36008e..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); @@ -215,7 +219,10 @@ OF SUCH DAMAGE. #include #include #include + +#ifdef HAVE_ERRNO_H #include +#endif #include #include