From 51c968449cc05627cdc3aa1ccf93ee7c75bf10c9 Mon Sep 17 00:00:00 2001 From: fayjf Date: Thu, 3 Dec 2009 03:21:12 +0000 Subject: [PATCH] Uploading spaceball/set-window patch per e-mail from John Tsiombikas dated 1:34 PM, 12/2/09 git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@856 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/freeglut_spaceball.c | 10 ++++++---- freeglut/freeglut/src/freeglut_window.c | 3 --- 2 files changed, 6 insertions(+), 7 deletions(-) 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 )