This function, located in the file ui_can_MWEvent.c, does the following:
SWITCH (event type) ButtonPress: get event data; SWITCH (mouse button): left button: remember current first position for selection of area; draw selection rectangle; middle button: remember current position as source unit, if there is a unit; ButtonRelease: get event data; SWITCH (mouse button): left button: delete selection rectangle; remember second position for area and normalize both coordinates; select or unselect area; middle button: IF info panel created THEN show this unit as target and remembered unit as source; right button: IF empty position THEN unselect all (in this subnet) ELSE unselect this single unit EnterNotify (mouse is moved into a graphic window): set this window as actual and show new status; MouseMoves (mouse is moved): show new status, if new grid position reached; MouseDragg (mouse is moved with at least one button down): if the left button is pressed, delete old selection box, draw a new one. save position of the event in the global variables ui_pixPosOld and ui_gridPosOld;
The actions to these events are defined in this function. The results affect the info panel and the status panel.