Question related to GLUT window

Hi all,
I have created a window using GLUT. Now, how do I get position of the cursor on the GLUT window. Though I can capture click events I am unable to get the cursor position, ie, when the mouse is simply ON the window but not clicked.

One way should be by glutPassiveMotionFunc. Here is some more information

You can use the selection Buffer for “know” where you click with the mouse