While a gadget is active, Intuition sends it a gm_handleinput message for every timer pulse, mouse move, mouse click, and key press that takes place. A timer event pulse arrives about every tenth of a second. Mouse move events can arrive at a much higher rate than the timer pulses. Without even considering the keyboard, a gadget can get a lot of GM_HANDLEINPUT messages in a short amount of time. Because the active gadget has to handle a large volume of GM_HANDLEINPUT messages, the overhead of this method should be kept to a minimum. Because the gadget will always receive a gm_goactive message before it is active and a gm_goinactive message after it is no longer active, the gadget can use these methods to allocate, initialize, and deallocate temporary resources it needs for the gm_handleinput method. this can significantly reduce the overhead of GM_HANDLEINPUT because it eliminates the need to allocate, initialize, and deallocate resources for every GM_HANDLEINPUT message. Note that the rastport from obtaingirport() is not cachable using this method. If the gm_handleinput method needs to use a rastport, it has to obtain and release the RastPort for every GM_HANDLEINPUT message using ObtainGIRPort() and releasegirport(). rkmbuttonclass.c