Detect when app window is being moved

Is there a way to detect when your apps (or any app I guess) is being moved by the user clicking and dragging the main window around the desktop at all?

I'm trying to find out if there's a way I can find out if a window is being clicked and dragged and whether there's certain triggers to the movement a little bit like shaking an iPhone with Shake to Undo.

Thanks

Detect when app window is being moved
 
 
Q