This function, in the file ui_KEvent.c, is implemented as a big SWITCH statement. It represents an automaton for the recognition of editor commands. The transition from one state to the following state (stored in the global variable ui_key_currentState) is performed at the next call to the function. Depending upon the selected mode (normal, Mode Units, Mode Links), the following state is stored in one of the global variables ui_key_returnUnitState or ui_key_returnLinkState. This means that the automata changes its behaviour according to these two variables.
On Units Move/Copy the user is expected to click on a target position. In the meantime the automata is on hold ( UI_STATE_GETDEST), and signals this to the event handler for mouse and window events in the global varaible ui_outlineActiv. When the target is defined, this event handler defines the next state of the automata.
Some actions ask the user for a value in a popup window. Since this blocks SNNS-XGUI as a whole (with XtPopup(widget, XtGrabExclusive)), no additional steps have to be taken.