Help for !Mouse (Part 10 of the Tutorial)
---------------------------------------

!Mouse shows how to obtain information about the mouse in a window and the window itself, using the window_info block.

Breakdown:
----------
Since the window is created when the task is started, I created it directly inside the windows_setup() routine this time.  Two events are claimed for updating the window display.  The function set_window_display() is called whenever the window is opened (i.e. moved) and set_mouse_display() is called every time a mouse click occurs.  Notice that the clicks inside the display window do not collide with menu clicks on the icon bar.  This is because this event has been assigned especially to the display window.

The function set_mouse_display() gets information about the mouse by calling Wimp_GetPointerInfo(), which returns a mouse block with all relevant information.  The position of the mouse returned by this is the absolute position of the mouse on the screen, though.  To calculate the position of the mouse relative to the visible window area, a bit more information is needed.  This information is obtained by the function Window_GetInfo3(), which returns a block with all the window information.  The relative position of the mouse is obtained by simply subtracting the window position from the absolute position of the mouse.

Set_window_display() is less mathematical.  At the very beginning the function Wimp_OpenWindow() is called to make up for the fact that we don't use the standard handler for opening windows in our event claim any more.  Without this the window wouldn't budge.
After this the info about the window is obtained just as in set_mouse_display.  The three groups of icons concerned with the screen are set to display the contents of the screen rectangle, work area and scroll entries of the window information block.