This sounds familiar. I use focus follow mouse and have applied several patches to get it to work better. You might try "Allow focus stealing just after launching an app" by Brian Mattern and "Fix undermouse focus when window obscured by menu" by me. If you can't find these in the archives I can send them.