I find that if you swipe with three fingers left or right on Mac OS X to switch spaces, and you hesitate, it sometimes locks in a partly-swiped position with part of the screen offscreen. The result is, surprisingly, that the trackpad and clicking stops working, except for mouse movement. Scrolling and clicking stops; mouse moving continues. Attaching an external mouse does not help.
There are three solutions.
1. Disable spaces (click everything off under the system preferences for Spaces and Keyboard Shortcuts). This solution is mentioned often online but doesn’t in fact work! The three-finger swipe to switch spaces keeps working!
2. Enable three-finger swipe as “drag”. I find this is the only working solution.
3. Open terminal (or keep it open) and command-tab to the commandline. Type sudo reboot. This however doesn’t prevent it happening again.