This fix came from the following thread in ubuntuforums.
This blog post is a revival of an old post I made to the thread last November.
When using Ubuntu/Gnome with nvidia restricted driver, and separate X screens setting, you will find that the menu/window in the first screen is slow in opening. There is a lag, typically one or two seconds after a mouse-click, before you get a response. I faced this issue since Gutsy, and still needed the fix in Hardy.
After some investigation and looking at information given by a few people, I came upon the solution, which I posted in page 3 of that thread. Since then, many more people have contributed refinements to the solution.
Run two instances of compiz, one for each of the X screens. To do this, create a bash script as follows:
#!/bin/bash sleep 5 DISPLAY=:0.0 compiz --only-current-screen & DISPLAY=:0.1 compiz --only-current-screen &
Then, add the script into Sessions, so that it will run during the user’s login.