On Windows you can "capture" the mouse to continue receiving mouse events even when it goes outside the window's client area. Here the SetCapture() documentation: http://msdn.microsoft.com/en-us/library/ms646262(VS.85).aspx
I would like to know what is the equivalent function in Linux (X11) and Mac OS X (Cocoa).