I have a freeglut application that needs to track window focus. To do this, there is a patch attached which adds a new callback, glutFocusFunc(), which is protyped in freeglut_ext.h. I have implemented it for X11 and Win32 and it seems to work.
The callback is of type void (*)(int). The int is nonzero if the window gained focus, and zero if the window lost it.
I hope that you can apply this patch, since I think others might be interested in this feature.