OP is on linux, and he wants to know about detecting/mouse events (movement). That's what matters.
Let me says I don't know much about mouse movement on linux, but this topic sort of piqued my interest.
Unlike Windows, Linux doesn't have a unified desktop environment (windowing system). You need to tell us what you're using. X, KDE, GNOME, etc.? If I had to guess, then you're most likely using the X11 window system.
If so, you need to look into Xlib. Try searching on the web for xlib and mouse/pointer events.
Xlib provides functions that you can use to control input from the pointer, which usually is a mouse. Usually, as soon as keyboard and mouse events occur, the X server delivers them to the appropriate client, which is determined by the window and input focus. The X server provides sufficient control over event delivery to allow window managers to support mouse ahead and various other styles of user interface. Many of these user interfaces depend upon synchronous delivery of events. The delivery of pointer and keyboard events can be controlled independently.