There are two ways to determine the position of the pointer: by direct examination of variables in the window structure at any time, and by examining messages sent by Intuition which inform the application of pointer movement. The pointer coordinates are relative to the upper left corner of the window and are reported in the resolution of the screen, even though the pointer's visible resolution is always in low-resolution pixels (note that the pointer is actually a sprite). The mousex and mousey fields of the window structure always contain the current pointer x and y coordinates, whether or not the window is the active one. If the window is a gimmezerozero window, the variables gzzmousex and gzzmousey in the window structure contain the position of the mouse relative to the upper left corner of the inner window. If the window is receiving mouse move messages, it will get a set of x,y coordinates each time the pointer moves. To receive messages about pointer movements, the wflg_reportmouse flag must be set in the window structure. This flag can be set when the window is opened. The flag can also be modified after the window is open by calling reportmouse(), however C programmers should avoid this function. ReportMouse() has problems due to historic confusion about the ordering of its C language arguments. Do not use ReportMouse() unless you are programming in assembler. C programmers should set the flag directly in the Window structure using an atomic operation. Most compilers generate atomic code for operations such as mywindow->flags |= wflg_reportmouse or mywindow->flags &= ~wflg_reportmouse. if you are unsure of getting an atomic operation from your compiler, you may wish to do this operation in assembler, or bracket the code with a forbid()/permit() pair. After the wflg_reportmouse flag is set, whenever the window is active it will be sent an idcmp_mousemove messages each time the pointer position changes. The window must have the IDCMP flag IDCMP_MOUSEMOVE set to receive these messages. Mouse movements can cause a very large number of messages to be sent to the IDCMP, the application should be prepared to handle them efficiently. Messages about pointer movements may also be activated by setting the flag gact_followmouse in an application gadget structure. when this flag is set in a gadget, changes in the pointer position are reported as long as the gadget is selected by the user. These messages are also sent as idcmp_mousemove messages.