From: John F. Fay Date: Thu, 3 Dec 2009 03:21:12 +0000 (+0000) Subject: Uploading spaceball/set-window patch per e-mail from John Tsiombikas dated 1:34 PM... X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=ac26c64653954569627ad5413240cbd8453cd814;p=freeglut Uploading spaceball/set-window patch per e-mail from John Tsiombikas dated 1:34 PM, 12/2/09 git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@856 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/src/freeglut_spaceball.c b/src/freeglut_spaceball.c index 154e52d..a2e70ed 100644 --- a/src/freeglut_spaceball.c +++ b/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/src/freeglut_window.c b/src/freeglut_window.c index e19eaff..f0e0754 100644 --- a/src/freeglut_window.c +++ b/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 )