One of the applications I like to use on Windows is Mousenitor, which enables advanced mouse control for users with more than one monitor. It was written by a friend. I haven’t yet figured out the best way to trap my mouse on one monitor in Linux, but a little application named Jail offers a rudimentary implementation. It was originally written by Sebastien Marion, but I picked up a slightly modified version from the Ubuntu forums.
If you want to compile it yourself you need to grab
apt-get install build-essential libx11-dev libxtst-dev in Debian (and presumably the same for derivatives like Ubuntu). For good order I also uploaded the source, including my compiled x64 binary, to my own server lest the original source code might be deleted. Download jail.tar.xz if you want to test it. Edit .JailSwitch.sh to correspond to your system.
The Gentoo Wiki possibly describes more elegant, but more involved methods to obtain a similar effect. I’ll report back if I can get one of those methods to work successfully, and if they do indeed work more elegantly.